本来github上面有个解密的项目但是私有了来着,刚刚花了点时间看看
解密代码
from Crypto.Cipher import AES
from Crypto.Util.Padding import unpad
def decrypt_file(input_path: str, output_path: str, key: bytes, iv: bytes):
with open(input_path, 'rb') as f:
data = f.read()
cipher = AES.new(key, AES.MODE_CBC, iv)
decrypted = unpad(cipher.decrypt(data), AES.block_size)
with open(output_path, 'wb') as f:
f.write(decrypted)
key_hex = "a7 3c c5 f9 0b c3 21 b2 51 75 6a 93 b7 0a 93 38"
key = bytes.fromhex(key_hex)
def to_signed_64(val: int) -> int:
val &= 0xFFFFFFFFFFFFFFFF
if val >= 0x8000000000000000:
val -= 0x10000000000000000
return val
def calc_iv_bytes(filename: str) -> bytes:
v7 = 95719367
for c in filename:
v7 = (v7 * 31 + ord(c)) & 0xFFFFFFFFFFFFFFFF
v10 = 19478245
for c in reversed(filename):
v10 = (v10 * 31 + ord(c)) & 0xFFFFFFFFFFFFFFFF
v7 = to_signed_64(v7)
v10 = to_signed_64(v10)
return v7.to_bytes(8, 'little', signed=True) + v10.to_bytes(8, 'little', signed=True)
filename = "zh_c5a9ea35f3a3e8327f0188c21019c7ae.bundle"
iv = calc_iv_bytes(filename)
decrypt_file(filename, filename + ".dec", key, iv)