Commit 98be58b0c7ffe9e1d9dedfcc036600de58d1410f

Authored by yibo
1 parent 30083104

refactor(wechat_plain/scripts): 按功能重组目录结构

把顶层平铺的脚本按功能归入子目录,并清理可重新生成的产物:

- db-decrypt/: Frida 抓 key + 解密 EnMicroMsg.db(attach↔hunter 同目录依赖保持)
- search/: Web 搜索服务 + 聊天统计生成
- docs/: HANDOFF.md / README_Android.md + notes/(原 md/)
- 删除 *.tar.gz / *.zip 打包产物与 GITEOF,新增 .gitignore
- 新增 README.md 目录索引,同步文档内路径引用

lsposed-wechat-sendmsg / local-testkit / platform-tools / frida-daemon / archive 保持不动。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Showing 25 changed files with 56 additions and 13 deletions
wechat_plain/scripts/.gitignore 0 → 100644
  1 +# 可重新生成的打包产物(用 zip -r / tar 重新打)
  2 +*.tar.gz
  3 +*.zip
  4 +
  5 +# macOS 产物
  6 +.DS_Store
... ...
wechat_plain/scripts/GITEOF deleted
wechat_plain/scripts/README.md 0 → 100644
  1 +# wechat_plain/scripts — 目录索引
  2 +
  3 +Pixel 上微信 bot 的脚本与工具,按功能分目录管理。
  4 +
  5 +| 目录 | 功能 | 状态 |
  6 +|------|------|------|
  7 +| [`db-decrypt/`](db-decrypt/) | Frida hook `libWCDB.so` 抓 SQLCipher key + 解密 `EnMicroMsg.db`(Android v1/v2 + Mac 旧路线 + 浏览器解密页) | 可用 |
  8 +| [`search/`](search/) | 解密库之上的 Web 搜索服务(`search_server*.py`)+ 聊天统计生成(`build_chat_stats.py`) | 可用 |
  9 +| [`lsposed-wechat-sendmsg/`](lsposed-wechat-sendmsg/) | **A11y 发送模块 = 当前唯一能把消息真正推进 `message` 表的主发送链路**(`HermesAccessibilityService`,纯 UI 自动化) | 主线 ✅ |
  10 +| [`local-testkit/`](local-testkit/) | Pixel 端部署 / 自启动 / 测试套件(hermes daemon、termux boot、各类 debug/test 脚本) | 可用 |
  11 +| [`platform-tools/`](platform-tools/) | adb / fastboot 等 Android 平台二进制 | 工具 |
  12 +| [`frida-daemon/`](frida-daemon/) | 早期 Frida 发送队列实现 | **已废弃**(注入大 bundle 触发反调试致微信崩溃) |
  13 +| [`archive/`](archive/) | 更早期的 Frida / lldb PoC 脚本 | 归档 |
  14 +| [`docs/`](docs/) | 文档:`HANDOFF.md`、`README_Android.md`、`notes/`(项目/参考笔记) | — |
  15 +
  16 +> 发送链路现状详见仓库根 `CLAUDE.md` §微信集成架构:只有 `lsposed-wechat-sendmsg` 的 A11y service 真正生效,frida-daemon 与 LSPosed 反射 API 两条路径均已废弃。
  17 +
  18 +## 常见入口
  19 +
  20 +```bash
  21 +# 以本目录 (wechat_plain/scripts/) 为工作目录
  22 +
  23 +# 抓 key + 解密(Android)
  24 +python3 db-decrypt/wechat_android_attach.py # 抓 SQLCipher key
  25 +python3 db-decrypt/wechat_android_attach.py --extract-db
  26 +python3 db-decrypt/wechat_android_attach.py --decrypt
  27 +
  28 +# 启动搜索 Web UI
  29 +python3 search/search_server_android.py ~/wxmoment/dbs/EnMicroMsg.db.decrypted.db
  30 +```
  31 +
  32 +详细操作见 [`docs/README_Android.md`](docs/README_Android.md) 与 [`docs/HANDOFF.md`](docs/HANDOFF.md)。
... ...
wechat_plain/scripts/wechat-db-decrypt.html renamed to wechat_plain/scripts/db-decrypt/wechat-db-decrypt.html
wechat_plain/scripts/wechat_android_attach.py renamed to wechat_plain/scripts/db-decrypt/wechat_android_attach.py
wechat_plain/scripts/wechat_android_attach_v2.py renamed to wechat_plain/scripts/db-decrypt/wechat_android_attach_v2.py
wechat_plain/scripts/wechat_android_full_hunter.js renamed to wechat_plain/scripts/db-decrypt/wechat_android_full_hunter.js
wechat_plain/scripts/wechat_android_key_hunter.js renamed to wechat_plain/scripts/db-decrypt/wechat_android_key_hunter.js
wechat_plain/scripts/wechat_earlybird.py renamed to wechat_plain/scripts/db-decrypt/wechat_earlybird.py
wechat_plain/scripts/wechat_export_all.py renamed to wechat_plain/scripts/db-decrypt/wechat_export_all.py
wechat_plain/scripts/wechat_key_hunter.js renamed to wechat_plain/scripts/db-decrypt/wechat_key_hunter.js
wechat_plain/scripts/HANDOFF.md renamed to wechat_plain/scripts/docs/HANDOFF.md
... ... @@ -11,12 +11,15 @@
11 11  
12 12 ## 文件位置(全部在 Termux 主目录下)
13 13  
  14 +部署到手机后这些文件**平铺**在一个目录里(下方命令均假设当前目录就是它)。
  15 +仓库源码则按功能分目录:`scripts/db-decrypt/`(解密套件)、`scripts/search/`(搜索服务)、`scripts/docs/`(本文档)。
  16 +
14 17 ```
15 18 ~/.hermes/tools/wechat/
16   -├── wechat_android_key_hunter.js # Frida 脚本:hook libWCDB.so 截获 SQLCipher key
17   -├── wechat_android_attach.py # Python 控制脚本:attach / extract / decrypt
18   -├── search_server_android.py # Web 搜索服务器:读取解密后的 EnMicroMsg.db
19   -└── README_Android.md # 完整操作文档
  19 +├── wechat_android_key_hunter.js # Frida 脚本:hook libWCDB.so 截获 SQLCipher key ← 源: db-decrypt/
  20 +├── wechat_android_attach.py # Python 控制脚本:attach / extract / decrypt ← 源: db-decrypt/
  21 +├── search_server_android.py # Web 搜索服务器:读取解密后的 EnMicroMsg.db ← 源: search/
  22 +└── README_Android.md # 完整操作文档 ← 源: docs/
20 23 ```
21 24  
22 25 ## 关键成果(已通过测试验证)
... ...
wechat_plain/scripts/README_Android.md renamed to wechat_plain/scripts/docs/README_Android.md
1 1 # WeChat Android EnMicroMsg.db 解密读取工具链
2 2  
  3 +> 下面命令均以 `wechat_plain/scripts/` 为工作目录。解密套件在 `db-decrypt/`,搜索服务在 `search/`。
  4 +
3 5 ## 文件清单
4 6  
5 7 | 文件 | 用途 | 运行环境 |
6 8 |------|------|----------|
7   -| `wechat_android_key_hunter.js` | Frida 脚本:hook `libWCDB.so` 的 `sqlite3_key` / `sqlite3_key_v2`,截获 SQLCipher 密码 | Android 微信进程 |
8   -| `wechat_android_attach.py` | Python 控制脚本:attach 微信、收集 key、提取 DB、自动解密 | Termux / Debian proot / Mac |
9   -| `search_server_android.py` | Web 搜索服务器:读取解密后的 `EnMicroMsg.db`,提供会话/联系人/聊天记录搜索 | 任意有 Python 的环境 |
  9 +| `db-decrypt/wechat_android_key_hunter.js` | Frida 脚本:hook `libWCDB.so` 的 `sqlite3_key` / `sqlite3_key_v2`,截获 SQLCipher 密码 | Android 微信进程 |
  10 +| `db-decrypt/wechat_android_attach.py` | Python 控制脚本:attach 微信、收集 key、提取 DB、自动解密 | Termux / Debian proot / Mac |
  11 +| `search/search_server_android.py` | Web 搜索服务器:读取解密后的 `EnMicroMsg.db`,提供会话/联系人/聊天记录搜索 | 任意有 Python 的环境 |
10 12  
11 13 ## 工作原理
12 14  
... ... @@ -23,7 +25,7 @@ adb shell su -c cat 复制 DB 文件到本地
23 25 ↓
24 26 sqlcipher 解密:PRAGMA key="e03ce81"; PRAGMA cipher_compatibility=1; PRAGMA cipher_page_size=1024;
25 27 ↓
26   -SQLite 明文库 → search_server_android.py 提供 Web UI
  28 +SQLite 明文库 → search/search_server_android.py 提供 Web UI
27 29 ```
28 30  
29 31 ## 关键发现(WeChat 8.0.72 on Android)
... ... @@ -82,7 +84,7 @@ pip install frida==17.9.10
82 84 ### 2. 捕获 SQLCipher key
83 85  
84 86 ```bash
85   -python3 wechat_android_attach.py
  87 +python3 db-decrypt/wechat_android_attach.py
86 88 ```
87 89  
88 90 - 脚本会自动 kill 微信、重新启动、attach Frida
... ... @@ -92,7 +94,7 @@ python3 wechat_android_attach.py
92 94 ### 3. 提取 DB 文件
93 95  
94 96 ```bash
95   -python3 wechat_android_attach.py --extract-db
  97 +python3 db-decrypt/wechat_android_attach.py --extract-db
96 98 ```
97 99  
98 100 - 复制 `EnMicroMsg.db` + `-shm` + `-wal` 到 `~/wxmoment/dbs/`
... ... @@ -101,7 +103,7 @@ python3 wechat_android_attach.py --extract-db
101 103 ### 4. 解密 DB
102 104  
103 105 ```bash
104   -python3 wechat_android_attach.py --decrypt
  106 +python3 db-decrypt/wechat_android_attach.py --decrypt
105 107 ```
106 108  
107 109 - 自动尝试字符串密码 / hex key + 多种 cipher 配置组合
... ... @@ -110,7 +112,7 @@ python3 wechat_android_attach.py --decrypt
110 112 ### 5. 启动搜索服务器
111 113  
112 114 ```bash
113   -python3 search_server_android.py ~/wxmoment/dbs/EnMicroMsg.db.decrypted.db
  115 +python3 search/search_server_android.py ~/wxmoment/dbs/EnMicroMsg.db.decrypted.db
114 116 ```
115 117  
116 118 - 访问 http://localhost:5002
... ... @@ -131,7 +133,7 @@ DETACH DATABASE plain;
131 133  
132 134 ## Frida 脚本 API 说明
133 135  
134   -`wechat_android_key_hunter.js` 的 Hook 点:
  136 +`db-decrypt/wechat_android_key_hunter.js` 的 Hook 点:
135 137  
136 138 | Hook 函数 | 模块 | 用途 |
137 139 |-----------|------|------|
... ...
wechat_plain/scripts/md/MEMORY.md renamed to wechat_plain/scripts/docs/notes/MEMORY.md
wechat_plain/scripts/md/project-claude-code-termux.md renamed to wechat_plain/scripts/docs/notes/project-claude-code-termux.md
wechat_plain/scripts/md/project-hermes-setup.md renamed to wechat_plain/scripts/docs/notes/project-hermes-setup.md
wechat_plain/scripts/md/reference-wechat-android-re.md renamed to wechat_plain/scripts/docs/notes/reference-wechat-android-re.md
wechat_plain/scripts/md/user-profile.md renamed to wechat_plain/scripts/docs/notes/user-profile.md
wechat_plain/scripts/md/wechat-auto-reply-status.md renamed to wechat_plain/scripts/docs/notes/wechat-auto-reply-status.md
wechat_plain/scripts/local-testkit.tar.gz deleted
No preview for this file type
wechat_plain/scripts/local-testkit.zip deleted
No preview for this file type
wechat_plain/scripts/build_chat_stats.py renamed to wechat_plain/scripts/search/build_chat_stats.py
wechat_plain/scripts/search_server.py renamed to wechat_plain/scripts/search/search_server.py
wechat_plain/scripts/search_server_android.py renamed to wechat_plain/scripts/search/search_server_android.py
wechat_plain/scripts/wechat_android_toolkit.tar.gz deleted
No preview for this file type