• [转]finalshell导出密码解密


    原文地址:finalshell导出密码解密解密 - 简书 (jianshu.com)

    connect_config.json中password为加密后的密码。


     
    image.png

    使用下面java程序可以解密
    TVE5YhZeGxyOCxxxxxxCUAnkVWgAeJ3L替换为自己服务器的密文

    https://c.runoob.com/compile/10/
    可以将下面代码贴到在线编辑器中运行,不用安装java程序

    import java.io.ByteArrayOutputStream;
    import java.io.DataOutputStream;
    import java.io.IOException;
    import java.math.BigInteger;
    import java.security.MessageDigest;
    import java.security.NoSuchAlgorithmException;
    import java.security.SecureRandom;
    import java.util.Base64;
    import java.util.Random;
    
    import javax.crypto.Cipher;
    import javax.crypto.SecretKey;
    import javax.crypto.SecretKeyFactory;
    import javax.crypto.spec.DESKeySpec;
    
    public class FinalShellDecodePass {
        public static void main(String[] args)throws Exception {
            System.out.println(decodePass("TVE5YhZeGxyOCxxxxxxCUAnkVWgAeJ3L"));
        }
        public static byte[] desDecode(byte[] data, byte[] head) throws Exception {
            SecureRandom sr = new SecureRandom();
            DESKeySpec dks = new DESKeySpec(head);
            SecretKeyFactory keyFactory = SecretKeyFactory.getInstance("DES");
            SecretKey securekey = keyFactory.generateSecret(dks);
            Cipher cipher = Cipher.getInstance("DES");
            cipher.init(2, securekey, sr);
            return cipher.doFinal(data);
        }
        public static String decodePass(String data) throws Exception {
            if (data == null) {
                return null;
            } else {
                String rs = "";
                byte[] buf = Base64.getDecoder().decode(data);
                byte[] head = new byte[8];
                System.arraycopy(buf, 0, head, 0, head.length);
                byte[] d = new byte[buf.length - head.length];
                System.arraycopy(buf, head.length, d, 0, d.length);
                byte[] bt = desDecode(d, ranDomKey(head));
                rs = new String(bt);
    
                return rs;
            }
        }
        static byte[] ranDomKey(byte[] head) {
            long ks = 3680984568597093857L / (long)(new Random((long)head[5])).nextInt(127);
            Random random = new Random(ks);
            int t = head[0];
    
            for(int i = 0; i < t; ++i) {
                random.nextLong();
            }
    
            long n = random.nextLong();
            Random r2 = new Random(n);
            long[] ld = new long[]{(long)head[4], r2.nextLong(), (long)head[7], (long)head[3], r2.nextLong(), (long)head[1], random.nextLong(), (long)head[2]};
            ByteArrayOutputStream bos = new ByteArrayOutputStream();
            DataOutputStream dos = new DataOutputStream(bos);
            long[] var15 = ld;
            int var14 = ld.length;
    
            for(int var13 = 0; var13 < var14; ++var13) {
                long l = var15[var13];
    
                try {
                    dos.writeLong(l);
                } catch (IOException var18) {
                    var18.printStackTrace();
                }
            }
    
            try {
                dos.close();
            } catch (IOException var17) {
                var17.printStackTrace();
            }
    
            byte[] keyData = bos.toByteArray();
            keyData = md5(keyData);
            return keyData;
        }
        public static byte[] md5(byte[] data) {
            String ret = null;
            byte[] res=null;
    
            try {
                MessageDigest m;
                m = MessageDigest.getInstance("MD5");
                m.update(data, 0, data.length);
                res=m.digest();
                ret = new BigInteger(1, res).toString(16);
            } catch (NoSuchAlgorithmException e) {
                e.printStackTrace();
            }
            return res;
        }
    }


    作者:SailSea
    链接:https://www.jianshu.com/p/f5bfa7b229de
    来源:简书
    著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。
  • 相关阅读:
    个人冲刺二(2)
    个人冲刺二(1)
    三个和尚观后感
    每日总结
    个人冲刺(10)
    个人冲刺(9)
    个人冲刺(8)
    个人冲刺(7)
    个人冲刺(6)
    下次视频面试前把电脑摄像头擦干净吧
  • 原文地址:https://www.cnblogs.com/dirgo/p/16810263.html
Copyright © 2020-2023  润新知