對於小程序反編譯想必大家都不陌生
並且也有許多大神給出了自己的方法
具體可以參考下這篇
可能是我本人技術的問題,很多方法我都沒有成功
並且大部分都是在命令行進行,很不方便
所以就重新修改了一下,並進行封裝
效果圖
貼上核心代碼
1 key = PBKDF2( 2 wxid.encode("utf-8"), 3 salt.encode("utf-8"), 4 32, 5 count=1000, 6 hmac_hash_module=SHA1, 7 ) 8 # 生成key 9 # 讀取加密的內容 10 11 with open(file, mode="rb") as f: 12 dataByte = f.read() 13 14 # 初始化密鑰 15 cipher = AES.new(key, AES.MODE_CBC, iv.encode("utf-8")) 16 17 # 解密頭部1024個字節 18 originData = cipher.decrypt(dataByte[WXAPKG_FLAG_LEN : 1024 + WXAPKG_FLAG_LEN]) 19 20 # 初始化xor密鑰, 解密剩余字節 21 xorKey = 0x66 22 if len(wxid) >= 2: 23 xorKey = ord(wxid[len(wxid) - 2]) 24 25 afData = dataByte[1024 + WXAPKG_FLAG_LEN :] 26 27 out = bytearray() 28 for i in range(len(afData)): 29 out.append(afData[i] ^ xorKey) 30 31 originData = originData[0:1023] + out 32 33 # 保存解密后的數據 34 with open(put, mode="wb") as f: 35 f.write(originData)