Does any one knows how the password was encrypted in xshell sessions

961 Views Asked by At

i try to decrypt the encrypted password in .xsh file, i'v searched the answers for sometime, but got almost nothing, some one say there is a python version, i try to rewrite it in java, but it does't work. [here is the phython version]: https://github.com/dzxs/Xdecrypt/blob/master/Xdecrypt.py

this is what i got

        String sid = "*********";
        String encryptedPwd = "************";

        byte[] encryptedPwdBytes = Base64.decode(encryptedPwd);
        byte[] keyBytes = DigestUtil.digest(sid.getBytes(), "SHA-256");

        SecretKeySpec key = new SecretKeySpec(keyBytes, "ARC4");
        Cipher cipher = Cipher.getInstance("ARC4", new BouncyCastleProvider());

        cipher.init(Cipher.DECRYPT_MODE, key);
        byte[] bytes = cipher.update(encryptedPwdBytes, 0, encryptedPwdBytes.length);

        System.out.println(new String(bytes));

it doen't work.

0

There are 0 best solutions below