FinalShell是一体化的的服务器,网络管理软件,不仅是ssh客户端,还是功能强大的开发,运维工具,充分满足开发,运维需求

连接信息存储

连接信息存储在C:\Users\oneseven\AppData\Local\finalshell\conn\目录下 有多少条连接就会有多少个xxx_connect_config.json文件
用户登录时必须勾选记住密码,否则不会在xxx_connect_config.json文件中保存密码

离线解密

FinalShellDecodePass.java

  1. import java.io.ByteArrayOutputStream;
  2. import java.io.DataOutputStream;
  3. import java.io.IOException;
  4. import java.math.BigInteger;
  5. import java.security.MessageDigest;
  6. import java.security.NoSuchAlgorithmException;
  7. import java.security.SecureRandom;
  8. import java.util.Base64;
  9. import java.util.Random;
  10. import javax.crypto.Cipher;
  11. import javax.crypto.SecretKey;
  12. import javax.crypto.SecretKeyFactory;
  13. import javax.crypto.spec.DESKeySpec;
  14. public class FinalShellDecodePass {
  15. public static void main(String[] args)throws Exception {
  16. System.out.println(decodePass(args[0]));
  17. }
  18. public static byte[] desDecode(byte[] data, byte[] head) throws Exception {
  19. SecureRandom sr = new SecureRandom();
  20. DESKeySpec dks = new DESKeySpec(head);
  21. SecretKeyFactory keyFactory = SecretKeyFactory.getInstance("DES");
  22. SecretKey securekey = keyFactory.generateSecret(dks);
  23. Cipher cipher = Cipher.getInstance("DES");
  24. cipher.init(2, securekey, sr);
  25. return cipher.doFinal(data);
  26. }
  27. public static String decodePass(String data) throws Exception {
  28. if (data == null) {
  29. return null;
  30. } else {
  31. String rs = "";
  32. byte[] buf = Base64.getDecoder().decode(data);
  33. byte[] head = new byte[8];
  34. System.arraycopy(buf, 0, head, 0, head.length);
  35. byte[] d = new byte[buf.length - head.length];
  36. System.arraycopy(buf, head.length, d, 0, d.length);
  37. byte[] bt = desDecode(d, ranDomKey(head));
  38. rs = new String(bt);
  39. return rs;
  40. }
  41. }
  42. static byte[] ranDomKey(byte[] head) {
  43. long ks = 3680984568597093857L / (long)(new Random((long)head[5])).nextInt(127);
  44. Random random = new Random(ks);
  45. int t = head[0];
  46. for(int i = 0; i < t; ++i) {
  47. random.nextLong();
  48. }
  49. long n = random.nextLong();
  50. Random r2 = new Random(n);
  51. long[] ld = new long[]{
  52. (long)head[4], r2.nextLong(), (long)head[7], (long)head[3], r2.nextLong(), (long)head[1], random.nextLong(), (long)head[2]};
  53. ByteArrayOutputStream bos = new ByteArrayOutputStream();
  54. DataOutputStream dos = new DataOutputStream(bos);
  55. long[] var15 = ld;
  56. int var14 = ld.length;
  57. for(int var13 = 0; var13 < var14; ++var13) {
  58. long l = var15[var13];
  59. try {
  60. dos.writeLong(l);
  61. } catch (IOException var18) {
  62. var18.printStackTrace();
  63. }
  64. }
  65. try {
  66. dos.close();
  67. } catch (IOException var17) {
  68. var17.printStackTrace();
  69. }
  70. byte[] keyData = bos.toByteArray();
  71. keyData = md5(keyData);
  72. return keyData;
  73. }
  74. public static byte[] md5(byte[] data) {
  75. String ret = null;
  76. byte[] res=null;
  77. try {
  78. MessageDigest m;
  79. m = MessageDigest.getInstance("MD5");
  80. m.update(data, 0, data.length);
  81. res=m.digest();
  82. ret = new BigInteger(1, res).toString(16);
  83. } catch (NoSuchAlgorithmException e) {
  84. e.printStackTrace();
  85. }
  86. return res;
  87. }
  88. }

先编译

  1. javac FinalShellDecodePass.java

运行

  1. java FinalShellDecodePass <password>

其中password就是xxx_connect_config.json文件中的password字段