前言
在拿到系統后,系統中可能存在連接其他服務器的軟件,或瀏覽器等
這時候就需要去解密像ssh這類的連接軟件,所有這里我對軟件的密碼獲取做總結
ssh和ftp鏈接類
xshell
Xshell 是一個強大的安全終端模擬軟件,它支持SSH1, SSH2, 以及Microsoft Windows 平台的TELNET 協議。
先找到xshell保存密碼的位置,點打開會話文件夾
其中.xsh里面就是保存的鏈接信息包括賬戶密碼
前提是登錄的時候必須勾選了記住賬戶和密碼
離線解密工具:https://github.com/HyperSine/how-does-Xmanager-encrypt-password
python XShellCryptoHelper.py -d -key 123123 zVi7hm/Nsk6y2BGpTNSvXlPRN+/1P+aQ
123132為主控密碼在文件導出的時候設置 后面為.xsh文件中的password字段類容
另一種解法 未設置主控密碼需要user和sid
whoami /user 查看user和sid
python XShellCryptoHelper.py -d -user aaaa -sid S-1-5-21-4217108860-1001 zVi7hm/Nsk6y2BGpTNSvXlPRN+/1P+aQ
使用在線工具https://github.com/uknowsec/SharpDecryptPwd
該工具只支持在線解密的方式,就是必須要將工具放到目標機器上運行。
xftp一樣的
SecureCRT
SecureCRT和xshell一樣,很多運維人員會將SSH的賬號密碼保存在上面。
前提時管理員登錄時勾選了記住密碼
SecureCRT密碼密碼存放位置
C:\Users\oneseven\AppData\Roaming\VanDyke\Config\Sessions
打開后 密碼是加密的 我們需要對其進行解密
SecureCRT 離線解密工具:
https://github.com/HyperSine/how-does-SecureCRT-encrypt-password
python SecureCRTCipher.py dec -v2 <密碼>
MobaXterm
MobaXterm是一款遠程終端控制軟件,集串口,SSH遠程登錄和FTP傳輸三合一的工具,便攜版操作簡單,使用非常方便。
連接過后會在當前目錄生成一個.ini文件
其中就儲存着我們登錄的賬戶密碼
離線工具:https://github.com/HyperSine/how-does-MobaXterm-encrypt-password
python MobaXtermCipher.py dec -sp <ini文件中的SessionP> <加密的Passwords>
finalshell
FinalShell是一體化的的服務器,網絡管理軟件,不僅是ssh客戶端,還是功能強大的開發,運維工具,充分滿足開發,運維需求
連接信息存儲在C:\Users\oneseven\AppData\Local\finalshell\conn\ 目錄下 有多少條連接就會有多少個xxx_connect_config.json文件
用戶登錄時必須勾選記住密碼,否則不會在xxx_connect_config.json文件中保存密碼
離線解密:別人已經寫好了的java代碼
FinalShellDecodePass.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(args[0]));
}
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;
}
}
先進行編譯javac FinalShellDecodePass.java,在運行java FinalShellDecodePass <password>
其中password就是xxx_connect_config.json文件中的password字段類容
Winscp
一個 Windows 環境下使用的 SSH 的開源圖形化 SFTP 客戶端
解密:
密碼是保存在注冊表中
reg query "HKEY_CURRENT_USER\Software\Martin Prikryl\WinSCP 2\Sessions”
可以看到鏈接名稱,但需要建站點時保存密碼
離線工具https://github.com/anoopengineer/winscppasswd
winscppasswd.exe <主機> <用戶名> <加密密碼>
使用在線工具SharpDecryptPwd可直接獲取密碼
FileZilla
一款FTP操作類的軟件
首先導出記錄
導出后是一個xml文件 打開后base64就是密碼 直接解密就行
使用在線工具SharpDecryptPwd