mirror of
https://github.com/a244573118/WeChatIntercept.git
synced 2026-07-02 02:40:37 +08:00
Compare commits
14 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| a39fbc91b5 | |||
| 034b3be345 | |||
| f7dd841b3e | |||
| 21a57d49ec | |||
| 5a6c282537 | |||
| bebe756f1d | |||
| 608934165d | |||
| e1047bcc8b | |||
| f540f16a6b | |||
| 0c45306f68 | |||
| a39740f7b0 | |||
| fe2bc78e6c | |||
| 2efbfda678 | |||
| 7ff43db2c9 |
@@ -1,133 +1,136 @@
|
||||
# WeChatIntercept
|
||||
|
||||
macOS 微信防撤回工具。
|
||||
|
||||
## 最新版本
|
||||
|
||||
**支持微信 4.1.9 ~ 4.1.10**,适配微信全新 C++ 架构,通过 DYLD 运行时注入实现防撤回。
|
||||
|
||||
### 功能
|
||||
|
||||
- 对方撤回的消息保留可见
|
||||
- 自己撤回正常工作
|
||||
- 撤回时弹出 macOS 系统通知(显示谁撤回了消息)
|
||||
- 通知开关可随时切换
|
||||
|
||||
### 原理
|
||||
|
||||
通过注入运行时 hook 动态库(`WeChatAntiRevoke.dylib`),拦截微信内部的 `isRevokeMessage()` 函数:
|
||||
|
||||
- 对方撤回 → 返回 false(消息保留)+ 弹出通知
|
||||
- 自己撤回 → 返回 true(正常处理)
|
||||
|
||||
通过读取当前登录用户 ID(完整字符串匹配),精确区分自己与对方。
|
||||
|
||||
### 适用范围
|
||||
|
||||
- macOS 微信 4.1.9、4.1.10
|
||||
- Apple Silicon(arm64)及 Intel(x86_64)
|
||||
- macOS Sequoia / Sonoma / Ventura 等(自动处理 provenance 限制)
|
||||
|
||||
### 使用
|
||||
|
||||
```bash
|
||||
chmod +x patch.sh # 添加可执行权限
|
||||
./patch.sh # 安装防撤回
|
||||
./patch.sh openNotify # 开启撤回通知
|
||||
./patch.sh closeNotify # 关闭撤回通知
|
||||
./patch.sh --uninstall # 卸载
|
||||
./patch.sh --help # 帮助
|
||||
```
|
||||
|
||||
首次运行可能需要约 30 秒(自动解除系统文件保护并重签名)。
|
||||
|
||||
### 配置
|
||||
|
||||
配置文件路径:`~/.config/antirevoke/config`
|
||||
|
||||
```ini
|
||||
notify=1 # 1=开启撤回通知, 0=关闭
|
||||
```
|
||||
|
||||
安装时默认开启通知,也可通过命令随时切换:
|
||||
|
||||
```bash
|
||||
./patch.sh openNotify # 等同于设置 notify=1
|
||||
./patch.sh closeNotify # 等同于设置 notify=0
|
||||
```
|
||||
|
||||
修改后立即生效,无需重启微信。
|
||||
|
||||
### 依赖
|
||||
|
||||
macOS 系统自带工具,无需额外安装:
|
||||
- clang(Xcode Command Line Tools)
|
||||
- python3
|
||||
- codesign
|
||||
- tar
|
||||
|
||||
如未安装 Xcode Command Line Tools,运行:`xcode-select --install`
|
||||
|
||||
### 调试
|
||||
|
||||
```bash
|
||||
./patch.sh --debug # 调试模式(不安装 hook,仅签名允许 lldb attach)
|
||||
cat /tmp/antirevoke_debug.log # 查看运行时日志
|
||||
```
|
||||
|
||||
### 已知限制
|
||||
|
||||
- **聊天框内无撤回提示**:由于微信 4.x 的架构限制(C++ 实现 + 符号 strip + 数据库加密),无法在聊天界面内插入系统消息。替代方案为 macOS 系统通知。
|
||||
|
||||
- **为什么不能像旧版那样在聊天框内显示提示?**
|
||||
|
||||
旧版微信 macOS(3.x)使用 Objective-C,可通过 Method Swizzling 调用内部消息插入 API。4.x 版本核心逻辑全部迁移到 C++(仅剩 65 个 ObjC 类,90MB+ 代码段,符号已 strip),撤回处理通过虚函数 + 加密数据库 + 协程调度完成,无法稳定地从外部构造调用链插入消息。
|
||||
|
||||
### 技术文档
|
||||
|
||||
详细的逆向分析过程和适配指南见 [`doc/reverse-engineering-guide.md`](doc/reverse-engineering-guide.md)。
|
||||
macOS 微信防撤回工具,支持微信 4.1.x 系列,欢迎共建和 star。
|
||||
|
||||
---
|
||||
|
||||
## 旧版本
|
||||
## 功能
|
||||
|
||||
支持微信 3.7.0 及更早版本,基于 DYLD 注入 + Method Swizzling,支持撤回提示和自定义前缀。
|
||||
| 功能 | 说明 |
|
||||
| -------- | ------------------------------------------------------------------------ |
|
||||
| 防撤回 | 对方撤回的消息保留可见,自己撤回正常工作 |
|
||||
| 撤回通知 | 弹出 macOS 系统通知,显示谁撤回了什么内容 |
|
||||
| 消息原文 | 通知中展示被撤回的原始消息(消息内容文本 / [图片] / [视频] / [文件] 等) |
|
||||
| 自动适配 | 内置特征码搜索,微信小版本更新后无需手动操作 |
|
||||
|
||||
### 功能
|
||||
通知效果:
|
||||
|
||||
1. 防撤回(支持聊天框内拦截提示)
|
||||
2. 免认证登录
|
||||
3. 拦截提示语自定义前缀
|
||||
- `拦截到「张三」撤回了一条消息:你好`
|
||||
- `拦截到「张三」撤回了一条消息:[图片]`
|
||||
- 拿不到原文时降级:`拦截到「张三」撤回了一条消息`
|
||||
|
||||
---
|
||||
|
||||
## 快速开始
|
||||
|
||||
```bash
|
||||
# 1. 安装防撤回(必须)
|
||||
chmod +x patch.sh
|
||||
./patch.sh
|
||||
|
||||
# 2. 安装消息监听(可选,撤回通知带原文)
|
||||
./patch.sh --monitor-install
|
||||
```
|
||||
|
||||
完成。微信会自动重启,之后对方撤回消息时你会收到系统通知。
|
||||
|
||||
---
|
||||
|
||||
## 命令一览
|
||||
|
||||
| 命令 | 作用 |
|
||||
| -------------------------------- | -------------------------------------- |
|
||||
| `./patch.sh` | 安装防撤回 |
|
||||
| `./patch.sh --monitor-install` | 安装消息监听(后台自动运行,开机自启) |
|
||||
| `./patch.sh --monitor-status` | 查看监听状态 |
|
||||
| `./patch.sh --monitor-uninstall` | 卸载消息监听 |
|
||||
| `./patch.sh --uninstall` | 卸载防撤回 |
|
||||
| `./patch.sh --help` | 查看帮助 |
|
||||
|
||||
---
|
||||
|
||||
## 适用范围
|
||||
|
||||
- macOS 微信 4.1.x(4.1.9 / 4.1.10 已验证)
|
||||
- Apple Silicon(arm64)+ Intel(x86_64)
|
||||
- macOS Sequoia / Sonoma / Ventura / Tahoe
|
||||
|
||||
---
|
||||
|
||||
## 依赖
|
||||
|
||||
macOS 系统自带,无需额外安装:
|
||||
|
||||
- clang / python3 / codesign / lldb(Xcode Command Line Tools)
|
||||
|
||||
如未安装:`xcode-select --install`
|
||||
|
||||
---
|
||||
|
||||
## 注意事项
|
||||
|
||||
1. **首次运行**约需 30 秒(解除系统文件保护 + 重签名)
|
||||
2. **通知权限**:需给「脚本编辑器」开启通知权限,否则看不到弹窗
|
||||
<img width="912" height="108" alt="image" src="https://github.com/user-attachments/assets/5865c263-7511-4b58-92a0-e69edba54f3d" />
|
||||
3. **微信动态更新**:微信存在动态更新机制,版本号不变,但方法地址会变,重新运行`./patch.sh`即可,脚本会自动寻址
|
||||
4. **消息原文覆盖率**:私聊 + 大部分群聊可正常获取;部分群聊因对象结构差异会降级为不带原文(后续优化)
|
||||
|
||||
---
|
||||
|
||||
## 排查
|
||||
|
||||
防撤回不生效时:
|
||||
|
||||
```bash
|
||||
cat /tmp/antirevoke_debug.log # 查看 hook 安装日志
|
||||
cat /tmp/wechat_monitor_daemon.log # 查看消息监听日志
|
||||
./patch.sh --monitor-status # 查看监听状态
|
||||
```
|
||||
|
||||
关键日志含义:
|
||||
|
||||
- `快速路径命中` / `特征码搜索找到` → hook 安装成功
|
||||
- `hook 安装失败` → 微信版本变化较大,需更新脚本
|
||||
|
||||
提交 issue 时请附带微信版本和日志文件。
|
||||
|
||||
---
|
||||
|
||||
## 卸载
|
||||
|
||||
```bash
|
||||
./patch.sh --monitor-uninstall # 卸载消息监听(如安装过)
|
||||
./patch.sh --uninstall # 卸载防撤回,恢复原始微信
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 调试(开发者)
|
||||
|
||||
```bash
|
||||
./patch.sh --debug # 仅签名允许 lldb attach,不装 hook
|
||||
./patch.sh --monitor # 前台运行消息监听(Ctrl+C 退出)
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 风险说明
|
||||
|
||||
1. 微信升级后补丁可能失效,脚本内置自动寻址尽力兼容,但无法应对函数实现的根本变化
|
||||
2. 仅承诺已验证版本(4.1.9 / 4.1.10),其他 build 号尽力支持
|
||||
3. 仅用于技术研究,请自行承担使用风险
|
||||
|
||||
---
|
||||
|
||||
## 旧版本(微信 3.7.0)
|
||||
|
||||
支持微信 3.7.0 及更早版本,基于 Method Swizzling,支持聊天框内撤回提示 + 自定义前缀。
|
||||
|
||||
<img width="301" alt="image" src="https://user-images.githubusercontent.com/18585610/159691061-3f24b69f-a494-4549-a530-7724b1b40060.png">
|
||||
|
||||
### 微信 v3.7.0 下载
|
||||
```bash
|
||||
# 安装:将 Install.sh 拖到终端执行
|
||||
# 卸载:将 Uninstall.sh 拖到终端执行
|
||||
```
|
||||
|
||||
[微信 v3.7.0 版本](https://dldir1.qq.com/weixin/mac/WeChatMac.dmg)
|
||||
|
||||
### 使用方法
|
||||
|
||||
- **安装**:cd 到 WeChatIntercept 文件夹,将 `Install.sh` 拖到终端,输入密码回车,重启微信。
|
||||
- **卸载**:将 `Uninstall.sh` 拖到终端回车。
|
||||
- **自定义前缀**:安装成功后重启微信,屏幕左上角微信菜单栏有个小助手菜单,修改后点击关闭即可。
|
||||
|
||||
### 常见问题
|
||||
|
||||
1. **无法打开 "insert_dylib",因为无法验证开发者**
|
||||
|
||||
在系统安全性与隐私处点击允许。
|
||||
|
||||
2. **截屏无法使用,已添加屏幕录制权限仍不行**
|
||||
|
||||
在系统安全性与隐私中删除微信,重新添加,重启微信即可。(感谢 [Kylelkh](https://github.com/Kylelkh))
|
||||
|
||||
3. **M1 芯片怎么使用**
|
||||
|
||||
安装 Rosetta,在微信属性中勾选"使用 Rosetta 打开"。(感谢 [Mercury2699](https://github.com/Mercury2699)、[bolosea](https://github.com/bolosea))
|
||||
|
||||
---
|
||||
|
||||
## 注意
|
||||
|
||||
- 微信更新后需重新运行 `./patch.sh`
|
||||
- 仅供学习研究用途
|
||||
[微信 v3.7.0 下载](https://dldir1.qq.com/weixin/mac/WeChatMac.dmg)
|
||||
|
||||
Reference in New Issue
Block a user