From 396d4b24e21b145dd838bbd977863c755ebfb1ee Mon Sep 17 00:00:00 2001 From: ylytdeng Date: Thu, 26 Mar 2026 16:40:03 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20CLI=20=E5=85=A5=E5=8F=A3=E6=94=AF?= =?UTF-8?q?=E6=8C=81=20V2(AES)=20=E6=A0=BC=E5=BC=8F=E5=9B=BE=E7=89=87?= =?UTF-8?q?=E8=A7=A3=E5=AF=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit decode_image.py 的 CLI 入口之前只走 XOR 解密路径, V2 格式图片会直接报错退出。改为使用 decrypt_dat_file 智能入口,自动判断 V1/V2/XOR 格式。 Co-Authored-By: Claude Opus 4.6 (1M context) --- decode_image.py | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/decode_image.py b/decode_image.py index 773446f..f9edbc4 100644 --- a/decode_image.py +++ b/decode_image.py @@ -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)