逆向过程
抓取登录包

分析
- 登录包里面有
uname
和password
都是base64编码后的放入解密网站里面解出来为乱码,说明应该有别的加密
- 追踪一下源码(看js调用)

找到js加密,发现是AES加密,并且key给了出来

然后追踪一下其自定义的encryptByAES函数
AES加密代码
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
| function encryptByAES(message, key){ let CBCOptions = { iv: CryptoJS.enc.Utf8.parse(key), mode:CryptoJS.mode.CBC, padding: CryptoJS.pad.Pkcs7 }; let aeskey = CryptoJS.enc.Utf8.parse(key); let secretData = CryptoJS.enc.Utf8.parse(message); let encrypted = CryptoJS.AES.encrypt( secretData, aeskey, CBCOptions ); return CryptoJS.enc.Base64.stringify(encrypted.ciphertext); }
|
编写python解密脚本
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
| from base64 import b64decode from Crypto.Cipher import AES from Crypto.Util.Padding import unpad
def decryptByAES(base64_msg, key): base64_decode_msg = b64decode(base64_msg)
cipher = AES.new(key.encode('utf-8'), AES.MODE_CBC, IV=key.encode('utf-8'))
aes_decode_msg = unpad(cipher.decrypt(base64_decode_msg), AES.block_size)
raw_msg = aes_decode_msg.decode('utf-8')
return raw_msg
key = "u2oh6Vu^HWe4_AES" msg = "47leAZ1BfFA1xXYbIXaALw=="
print(decryptByAES(msg, key))
|