fix: CLI 入口支持 V2(AES) 格式图片解密

decode_image.py 的 CLI 入口之前只走 XOR 解密路径,
V2 格式图片会直接报错退出。改为使用 decrypt_dat_file
智能入口,自动判断 V1/V2/XOR 格式。

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
feat/daemon-cli
ylytdeng 2026-03-26 16:40:03 +08:00
parent 0821dc0e4e
commit 396d4b24e2
1 changed files with 2 additions and 8 deletions

View File

@ -454,17 +454,11 @@ if __name__ == "__main__":
print(f"文件不存在: {dat_file}")
sys.exit(1)
key = detect_xor_key(dat_file)
if key is None:
print("无法检测 XOR key文件可能不是微信加密图片")
sys.exit(1)
print(f"检测到 XOR key: 0x{key:02X}")
result_path, fmt = xor_decrypt_file(dat_file, out_file, key)
result_path, fmt = decrypt_dat_file(dat_file, out_file)
if result_path:
size = os.path.getsize(result_path)
print(f"解密成功: {result_path}")
print(f"格式: {fmt}, 大小: {size:,} bytes")
else:
print("解密失败")
sys.exit(1)