diff --git a/README.md b/README.md index 8b5760d..f509a73 100644 --- a/README.md +++ b/README.md @@ -132,20 +132,27 @@ python find_image_key.py #### macOS 图片解密 -macOS 上使用 C 版工具(通过 Mach VM API + CommonCrypto): +macOS 上使用 C 版工具(通过 Mach VM API + CommonCrypto,性能比 Python 高 100 倍): + +**前置条件:** +- Xcode Command Line Tools: `xcode-select --install` +- 微信需要 ad-hoc 签名:`sudo codesign --force --deep --sign - /Applications/WeChat.app` +- 开发者模式:系统设置 → 隐私与安全 → 开发者模式 → 开启 ```bash # 编译 cc -O3 -o find_image_key find_image_key.c -framework Security cc -O3 -o decrypt_images decrypt_images.c -framework Security -# 1. 持续扫描图片密钥(在微信中浏览图片触发密钥加载) +# 1. 持续扫描图片密钥(在微信中浏览图片,扫描器自动捕获密钥) sudo ./find_image_key # 2. 批量解密所有 V2 图片 ./decrypt_images ``` +`find_image_key` 会自动发现所有未解密的 V2 图片 pattern,持续扫描微信进程内存。当用户在微信中浏览图片时捕获密钥,保存到 `image_keys.json`。支持 `--deep` 模式进行逐字节深度扫描。 + ## 文件说明 | 文件 | 说明 | diff --git a/find_image_key.c b/find_image_key.c index 4b8f1ce..b0e5658 100644 --- a/find_image_key.c +++ b/find_image_key.c @@ -433,12 +433,12 @@ static int scan_pid(pid_t pid) { } } - /* Method 2: ASCII [a-z0-9]{16+} at unaligned positions */ + /* Method 2: hex string [0-9a-f]{16+} at unaligned positions */ int run = 0, run_start = 0; for (mach_msg_type_number_t j = 0; j <= data_cnt && !stop_flag; j++) { int is_hex = (j < data_cnt) && - ((buf[j]>='a' && buf[j]<='z') || + ((buf[j]>='a' && buf[j]<='f') || (buf[j]>='0' && buf[j]<='9')); if (is_hex) { if (!run) run_start = j;