自从微信发布以来,微信机器人就没有停过,有利用模拟器多开安卓手机端然后利用群控管理的,有利用web端微信分析协议改的,在经历各种微信营销之后,已经被微信官方封禁的差不多了。
经过反复查找对比测试,最终我找到了github上一个微信机器人工具,利用的是PC端微信,原理类似于游戏外挂,而基于这个底层作者又开发了多个版本的工具,利用起来十分方便。
底层工具:WeChatFerry
微信机器人:WeChatRobot
以下简称WCF,他支持了Go、HTTP、Java、Python、Rust多个版本的客户端,对于做第三方而言自然是http方便,这样可以多台虚拟机运行多个PC端微信和WCF,然后通过不同的ip和http协议控制不同的机器人。
于是:wcfhttp
安装:
pip install --upgrade wcfhttp
运行:
wcfhttp -cb http://127.0.0.1:9998/
运行成功后访问接口文档:http://127.0.0.1:9998/docs支持功能如下:
wcfhttp
从 docs 中查看更详细(默认地址为:http://localhost:9999/docs )。
- POST /msg_cb
接收消息回调样例
示例回调方法,简单打印消息
- Status Codes:
200 OK -- Successful Response
422 Unprocessable Entity -- Validation Error
- GET /login
获取登录状态
获取登录状态
- Status Codes:
200 OK -- Successful Response
- GET /wxid
获取登录账号 wxid
获取登录账号 wxid
- Status Codes:
200 OK -- Successful Response
- GET /user-info
获取登录账号个人信息
获取登录账号个人信息
- Status Codes:
200 OK -- Successful Response
- GET /msg-types
获取消息类型
获取消息类型
- Status Codes:
200 OK -- Successful Response
- GET /contacts
获取完整通讯录
获取完整通讯录
- Status Codes:
200 OK -- Successful Response
- GET /friends
获取好友列表
获取好友列表
- Status Codes:
200 OK -- Successful Response
- GET /dbs
获取所有数据库
获取所有数据库
- Status Codes:
200 OK -- Successful Response
- GET /{db}/tables
获取 db 中所有表
获取 db 中所有表
- Args:
db (str): 数据库名(可通过 get_dbs 查询)
- Returns:
List[dict]: db 下的所有表名及对应建表语句
- Parameters:
db (string) --
- Status Codes:
200 OK -- Successful Response
422 Unprocessable Entity -- Validation Error
- GET /pyq/
刷新朋友圈(数据从消息回调中查看)
刷新朋友圈
- Args:
id (int): 开始 id,0 为最新页
- Returns:
int: 1 为成功,其他失败
- Query Parameters:
id (integer) -- 开始 id,0 为最新页
- Status Codes:
200 OK -- Successful Response
422 Unprocessable Entity -- Validation Error
- GET /chatroom-member/
获取圈成员
获取群成员
- Args:
roomid (str): 群的 id
- Returns:
List[dict]: 群成员列表
- Query Parameters:
roomid (string) -- 群的 id
- Status Codes:
200 OK -- Successful Response
422 Unprocessable Entity -- Validation Error
- GET /alias-in-chatroom/
获取群成员名片
获取群成员名片
- Args:
roomid (str): 群的 id wxid (str): wxid
- Returns:
str: 名片
- Query Parameters:
wxid (string) -- wxid
roomid (string) -- 群的 id
- Status Codes:
200 OK -- Successful Response
422 Unprocessable Entity -- Validation Error
- POST /text
发送文本消息
发送文本消息,可参考:https://github.com/lich0821/WeChatRobot/blob/master/robot.py 里 sendTextMsg
- Args:
msg (str): 要发送的消息,换行使用 \n;如果 @ 人的话,需要带上跟 aters 里数量相同的 @ receiver (str): 消息接收人,wxid 或者 roomid aters (str): 要 @ 的 wxid,多个用逗号分隔;@所有人 只需要 notify@all
- Returns:
int: 0 为成功,其他失败
- Status Codes:
200 OK -- Successful Response
422 Unprocessable Entity -- Validation Error
- POST /image
发送图片消息
发送图片,非线程安全
- Args:
path (str): 图片路径,如:C:/Projs/WeChatRobot/TEQuant.jpeg 或 https://raw.githubusercontent.com/lich0821/WeChatRobot/master/TEQuant.jpeg receiver (str): 消息接收人,wxid 或者 roomid
- Returns:
int: 0 为成功,其他失败
- Status Codes:
200 OK -- Successful Response
422 Unprocessable Entity -- Validation Error
- POST /file
发送文件消息
发送文件
- Args:
path (str): 本地文件路径,如:C:/Projs/WeChatRobot/README.MD receiver (str): 消息接收人,wxid 或者 roomid
- Returns:
int: 0 为成功,其他失败
- Status Codes:
200 OK -- Successful Response
422 Unprocessable Entity -- Validation Error
- POST /sql
执行 SQL,如果数据量大注意分页,以免 OOM
执行 SQL,如果数据量大注意分页,以免 OOM
- Args:
db (str): 要查询的数据库 sql (str): 要执行的 SQL
- Returns:
List[dict]: 查询结果
- Status Codes:
200 OK -- Successful Response
422 Unprocessable Entity -- Validation Error
- POST /new-friend
通过好友申请
通过好友申请
- Args:
v3 (str): 加密用户名 (好友申请消息里 v3 开头的字符串) v4 (str): Ticket (好友申请消息里 v4 开头的字符串) scene: 申请方式 (好友申请消息里的 scene)
- Returns:
int: 1 为成功,其他失败
- Status Codes:
200 OK -- Successful Response
![]()
感谢博主,喝杯咖啡~
感谢博主,喝杯咖啡~
还没有人发表评论