{"id":13632273,"url":"https://github.com/0xlane/wechat-dump-rs","last_synced_at":"2025-05-14T19:02:38.129Z","repository":{"id":195748817,"uuid":"693586400","full_name":"0xlane/wechat-dump-rs","owner":"0xlane","description":"该工具用于导出正在运行中的微信进程的 key 并自动解密所有微信数据库文件以及导出 key 后数据库文件离线解密。","archived":false,"fork":false,"pushed_at":"2025-04-04T14:16:16.000Z","size":4048,"stargazers_count":1162,"open_issues_count":6,"forks_count":194,"subscribers_count":14,"default_branch":"v4","last_synced_at":"2025-04-06T22:01:34.057Z","etag":null,"topics":["pentesting","pentesting-tools","red-team-tools","redteam","rust","wechat","windows"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/0xlane.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-09-19T10:15:57.000Z","updated_at":"2025-04-06T07:35:16.000Z","dependencies_parsed_at":"2023-10-23T12:32:35.288Z","dependency_job_id":"749ef38d-8848-4206-bcd4-333fb13564cf","html_url":"https://github.com/0xlane/wechat-dump-rs","commit_stats":null,"previous_names":["0xlane/wechat-dump-rs"],"tags_count":35,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0xlane%2Fwechat-dump-rs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0xlane%2Fwechat-dump-rs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0xlane%2Fwechat-dump-rs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0xlane%2Fwechat-dump-rs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/0xlane","download_url":"https://codeload.github.com/0xlane/wechat-dump-rs/tar.gz/refs/heads/v4","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248804781,"owners_count":21164131,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["pentesting","pentesting-tools","red-team-tools","redteam","rust","wechat","windows"],"created_at":"2024-08-01T22:02:58.457Z","updated_at":"2025-04-14T00:52:17.708Z","avatar_url":"https://github.com/0xlane.png","language":"Rust","funding_links":[],"categories":["Rust"],"sub_categories":[],"readme":"# wechat-dump-rs （支持微信4.0版本）\n\n该工具用于导出正在运行中的微信进程的 key 并自动解密所有微信数据库文件以及导出 key 后数据库文件离线解密。\n\n![demo](images/demo.gif)\n\n\u003e **可能存在封号风险，后果自负！！！**\n\u003e\n\u003e **使用需知**：\n\u003e 微信4.0 重构后改用 HMAC_SHA512 算法，寻找 key 的方式和 v3 不同，工具内仍然采用内存暴力搜索的方式，对于 v4 解密时将使用多线程加速，可能会导致 cpu 飙到 100%，取决于 key 离起始查找点的距离。\n\n## 工具用法\n\n```bash\nwechat-dump-rs (1.0.13) - REinject\nA wechat db dump tool\nOptions:\n  -p, --pid \u003cPID\u003e        pid of wechat\n  -k, --key \u003cKEY\u003e        key for offline decryption of db file\n  -f, --file \u003cPATH\u003e      special a db file path\n  -d, --data-dir \u003cPATH\u003e  special wechat data dir path (pid is required)\n  -o, --output \u003cPATH\u003e    decrypted database output path\n  -a, --all              dump key and decrypt db files\n      --vv \u003cVERSION\u003e     wechat db file version [default: 4] [possible values: 3, 4]\n  -r, --rawkey           convert db key to sqlcipher raw key (file is required)\n  -h, --help             Print help\n```\n\n如果不带任何参数，程序只输出所有微信进程的 key、微信号、手机号、数据目录、版本等信息：\n\n```bash\n=======================================\nProcessId: 4276\nWechatVersion: 4.0.0.26\nAccountName: xxxxxx\nNickName: xxxxxx\nPhone: 15111611111\nDataDir: C:\\Users\\xxx\\Documents\\xwechat_files\\wxid_xxxx_xxa\\\nkey: f11fd83bxxxxxx4f3f4x4ddxxxxxe417696b4axx19e09489ad48c\n=======================================\n```\n\n使用参数 `-a` 可以直接导出所有数据库文件。\n\n### 使用 sqlcipher browser 浏览数据库\n\n工具自动解密后的文件可能存在畸形问题，可以直接使用 [DB Browser for SQLCipher](https://sqlitebrowser.org/) 浏览原始数据库文件。\n\n打开 sqlcipher 数据库时，选择 “原始密钥”，微信 V3 选择 自定义（页大小4096/KDF迭代64000/HMAC算法SHA1/KDF算法SHA1），V4 选择 sqlcipher4 默认，每个数据库文件对应的原始密钥都是不一样的，获取方式如下：\n\n微信 V3 数据库文件 rawkey：\n\n```bash\nwechat-dump-rs.exe -k xxxxxxxxxxxxxxxxx -f c:\\users\\xxxx\\xxxx\\contact.db -r --vv 3\n```\n\n微信 V4 数据库文件 rawkey：\n\n```bash\nwechat-dump-rs.exe -k xxxxxxxxxxxxxxxxx -f c:\\users\\xxxx\\xxxx\\contact.db -r --vv 4\n```\n\n## 原理\n\n一般情况下，key 要在运行的微信进程内存中拿到，内存偏移在每个版本都不一样，大部分工具是对每个版本维护一套偏移，但是当出现新版本的时候都要重新找偏移，方法见后面有简单记录。\n\n其实，除了这个方法外，还有一个更通用的方法就是内存暴力搜索找到能用于解密的密钥位置，当然如果对进程全部内存扫一遍肯定不行，所以项目里用下面这种方式缩小密钥内存范围加快扫描速度：\n\n1. ~~微信登录设备类型基本只有 iphone、android，在内存中先搜到设备类型所在内存，key 就在它的前面，向前搜就行~~\n2. ~~key 的内存地址和登录设备类型据我观察是 16 字节对齐的，所以每次向前 16 字节~~\n\n\u003e **微信 4.0 的 key 借助了用户绑定的国内手机号定位，未绑定手机号的参考 [#41](https://github.com/0xlane/wechat-dump-rs/issues/41)，绑定国外手机号的参考 [#29](https://github.com/0xlane/wechat-dump-rs/issues/29)。**\n\n还有其它一些小细节，直接看一下代码吧。\n\n## 已测试版本列表\n\n其它未测试版本不代表不能用，这个列表只是我本地有过的环境。\n\n- 3.9.6.33\n- 3.9.7.25\n- 3.9.7.29\n- 3.9.8.9\n- 3.9.8.15\n- 3.9.10.19\n- 3.9.11.25\n- 3.9.12.15\n- 3.9.12.17\n- 4.0.0.26\n- 4.0.0.32\n- 4.0.0.34\n- 4.0.0.35\n- 4.0.1.11\n- 4.0.1.13\n- 4.0.1.17\n- 4.0.1.21\n- 4.0.2.17\n- 4.0.3.22\n\n## 库表结构\n\n- [4.0.0.26](docs/wechat_4_0_0_26_table_struct.md)\n\n\u003e 4.0 聊天记录内容解析参考示例 [导出聊天记录到TXT](./sample_scripts/导出聊天记录到TXT/)。\n\n## 微信分析记录\n\n- [微信3.9手动寻找偏移](docs/wechat_3_9_analysis.md)\n- [微信4.0寻找key过程](docs/wechat_4_0_analysis.md)\n\n## Star History\n\n[![Star History Chart](https://api.star-history.com/svg?repos=0xlane/wechat-dump-rs\u0026type=Date)](https://star-history.com/#0xlane/wechat-dump-rs\u0026Date)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F0xlane%2Fwechat-dump-rs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F0xlane%2Fwechat-dump-rs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F0xlane%2Fwechat-dump-rs/lists"}