WeChatFerry/README.MD

309 lines
8.2 KiB
Plaintext
Raw Permalink Normal View History

2021-02-12 23:21:57 +08:00
# WeChatFerry
2024-04-19 19:06:30 +08:00
2023-03-01 20:13:18 +08:00
一个玩微信的工具。更多介绍见:[WeChatFerry: 一个玩微信的工具](https://mp.weixin.qq.com/s/CGLfSaNDy8MyuyPWGjGJ7w)。
2025-01-26 15:53:13 +08:00
<details>
<summary><b>⚠️ 免责声明【必读】⚠️</b></summary>
2023-07-17 00:30:14 +08:00
2025-02-07 07:40:46 +08:00
请阅读完整的免责声明:[点击查看](WeChatFerry/DISCLAIMER.md)
2023-07-17 00:30:14 +08:00
</details>
2025-04-30 00:23:49 +08:00
|[📖 Python 文档](https://wechatferry.readthedocs.io/)|[📺 Python 视频教程](https://mp.weixin.qq.com/s/APdjGyZ2hllXxyG_sNCfXQ)|[🙋 FAQ](https://mp.weixin.qq.com/s/c2JggTBlOP8fP9j-MlMAvg)|
2024-06-10 16:20:28 +08:00
|:-:|:-:|:-:|
2025-01-26 15:53:13 +08:00
👉 [WeChatRobot🤖](https://github.com/lich0821/WeChatRobot),一个基于 WeChatFerry 的 Python 机器人示例。
2024-06-10 16:20:28 +08:00
2024-07-04 19:09:47 +08:00
|![碲矿](assets/TEQuant.jpg)|![赞赏](assets/QR.jpeg)|
|:-:|:-:|
|后台回复 `WCF` 加群交流|如果你觉得有用|
2024-06-10 16:20:28 +08:00
<details><summary>点击查看功能清单</summary>
2024-11-21 13:03:22 +08:00
* 获取登录二维码
2024-07-02 22:42:10 +08:00
* 查询登录状态
* 获取登录账号信息
2024-06-10 16:20:28 +08:00
* 获取消息类型
2024-07-02 22:42:10 +08:00
* 获取联系人
* 获取可查询数据库
* 获取数据库所有表
* 获取语音消息
2024-06-10 16:20:28 +08:00
* 发送文本消息(可 @
2024-07-02 22:42:10 +08:00
* 发送图片消息
* 发送文件消息
* 发送卡片消息
2025-04-18 00:43:05 +08:00
* 发送 XML 消息
2024-07-04 19:09:47 +08:00
* 发送 GIF 消息
2024-07-02 22:42:10 +08:00
* 拍一拍群友
* 转发消息
* 开启接收消息
* 关闭接收消息
* 查询数据库
* 获取朋友圈消息
* 下载图片、视频、文件
* 解密图片
2025-03-15 10:39:50 +08:00
* 通过好友申请
2024-07-02 22:42:10 +08:00
* 添加群成员
* 删除群成员
* 邀请群成员
2024-06-10 16:20:28 +08:00
</details>
<details><summary>点击查看支持的客户端</summary>
* Python
2024-07-04 19:09:47 +08:00
* HTTP
* NodeJS
2024-06-10 16:20:28 +08:00
</details>
2024-10-14 18:55:55 +08:00
## 感谢大佬们贡献代码
2025-04-24 22:59:03 +08:00
<a href="https://github.com/lich0821/WeChatFerry/graphs/contributors">![](https://contrib.rocks/image?repo=lich0821/WeChatFerry&columns=8&anon=1)</a>
2024-10-14 18:55:55 +08:00
2024-07-04 19:09:47 +08:00
## 快速开始
### Python
[![PyPi](https://img.shields.io/pypi/v/wcferry.svg)](https://pypi.python.org/pypi/wcferry) [![Downloads](https://static.pepy.tech/badge/wcferry)](https://pypi.python.org/pypi/wcferry) [![Documentation Status](https://readthedocs.org/projects/wechatferry/badge/?version=latest)](https://wechatferry.readthedocs.io/zh/latest/?badge=latest)
* 安装
```sh
pip install --upgrade wcferry
```
2025-01-26 15:53:13 +08:00
* 参考示例:[🤖WeChatRobot](https://github.com/lich0821/WeChatRobot)
2024-07-04 19:09:47 +08:00
### HTTP
2024-09-01 13:25:15 +08:00
* [wcfrust](https://github.com/lich0821/wcf-client-rust)(基于 Rust
* [go_wcf_http](clients/go_wcf_http/README.MD)(基于 Go
2025-01-26 16:01:13 +08:00
* [wrest-chat](https://github.com/opentdp/wrest-chat)(基于 Go
2024-11-19 08:32:57 +08:00
* [wcf-http](https://github.com/yuxiaoli/wcf-http)(基于 Python
2024-07-04 19:09:47 +08:00
2024-09-01 13:25:15 +08:00
### Java
* [java](clients/java/wcferry/README.MD)
2024-09-01 13:25:15 +08:00
### NodeJS
* [wcferry-node](https://github.com/dr-forget/wcferry-node)
* [node-wcferry](https://github.com/stkevintan/node-wcferry)
2024-09-04 20:22:33 +08:00
* [wechatferry](https://github.com/wechatferry/wechatferry)
2024-09-01 13:25:15 +08:00
### C#
2025-03-13 21:47:07 +08:00
* [WeChatFerry.Net](https://github.com/SilkageNet/WeChatFerry.Net) Install using Nuget
2024-09-01 13:25:15 +08:00
* [WeChatFerry-CSharp](https://github.com/send010/WeChatFerry-CSharp)
### Rust
* [wechat-bot](https://github.com/CliffHan/wechat-bot)
### Docker
* [docker_wechat](https://github.com/Saroth/docker_wechat)
* [wechatbot-provider-windows](https://github.com/danni-cool/wechatbot-provider-windows)
2021-02-12 23:21:57 +08:00
2022-10-18 19:19:10 +08:00
## 一起开发
2024-04-19 19:06:30 +08:00
2024-03-03 00:25:41 +08:00
> 🚫 非开发用户不需要往下看。
2024-10-31 23:07:22 +08:00
>
2024-07-02 22:42:10 +08:00
> **开发用户**:可以根据文档和错误提示,自行解决编译错误的人员。
2023-12-05 23:53:12 +08:00
2022-10-15 21:15:33 +08:00
### 安装开发环境
2024-04-19 19:06:30 +08:00
2023-05-12 11:54:47 +08:00
<details><summary>点击查看</summary>
2022-10-15 21:15:33 +08:00
#### 安装 vcpkg
2024-04-19 19:06:30 +08:00
2022-10-15 21:15:33 +08:00
* 安装,参考[Vcpkg: 总览](https://github.com/microsoft/vcpkg/blob/master/README_zh_CN.md)。
2024-04-19 19:06:30 +08:00
2022-10-15 21:15:33 +08:00
```sh
cd C:\Tools
git clone https://github.com/microsoft/vcpkg
.\vcpkg\bootstrap-vcpkg.bat
```
* 添加全局配置:
2024-11-03 11:40:40 +08:00
环境变量增加 `vcpkg` 所在路径(本文为:`C:\Tools\vcpkg`
```sh
setx VCPKG_ROOT "C:/Tools/vcpkg" /M
```
2022-10-15 21:15:33 +08:00
2024-11-17 15:01:29 +08:00
* 与 Visual Studio 集成
```sh
vcpkg integrate install # 失败则说明未正确安装或者未正确配置环境变量
```
2023-03-07 19:52:38 +08:00
#### 安装相关组件
2024-04-19 19:06:30 +08:00
2024-11-03 11:40:40 +08:00
编译时会自动安装。但如果需要使用 `protoc.exe`,则需要配置一下 `protoc.exe` 环境变量:`<vcpkg_package_installed_path>\x64-windows-static\x64-windows-static\tools\protobuf`。
2022-10-15 21:15:33 +08:00
2024-11-03 11:40:40 +08:00
(本文为:`C:\Projs\WeChatFerry\WeChatFerry\vcpkg_installed\x64-windows-static\x64-windows-static\tools\protobuf`
2022-10-15 21:15:33 +08:00
#### 安装 VS2019
2023-09-01 08:37:06 +08:00
#### 安装 Python3
2024-10-17 15:54:38 +08:00
通过微软商店或者 python.org 自行下载均可(注意 `python` 版本不能太高,否则需要自行编译依赖,建议使用 python 3.10),然后配置好环境变量,确保 `python` 在命令行下可用。
2024-05-02 16:01:13 +08:00
安装依赖:
```sh
pip install grpcio-tools==1.48.2
```
2023-05-12 11:54:47 +08:00
</details>
2022-10-15 21:15:33 +08:00
### 编译
2024-04-19 19:06:30 +08:00
使用 VS2019 打开工程,编译即可。编译成功后,在 `WeChatFerry\WeChatFerry\Out` 目录中会看到相应的 DLL 文件。
2022-10-15 21:15:33 +08:00
2023-11-21 21:20:18 +08:00
**注**:如果遇到执行 `protoc` 时的 9009 错误,检查是否是 python3 环境有问题,或者 protoc 命令的环境变量配置不正确。
2022-10-15 21:15:33 +08:00
### 运行
2024-04-19 19:06:30 +08:00
```py
import ctypes
# 加载 sdk.dll (需要绝对路径)
sdk = ctypes.cdll.LoadLibrary("C:/Projs/WeChatFerry/WeChatFerry/Out/sdk.dll")
# 初始化
sdk.WxInitSDK(False, 10086)
# 退出 SDK
sdk.WxDestroySDK()
# 注意关闭 Python 进程
2023-11-21 21:20:18 +08:00
```
2024-05-31 21:03:58 +08:00
### 调试日志
```c
2025-02-04 13:29:02 +08:00
util::dbg_msg("ListenMessage"); // 封装的 OutputDebugString
2024-05-31 21:03:58 +08:00
OutputDebugString(L"ListenMessage\n");
MessageBox(NULL, L"ListenMessage", L"ListenMessage", 0);
```
2021-02-12 23:21:57 +08:00
## 项目结构
2024-04-19 19:06:30 +08:00
2023-03-01 20:13:18 +08:00
```sh
WeChatFerry
2023-07-15 10:18:04 +08:00
├── LICENSE # LICENSE
├── README.MD # 说明
├── WeChatFerry
│   ├── WeChatFerry.sln # VS2019 工程文件
2024-04-19 19:06:30 +08:00
│   ├── com # 公共模块
2023-07-15 10:18:04 +08:00
│   ├── rpc # RPC 模块
│   ├── sdk # 注入及启动模块
2024-04-19 19:06:30 +08:00
│   ├── smc # Silk-Mp3 转换模块
│   └── spy # 核心功能实现模块
2023-07-15 10:18:04 +08:00
├── assets
│   ├── QR.jpeg # 二维码,测试用图
│   ├── TEQuant.jpg # 二维码,测试用图
│   └── demo.gif # 示例动图
├── clients
│   ├── go # Go 客户端
2023-12-29 21:28:18 +08:00
│   ├── gohttp # HTTP 客户端
2023-07-15 10:18:04 +08:00
│   ├── http # HTTP 客户端
│   ├── java # Java 客户端
2024-04-19 19:06:30 +08:00
│   ├── node # Node.js 客户端
2023-12-05 23:53:12 +08:00
│   ├── pyauto # 群友封装的客户端
2023-07-15 10:18:04 +08:00
│   ├── python # Python 客户端
│   └── rust # Rust 客户端
└── docs # 文档
2023-03-01 20:13:18 +08:00
```
2022-10-18 19:18:26 +08:00
2021-08-22 22:05:25 +08:00
## 版本更新
2023-07-16 19:30:32 +08:00
2025-04-30 00:23:49 +08:00
### v39.5.2
* 没有新功能
2023-07-16 19:30:32 +08:00
<details><summary>点击查看更多</summary>
2023-05-08 13:10:06 +08:00
客户端越来越多了,版本号开始混乱,所以重新定义了版本号:`w.x.y.z`。
其中:
* `w` 是微信的大版本号,如 `37` (3.7.a.a), `38` (3.8.a.a), `39` (3.9.a.a)
* `x` 是适配的微信的小版本号,从 0 开始
* `y` 是 `WeChatFerry` 的版本,从 0 开始
* `z` 是各客户端的版本,从 0 开始
2025-04-30 00:23:49 +08:00
### v39.5.1
* 修复邀请进群偶发失败
* 修复获取 wxid 失败
2025-04-20 07:31:25 +08:00
### v39.5.0
* 适配 `3.9.12.51`。
2025-04-18 00:43:05 +08:00
### v39.4.5
* 修复发送 XML 功能。
2025-04-10 00:44:49 +08:00
### v39.4.4
* 实现发送 XML 功能。
2025-03-24 22:48:38 +08:00
### v39.4.3
* 实现通过好友申请功能。
2025-03-15 10:39:50 +08:00
### v39.4.2
* 修复附件下载类型错误。
### v39.4.1
* 修复乱码问题。
2025-03-08 11:50:33 +08:00
### v39.4.0
* 重构代码,适配 `3.9.12.17`。
2025-03-07 17:37:49 +08:00
### v39.3.5
* 代码优化
2025-01-26 15:53:13 +08:00
### v39.3.4
* 实现获取登录二维码
2024-11-21 13:03:22 +08:00
### v39.3.3
* 修复发送文件 / 图片中文路径问题
2024-11-03 18:41:44 +08:00
### v39.3.2
* 修复接收消息问题
2024-11-03 13:56:42 +08:00
### v39.3.0
* 适配 `3.9.11.25`
2024-10-31 23:07:22 +08:00
### v39.2.4
* 修复 wxid 问题
2024-07-08 21:26:50 +08:00
### v39.2.3
* 实现发送 GIF
2024-07-04 19:09:47 +08:00
### v39.2.2
* 修复开启、停止接收消息失败问题
2024-07-03 18:37:08 +08:00
### v39.2.1
* 实现了好多功能(见功能清单)
2024-07-02 22:42:10 +08:00
### v39.2.0
* 开始适配 `3.9.10.27`
* 实现检查登录状态
* 实现获取登录账号信息wxid、昵称、手机号、数据目录
* 实现获取消息类型
* 实现开启接收消息
* 实现停止接收消息
* 实现发送文本消息(可 @
* 实现发送图片消息
2024-06-10 16:20:28 +08:00
### v39.1.0 (2024.04.19)
2024-04-19 19:06:30 +08:00
2024-06-10 16:20:28 +08:00
* 适配 x64 环境
* 重构项目
* 开始适配 `3.9.10.19`
2023-04-28 23:18:21 +08:00
</details>