Git Product home page Git Product logo

wechatbot's Introduction

WechatBot

一个基于PC版的微信机器人,采用hook的形式进行消息拦截,内存信息读取的形式获取通讯录,用户信息等

感谢@cixingguangming55555开发的server端以及集成化的hook利用程序,本项目是基于@cixingguangming55555大佬的开源项目进行的二开(玩法很多我慢慢开发吧,就这样吧)

这里需要使用的微信版本是3.2.1.121版本,历史版本下载地址

部署教程

安装微信3.2.1.121版本,然后再打开ServerMain/server中的微信DLL注入器V1.0.3.exe工具进行dll注入

image-20220915181623688

*注入完成使用命令curl http://127.0.0.1:5555 去测试一下是否注入成功,如果015不成功可以尝试使用018来注入或者下面其他的

*或者可以使用微信版本为3.6.0.18,然后再使用对应的dll文件进行注入

点击注入即可,然后接下来就是项目的config目录下面的config.ini的配置

*注意编辑config文件不要用txt打开会改变文件的类型,导致报错!!!

config.ini详解

[server]
# 微信机器人服务端的配置文件
ip = 127.0.0.1
port = 5555
# 管理员wxid
admin_id = wxid_kb0e7h9icqqv22,wxid_6vxrrvjff6pg22,wxid_fys2fico9put22,wxid_lb33d6uyarmv22,
# 推送的微信群聊地址
room_id = 23117228686@chatroom,24472020852@chatroom,20809144388@chatroom,22261634025@chatroom,22868513156@chatroom,25348406777@chatroom,22108828312@chatroom,24749035253@chatroom,19752248739@chatroom,24303327388@chatroom,25455028831@chatroom
# 视频权限群聊地址
video_list_room_id = 19820015740@chatroom,23117228686@chatroom,25348406777@chatroom,20809144388@chatroom,25142607072@chatroom,39218917883@chatroom,24749035253@chatroom,19752248739@chatroom
# 群娱乐功能黑名单
blacklist_room_id = 24472020852@chatroom,
# 早报自动推送时间
set_time_am = 09:00
# 晚间资讯自动推送时间
set_time_pm = 17:00
# 推送今日黄历
set_time_am_today = 08:30
# 推送摸鱼日历
set_fish_time = 15:00
# 下班时间
after_work_time = 18:00
# 发工资日期
salary_day = 10

[apiService]
# openai用户key
openai_key = 
# 微步社区的key
threatbook_key = 自己去微步社区个人中心查看
threatbook_url = https://api.threatbook.cn/v3/scene/ip_reputation
# MD5解密接口
md5_url = 
# 舔狗日记接口
dog_url = http://api.tianapi.com/tiangou/index?key=自己的key
# 彩虹屁接口
fart_url = http://api.tianapi.com/caihongpi/index?key=自己的key
# 60s读懂世界
history_url = https://api.qqsuu.cn/api/dm-60s
# 查询天气接口
weather_url = https://www.tianqiapi.com/free/day?appid=自己的key&appsecret=自己的key&city=
# 美女视频接口
girl_videos_url = https://tucdn.wpon.cn/api-girl/
# 当日安全资讯
xz_url = https://xz.aliyun.com/feed
freebuf_url = https://www.freebuf.com/feed
qax_url = https://forum.butian.net/Rss
anquanke_url = https://www.anquanke.com/knowledge
# 搞笑段子接口
smile_url = https://www.mxnzp.com/api/jokes/list?app_id=自己的key&app_secret=自己的key&page=
# 今日黄历接口
zodiac_url = https://www.mxnzp.com/api/holiday/single/
allow_token = ?ignoreHoliday=false&app_id=自己的key&app_secret=自己的key
# 早安寄语接口
morning_url = https://api.qqsuu.cn/api/dm-zaoan
# 星座运势
constellation_url = http://api.tianapi.com/star/index?key=自己的key&astro=
# ai对话机器人接口
ai_reply_url = http://api.qingyunke.com/api.php?key=free&msg=

admin_id是管理员ID,在程序跑起来之后你给机器人发送一个消息即可看见

image-20220915181940797

这个就是你的管理身份账号

*其中群里地址就是roomid在控制台中打印的msg中就能看见

image-20221023202452175

image-20221023202551321

舔狗日记和彩虹屁接口信息可以到https://www.tianapi.com进行注册获取

项目启动

首先使用命令安装依赖

pip3 install -r requirements.txt

如果出现WebSocketApp no modle的报错,使用命令安装此依赖即可

pip3 install websocket-client-py3

然后使用命令即可启动项目

python3 main.py

*建议使用python3.8以上

如果其中有不需要的功能就不用配置config.ini中的api接口信息,其中config.ini中的配置文件和前面的一个处理函数是关联关系,删除或者注释config.ini的配置文件会引起报错项目无法启动,如果不需要可以将相关的处理函数注释点即可,如果有什么新的玩法可以提交Pr

项目结构

config

为项目的配置文件目录

servercli

为项目的核心处理逻辑目录,主要是使用的websocket和http协议进行的通信

httpcli

主要为接口的一些处理逻辑文件的目录,大部分的配置文件都是config目录中的,二者是关联关系

后续开发计划

  • 实现每日咨询自动定时推送(暂时只可以管理员指定获取)(已完成)
  • 新增黄历,段子,天气查询,美女视频等 (已完成)
  • 新增AI只能对话功能,摸鱼日历功能等 (已完成)
  • 已恢复舔狗日记
  • *2022-11-04新增恶意ip查询,调用的微步接口,每天限制50次,修改早晚日报,修改部分代码逻辑
  • *修复摸鱼日记diff算法错误,修改一处接口调用
  • *开发计划:预计本月添加openai机器人,目前我阳了,等我转阴后实现此功能。
  • *2023-02-01新增功能openai机器人功能
  • *2023-02-22 bug修复功能说明,openai的调用关键词是Hey或者hey,出现不回复的情况一般是官方问题。同时发现一个bug,不支持英文版本的wechat,使用openai可以不用科学上网。
  • *2023-03-20 新增chatgpt3.5,私聊支持连续对话,以及角色扮演,该代码提供由@Xciny提供
  • 实现GitHub实时监控
  • 实现第三方工具实时推送
  • 待定,有需求可以提交lessus

最后

代码写的烂,轻点喷,毕竟我这么菜,后续项目迭代看心情吧,就这样

温馨提示

尽量使用git命令进行克隆,不要使用zip压缩包下载模式,可能会造成程序跑不起来

git命令

git clone https://github.com/zhizhuoshuma/WechatBot.git

国内git加速命令

git clone https://github.91chi.fun/https://github.com/zhizhuoshuma/WechatBot.git

如果程序跑不起来,可以提交lessus,或者微信联系我,给我ssh或者rdp我上去帮你远程调试

参考资料

wechatbot's People

Contributors

expzhizhuo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

wechatbot's Issues

联系

师傅怎么联系啊

启动后出现如下错误,config没有更改, 代理已经关闭. 错误:"由于目标计算机积极拒绝,无法连接。"

[2023-08-28 15:59:13]:WechatBot Run ....
Traceback (most recent call last):
File "C:\Users\yuetingpei\AppData\Local\Programs\Python\Python310\lib\site-packages\urllib3\connection.py", line 174, in _new_conn
conn = connection.create_connection(
File "C:\Users\yuetingpei\AppData\Local\Programs\Python\Python310\lib\site-packages\urllib3\util\connection.py", line 95, in create_connection
raise err
File "C:\Users\yuetingpei\AppData\Local\Programs\Python\Python310\lib\site-packages\urllib3\util\connection.py", line 85, in create_connection
sock.connect(sa)
ConnectionRefusedError: [WinError 10061] 由于目标计算机积极拒绝,无法连接。

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Users\yuetingpei\AppData\Local\Programs\Python\Python310\lib\site-packages\urllib3\connectionpool.py", line 714, in urlopen
httplib_response = self._make_request(
File "C:\Users\yuetingpei\AppData\Local\Programs\Python\Python310\lib\site-packages\urllib3\connectionpool.py", line 415, in _make_request
conn.request(method, url, **httplib_request_kw)
File "C:\Users\yuetingpei\AppData\Local\Programs\Python\Python310\lib\site-packages\urllib3\connection.py", line 244, in request
super(HTTPConnection, self).request(method, url, body=body, headers=headers)
File "C:\Users\yuetingpei\AppData\Local\Programs\Python\Python310\lib\http\client.py", line 1276, in request
self._send_request(method, url, body, headers, encode_chunked)
File "C:\Users\yuetingpei\AppData\Local\Programs\Python\Python310\lib\http\client.py", line 1322, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "C:\Users\yuetingpei\AppData\Local\Programs\Python\Python310\lib\http\client.py", line 1271, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "C:\Users\yuetingpei\AppData\Local\Programs\Python\Python310\lib\http\client.py", line 1031, in _send_output
self.send(msg)
File "C:\Users\yuetingpei\AppData\Local\Programs\Python\Python310\lib\http\client.py", line 969, in send
self.connect()
File "C:\Users\yuetingpei\AppData\Local\Programs\Python\Python310\lib\site-packages\urllib3\connection.py", line 205, in connect
conn = self._new_conn()
File "C:\Users\yuetingpei\AppData\Local\Programs\Python\Python310\lib\site-packages\urllib3\connection.py", line 186, in _new_conn
raise NewConnectionError(
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x000002644C2F30D0>: Failed to establish a new connection: [WinError 10061] 由于目标计算机积极拒绝,无法连接。

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Users\yuetingpei\AppData\Local\Programs\Python\Python310\lib\site-packages\requests\adapters.py", line 489, in send
resp = conn.urlopen(
File "C:\Users\yuetingpei\AppData\Local\Programs\Python\Python310\lib\site-packages\urllib3\connectionpool.py", line 798, in urlopen
retries = retries.increment(
File "C:\Users\yuetingpei\AppData\Local\Programs\Python\Python310\lib\site-packages\urllib3\util\retry.py", line 592, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='127.0.0.1', port=5555): Max retries exceeded with url: //api/get_personal_info (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x000002644C2F30D0>: Failed to establish a new connection: [WinError 10061] 由于目标计算机积极拒绝,无法连接。'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\WechatBot\main.py", line 141, in
main()
File "C:\WechatBot\main.py", line 129, in main
get_personal_info()
File "C:\WechatBot\servercli\server.py", line 99, in get_personal_info
respJson = send(uri, data)
File "C:\WechatBot\servercli\server.py", line 78, in send
res = requests.post(url, json={"para": base_data}, timeout=5)
File "C:\Users\yuetingpei\AppData\Local\Programs\Python\Python310\lib\site-packages\requests\api.py", line 115, in post
return request("post", url, data=data, json=json, **kwargs)
File "C:\Users\yuetingpei\AppData\Local\Programs\Python\Python310\lib\site-packages\requests\api.py", line 59, in request
return session.request(method=method, url=url, **kwargs)
File "C:\Users\yuetingpei\AppData\Local\Programs\Python\Python310\lib\site-packages\requests\sessions.py", line 587, in request
resp = self.send(prep, **send_kwargs)
File "C:\Users\yuetingpei\AppData\Local\Programs\Python\Python310\lib\site-packages\requests\sessions.py", line 701, in send
r = adapter.send(request, **kwargs)
File "C:\Users\yuetingpei\AppData\Local\Programs\Python\Python310\lib\site-packages\requests\adapters.py", line 565, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPConnectionPool(host='127.0.0.1', port=5555): Max retries exceeded with url: //api/get_personal_info (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x000002644C2F30D0>: Failed to establish a new connection: [WinError 10061] 由于目标计算机积极拒绝,无法连接。'))

Process finished with exit code 1

请问注入后,安装完环境依赖,在没有修改config的情况下运行出现这个问题该怎么办?

Traceback (most recent call last):
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\configparser.py", line 789, in get
value = d[option]
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\collections_init_.py", line 898, in getitem
return self.missing(key) # support subclasses that define missing
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\collections_init_.py", line 890, in missing
raise KeyError(key)
KeyError: 'y4tacker_url'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "D:\codeProgram\wechatBot\WechatBot\main.py", line 5, in
from servercli.server import *
File "D:\codeProgram\wechatBot\WechatBot\servercli\server.py", line 6, in
from httpcli.everyday_news import *
File "D:\codeProgram\wechatBot\WechatBot\httpcli\everyday_news.py", line 22, in
y4tacker_url = config.get("apiService", "y4tacker_url")
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\configparser.py", line 792, in get
raise NoOptionError(option, section)
configparser.NoOptionError: No option 'y4tacker_url' in section: 'apiService'

好像是配置文件中缺少 'apiService' 部分?

运行报错

image

您好 运行报错 这个是127.0.0.1:5555连接不到嘛?我防火墙都关了的

报错了,大佬帮我看看怎么回事(已解决)

Traceback (most recent call last):
File "C:\Users\Administrator\Desktop\WechatBot-main\main.py", line 1, in
from servercli.server import *
File "C:\Users\Administrator\Desktop\WechatBot-main\servercli\server.py", line 17, in
blacklist_room_id = config.get("server", "blacklist_room_id")
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\configparser.py", line 792, in get
raise NoOptionError(option, section)
configparser.NoOptionError: No option 'blacklist_room_id' in section: 'server'

安装依赖包时的注意事项

1.pip3 install……执行之前记得把VPN或者代理关了。
2.其中一个依赖包lxml死活安装不成功,CSDN探索了半天,最终找到的解决方案是卸载3.11.1版本的Python,安装3.9.12版本,即可成功。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.