Commit Graph

75 Commits (6e599dbe3396d1d8f4c0732d602fef0516c8bc23)
 

Author SHA1 Message Date
jackwener 6e599dbe33 docs: README 安装方式增加 cargo install wx-cli 2026-04-16 15:29:39 +08:00
jackwener fa7c99f159 chore: 补充 crates.io 发布元数据,包名改为 wx-cli,添加 MIT 许可证 2026-04-16 15:28:59 +08:00
jackwener 79a653b9c6 docs: 重写 README,对齐 Rust 单二进制实现 2026-04-16 15:23:43 +08:00
jackwener 02f6c4a748 chore: 删除 Python 遗留文件,仓库全部改为 Rust 实现 2026-04-16 15:22:29 +08:00
jakevin 6b7285c730
Merge pull request #1 from jackwener/feat/rust-rewrite
feat: Rust 完整重写 + 全部 bug 修复
2026-04-16 15:17:38 +08:00
jackwener 8bfea8869e fix: 修复全部 medium/low 优先级问题
- cache/daemon: mtime 比较从 f64(secs) 改为 u64(nanos),避免浮点误差丢失变更
- transport: Unix 启动 daemon 前调用 setsid(),使其脱离控制终端防止 SIGHUP
- daemon/mod: 删除对已废弃 watcher 模块的引用
- watcher.rs: 删除全量死代码文件(功能已内联至 daemon/mod.rs)
- query: find_msg_tables 实际按 max_ts 降序排序(原注释有排序但无实现)
- scanner: 移除三平台 scan_memory 中的 dedup_by(search_pattern 已全局去重)
- watch: Windows 平台返回明确错误而非静默失败
- CI: cargo build 增加 --locked 确保使用 Cargo.lock 版本
2026-04-16 15:12:33 +08:00
jackwener 113e1d2907 chore: 从 index 移除编译产物和 worktree 子仓库 2026-04-16 14:48:19 +08:00
jackwener 993ac1ed47 fix: 修复 review 发现的 4 个高优先级 bug
- Cargo.toml: libc 依赖范围从 macos 改为 unix(修复 Linux 编译失败)
- scanner/macos.rs: VM_REGION_BASIC_INFO_COUNT_64 改为硬编码 9(修复 mach_vm_region 调用失败)
- crypto/wal.rs: WAL 第一页帧不走主 DB 第一页特殊路径(修复 WAL 数据损坏)
- daemon/query.rs: 全局搜索传入正确 names_map(修复 sender 字段为空)
2026-04-16 14:48:03 +08:00
jackwener d475f6219b feat: Rust 完整重写 wx-cli(单一二进制,支持 macOS/Linux/Windows)
实现所有核心模块:
- src/crypto/: SQLCipher 4 页解密 + WAL 应用(AES-256-CBC)
- src/scanner/: 三平台内存扫描(macOS Mach VM / Linux /proc/mem / Windows ReadProcessMemory)
- src/daemon/: tokio 异步 daemon,Unix socket IPC,mtime-aware DB 缓存,WAL 监听推送
- src/cli/: clap CLI,自动启动 daemon,完整命令实现
- src/config.rs: 跨平台配置加载,兼容 Python 版 config.json 格式
- src/ipc.rs: 换行符分隔 JSON 协议,与 Python 版兼容
- .github/workflows/release.yml: 四平台自动构建发布

cargo build --release 验证通过,生成 4.8MB macOS arm64 单一二进制
2026-04-16 14:37:10 +08:00
jackwener 0d5ac82349 chore: 删除旧项目文件(MCP、Web UI、monitor 等) 2026-04-16 14:05:23 +08:00
jackwener 0d0ae22a98 docs: 恢复 ad-hoc 签名为必要前置步骤 2026-04-16 10:11:17 +08:00
jackwener 7610a54073 docs: ad-hoc 签名改为按需可选 2026-04-16 09:30:26 +08:00
jackwener 181472a4ff docs: 重写 README,对齐 daemon + CLI 架构 2026-04-16 09:13:31 +08:00
jackwener 152921acb2 feat: wx init/export,修复全局搜索聊天名称
- wx init: 自动检测微信数据目录,编译并运行密钥扫描器,更新 config.json
- wx export: 导出聊天记录为 markdown/txt/json,支持 --since/--until/--limit/-o
- 修复全局搜索(wx search)显示"未知"的问题:
  构建 md5(username)→username 反向索引,从表名 Msg_<md5> 还原联系人
- _refresh_names() 同步清除 _md5_to_uname 缓存
- 新增 15 个单元测试覆盖上述功能及 watch 协议
2026-04-16 01:38:40 +08:00
jackwener 01486c66d4 chore: 移除 requirements.txt,统一用 uv + pyproject.toml 管理依赖 2026-04-16 01:28:37 +08:00
jackwener c907cf53fe feat: daemon + CLI 架构 (wx_daemon.py + wx.py)
- wx_daemon.py: Unix socket server,mtime 感知 DB 缓存,WAL 监听,实时推送
- wx.py: Click CLI,自动拉起 daemon,sessions/history/search/contacts/watch
- pyproject.toml + uv.lock: uv 依赖管理
2026-04-16 01:28:22 +08:00
ylytdeng 69a2f44240 feat: /api/history 支持按群过滤和增量拉取,更新 README API 文档
- /api/history 新增 chat、since、limit 参数
- README 新增 HTTP API 端点说明和联系人标签工具文档

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-09 11:43:41 +08:00
ylytdeng 7eb29b03e8 feat: 新增联系人标签查询功能
解析 contact.db 的 contact_label 表和 extra_buffer protobuf Field #30,
支持查询标签列表及指定标签下的成员。

- mcp_server.py: 新增 get_contact_tags / get_tag_members MCP 工具
- monitor_web.py: 新增 /api/tags JSON 端点,支持 ?name= 过滤

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-06 09:54:21 +08:00
ylytdeng b80e7d1c14 fix: 新群/新联系人自动刷新联系人缓存
检测到消息的用户名不在联系人缓存中时,自动重新加载
contact.db,解决新建群聊一直显示 chatroom ID 的问题。

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-31 18:43:34 +08:00
ylytdeng 396d4b24e2 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>
2026-03-26 16:40:16 +08:00
joshua-deng 0821dc0e4e
Update README.md
加了一个tg群,防失联
2026-03-23 17:25:19 +08:00
ylytdeng 944546beb1 fix: 统一所有 JSON 文件读写为 UTF-8 编码
Windows 中文环境默认编码为 GBK,未指定 encoding 会导致
config.json/all_keys.json 解析失败。修复 9 个文件共 17 处。

Closes #32

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-20 14:32:37 +08:00
joshua-deng 67244597f2
Merge pull request #28 from dsjzazs/feat/auto-install-deps
fix: 改为通过 requirements 安装依赖
2026-03-14 22:22:54 +08:00
joshua-deng 3e79c8e093
Merge pull request #30 from dsjzazs/main
MCP增强消息查询,支持时间范围和分页
2026-03-14 17:38:37 +08:00
dsjzazs 7c42ff5d38 Investigate get_chat_history limit 2026-03-14 16:59:17 +08:00
dsjzazs 2cd180c63a
Merge pull request #2 from dsjzazs/codex/searchmessages
Add unit tests for MCP search and fix pagination
2026-03-14 16:39:12 +08:00
dsjzazs 9ae558a31e Fix global search pagination 2026-03-14 16:36:55 +08:00
dsjzazs 2e03247fb9
Add MCP dependency and pin versions (#1) 2026-03-14 15:13:28 +08:00
dsjzazs b623711410 Add MCP search unit tests 2026-03-14 14:07:51 +08:00
dsjzazs 4bda20f7aa feat: 更新 README 2026-03-14 10:24:23 +08:00
dsjzazs 7e7f7a2516 feat: 增强消息查询功能,支持时间范围和分页 2026-03-14 10:21:21 +08:00
dsjzazs 8e8edc649c fix: 改为通过 requirements 安装依赖
README 改为统一使用 requirements.txt 安装依赖,并补充 zstandard 依赖,避免手动漏装。

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-13 16:27:09 +08:00
ylytdeng 7020409543 fix: full_decrypt 写入前自动创建输出目录
full_decrypt 打开 out_path 写入时未创建父目录,
首次运行 monitor_web 且 decrypted/ 不存在时会报
FileNotFoundError。

Fixes #22

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 17:21:11 +08:00
ylytdeng 030680eb85 fix: 修复短时间大量消息丢失问题
旧逻辑用 `if ts == prev_ts: continue` 粗暴跳过上轮时间戳的所有消息,
但同一秒内可能有多条不同消息(如连续转发公众号文章),导致只显示
最后一条,其余丢失。

改为用 (username, timestamp, msg_type) 精确去重:
- 主消息和 hidden 消息显示后都记录到 _shown_keys
- 过滤时精确匹配已显示的消息,不再按时间戳整体跳过
- _shown_keys 每轮清理过期条目(保留 5 分钟),防止内存泄漏

Fixes #20

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 19:52:46 +08:00
joshua-deng 64b2c9fdef
Merge pull request #19 from BiboyQG/feat/chat-history-formatting
功能改进实用,问题不阻塞合并。
2026-03-09 19:48:06 +08:00
Banghao Chi fd67536ef7 Refine chat history message parsing 2026-03-08 20:52:33 -05:00
Banghao Chi fa273b810d Improve chat history formatting 2026-03-08 15:30:10 -05:00
ylytdeng a5a347f69e Merge PR #18: feat: Linux 数据库解密支持
- 新增 find_all_keys_linux.py (通过 /proc/pid/mem 扫描密钥)
- 新增 key_utils.py (跨平台路径兼容)
- 新增 key_scan_common.py (公共扫描逻辑)
- 拆分 find_all_keys.py 为平台分发入口
- 所有下游模块统一使用 get_key_info() 查找密钥

Fixes #12 (部分: Linux 支持)
Co-authored-by: PeanutSplash <b1300658700@outlook.com>
2026-03-07 21:35:37 +08:00
PeanutSplash 30112b9a10 fix(linux): address code review feedback
- SUDO_USER: skip fallback entirely when user is invalid (KeyError)
- load_config: move default merge after db_dir check to avoid dead code
- _is_wechat_process: prefer exact comm match, use exe substring as fallback
2026-03-07 21:35:24 +08:00
PeanutSplash 3d58b6508c fix(linux): validate SUDO_USER and use prefix matching for interpreters
- Validate SUDO_USER via pwd.getpwnam() to prevent path injection
- Use prefix matching for interpreter detection to cover python3.10+ etc.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 21:35:24 +08:00
PeanutSplash bf77cc97d8 refactor(linux): improve wechat detection and sudo db path fallback 2026-03-07 21:35:24 +08:00
PeanutSplash bc80a1578d refactor(find_all_keys_windows): drop unused constants imports 2026-03-07 21:35:24 +08:00
PeanutSplash 6d9b2c0fe4 refactor(find_all_keys): extract shared key scan logic 2026-03-07 21:35:24 +08:00
PeanutSplash 872e3f58dc fix: handle exited PIDs and narrow message DB keys 2026-03-07 21:35:24 +08:00
PeanutSplash f9c338b48d feat: add Linux support with cross-platform memory scanning
- Add Linux memory scanner (`find_all_keys_linux.py`) using `/proc/<pid>/mem`,
  same approach as Windows/macOS — no GDB, no function offsets, no restart needed
- Extract Windows-specific code to `find_all_keys_windows.py`
- Make `find_all_keys.py` a platform dispatcher (Windows / Linux)
- Add `key_utils.py` for cross-platform path matching (`/` vs `\` in all_keys.json)
- Update `config.py` with Linux auto-detection of db_storage paths
- Update all consumers (decrypt_db, monitor, monitor_web, mcp_server) to use
  `get_key_info()` for platform-agnostic key lookup

Tested on remote Linux container: 15/15 DBs scanned, decrypted, and verified.
2026-03-07 21:35:24 +08:00
ylytdeng 5879b58239 Merge PR #15: feat: macOS 图片密钥扫描器 + 批量解密器 (C)
新增 find_image_key.c 和 decrypt_images.c,
通过 Mach VM API + CommonCrypto 实现 macOS 图片解密。

Co-authored-by: bbingz
2026-03-07 21:35:08 +08:00
bbingz e84f1d5130 fix: fallback key in multi-key mode + bound printf context
- decrypt_images.c: try image_keys.json lookup first, fall back to
  config.json single key when CT pattern not mapped (previously returned
  -5 immediately in multi-key mode)
- find_image_key.c: cap ASCII context printf to remaining buffer length,
  preventing out-of-bounds read near region end
2026-03-07 21:35:00 +08:00
bbingz 96c1a5ac2e fix: add file size validation and clarify Method 2 intent
- decrypt_images.c: validate aes_ct_size + xor_size fits within file
  before reading, preventing out-of-bounds reads on corrupt files
- decrypt_images.c: remove unused bytes2hex function
- find_image_key.c: add comment explaining Method 2 design intent —
  hex ASCII bytes used directly as AES key (not hex-decoded)
2026-03-07 21:35:00 +08:00
bbingz 03582dd82c fix: narrow Method 2 scan to hex charset [0-9a-f]
Previous range [a-z0-9] was too broad, matching non-hex characters
g-z which wastes CPU on false candidates. WeChat image keys are
lowercase hex strings.
2026-03-07 21:35:00 +08:00
bbingz 0576151b67 feat: add macOS image key scanner and batch decryptor (C)
- find_image_key.c: scans WeChat process memory for V2 image AES keys
  using Mach VM API + CommonCrypto batch decryption
- decrypt_images.c: batch decrypts V2 .dat image files using keys
  from image_keys.json, handles AES-ECB + XOR + raw_data segments

Build: cc -O3 -o find_image_key find_image_key.c -framework Security
       cc -O3 -o decrypt_images decrypt_images.c -framework Security
2026-03-07 21:35:00 +08:00