Files
zhiwei b7993a54d5 cleanup: archive unused scripts, finalize docs
- Moved old GDB hook and memory monitor scripts to archive/
- Updated README with final Docker solution
- Updated .env.example, .gitignore
- Added final-note.md documenting deployment decision
- All research scripts preserved in archive/ for reference
2026-06-24 02:03:24 +08:00

72 lines
2.1 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# MoWeChat — 莫荷微信 Bot
Linux 版微信 Bot,将莫荷的微信消息桥接到 Hermes Gateway。
## 技术方案
```
手机微信 → WeChat服务器 → Docker Bot → Webhook(:5804) → Hermes Gateway
手机微信 ← WeChat服务器 ← Docker Bot ← Webhook(:5804) ← Hermes 回复
```
基于 [`docker-wechatbot-webhook`](https://github.com/danni-cool/wechatbot-webhook) (2174 star),走 Web 微信协议。
## 快速开始
### 启动容器
```bash
docker run -d --name wxBotWebhook --restart unless-stopped \
-p 3001:3001 \
-v ~/wxBot_logs:/app/log \
-e RECVD_MSG_API="http://172.17.0.1:5804/" \
-e ACCEPT_RECVD_MSG_MYSELF=false \
-e LOCAL_LOGIN_API_TOKEN="your_fixed_token" \
dannicool/docker-wechatbot-webhook
```
### 扫码登录
访问 http://192.168.1.246:3001/login?token=your_fixed_token
### Webhook 接收器(systemd
```bash
sudo systemctl start wechat-webhook
sudo systemctl enable wechat-webhook
```
### 发送消息
```bash
curl -X POST "http://localhost:3001/webhook/msg/v2?token=your_fixed_token" \
-H "Content-Type: application/json" \
-d '{"to": "联系人名称", "data": {"content": "消息内容"}}'
```
## 组件
| 组件 | 位置 | 说明 |
|------|------|------|
| Docker 容器 | `wxBotWebhook` | 微信 Bot 核心,收发消息 |
| Webhook 接收 | `wechat_webhook.py` | 收到消息→转发 Hermes→回复 |
| systemd 服务 | `wechat-webhook.service` | Webhook 开机自启 |
| 日志 | `~/wxBot_logs/` + `logs/webhook_service.log` | |
## 研究历程
见 [`docs/architecture.md`](docs/architecture.md)(方案论证)和 [`archive/`](archive/)(废弃脚本)。
曾尝试过的方案:
- GDB Hook(微信 4.1.7 crashpad 检测 ptrace,崩溃)
- /proc/PID/mem 内存扫描(可行但噪声大,需精调)
- LD_PRELOAD(需逆向工程)
- **最终:docker-wechatbot-webhook ✅ 最稳定**
## 维护
- Web 协议约 2 天掉线一次,需重新扫码
- 容器自动重启(`--restart unless-stopped`
- 登录 URL 不变(固定 token