增加PushPlus方式,支持Mac版微信模板消息以及企业微信应用推送

This commit is contained in:
lintstar 2022-01-26 17:12:12 +08:00
parent 81e24f9696
commit 74920e434a
6 changed files with 46 additions and 3 deletions

View File

@ -82,6 +82,28 @@ ps因微信的原因server酱的旧版将在2021年4月后下线新版
`config.yaml`中配置`server`的`token`等信息,`enable`设置为 `1`表示推送
## 推送加【Mac 版微信可用】
免费的微信模板消息通知,支持在 Mac 版微信查看
### Mac微信效果
![image-20220126110109185](images/image-20220126110109185.png)
具体配置方法见 pushplus 公众号文章https://mp.weixin.qq.com/s/YRYb04PUFNVZejzV2G-k4w
同时也支持使用企业微信应用通知,只需从 API 接口修改默认配置即可:
![image-20220126105710922](images/image-20220126105710922.png)
修改成功:
![image-20220126110312664](images/image-20220126110312664.png)
### 企业微信应用效果
![image-20220126110919827](images/image-20220126110919827.png)
# Github 访问限制
监控工具更新 请求次数过多超过了每小时请求添加gihtub token

View File

@ -5,7 +5,6 @@
# 每3分钟检测一次githu
# 是否有新的cve漏洞提交记录若有则通过server酱和钉钉机器人推送,飞书捷径推送(二者配置一个即可)
# 建议使用screen命令运行在自己的linux vps后台上就可以愉快的接收各种cve了
# https://my.oschina.net/u/4581868/blog/4380482
# https://github.com/kiang70/Github-Monitor
import json
@ -36,13 +35,17 @@ def load_config():
server_sckey = config['all_config']['server'][1]['sckey']
app_name = config['all_config']['server'][2]['app_name']
return app_name,github_token,server_sckey
elif int(config['all_config']['pushplus'][0]['enable']) == 1:
pushplus_token = config['all_config']['pushplus'][1]['token']
app_name = config['all_config']['pushplus'][2]['app_name']
return app_name,github_token,pushplus_token
elif int(config['all_config']['tgbot'][0]['enable']) ==1 :
tgbot_token = config['all_config']['tgbot'][1]['token']
tgbot_group_id = config['all_config']['tgbot'][2]['group_id']
app_name = config['all_config']['tgbot'][3]['app_name']
return app_name,github_token,tgbot_token,tgbot_group_id
elif int(config['all_config']['tgbot'][0]['enable']) == 0 and int(config['all_config']['feishu'][0]['enable']) == 0 and int(config['all_config']['server'][0]['enable']) == 0 and int(config['all_config']['dingding'][0]['enable']) == 0:
print("[-] 配置文件有误,个社交软件的enable不能为0")
elif int(config['all_config']['tgbot'][0]['enable']) == 0 and int(config['all_config']['feishu'][0]['enable']) == 0 and int(config['all_config']['server'][0]['enable']) == 0 and int(config['all_config']['pushplus'][0]['enable']) == 0 and int(config['all_config']['dingding'][0]['enable']) == 0:
print("[-] 配置文件有误,个社交软件的enable不能为0")
github_headers = {
'Authorization': "token {}".format(load_config()[1])
@ -80,6 +83,8 @@ def create_database():
dingding("test", "连接成功", load_config()[2], load_config()[3])
elif load_config()[0] == "server":
server("test", "连接成功", load_config()[2])
elif load_config()[0] == "pushplus":
pushplus("test", "连接成功", load_config()[2])
elif load_config()[0] == "tgbot":
tgbot("test", "连接成功", load_config()[2], load_config()[3])
#根据排序获取本年前20条CVE
@ -259,6 +264,8 @@ def send_body(url,query_pushed_at,query_tag_name):
dingding(text, body,load_config()[2],load_config()[3])
elif load_config()[0] == "server":
server(text, body,load_config()[2])
elif load_config()[0] == "pushplus":
pushplus(text, body,load_config()[2])
elif load_config()[0] == "tgbot":
tgbot(text,body,load_config()[2],load_config()[3])
conn = sqlite3.connect('data.db')
@ -288,6 +295,8 @@ def send_body(url,query_pushed_at,query_tag_name):
feishu(text,body,load_config()[2])
elif load_config()[0] == "server":
server(text, body,load_config()[2])
elif load_config()[0] == "pushplus":
pushplus(text, body,load_config()[2])
elif load_config()[0] == "tgbot":
tgbot(text,body,load_config()[2],load_config()[3])
conn = sqlite3.connect('data.db')
@ -314,6 +323,8 @@ def send_body(url,query_pushed_at,query_tag_name):
feishu(text,body,load_config[2])
elif load_config()[0] == "server":
server(text, body, load_config()[2])
elif load_config()[0] == "pushplus":
pushplus(text, body,load_config()[2])
elif load_config()[0] == "tgbot":
tgbot(text, body, load_config()[2], load_config()[3])
conn = sqlite3.connect('data.db')
@ -393,6 +404,13 @@ def server(text, msg,sckey):
requests.get(uri, headers=github_headers, timeout=10)
except Exception as e:
pass
# pushplus https://www.pushplus.plus/push1.html
def pushplus(text, msg,token):
try:
uri = 'https://www.pushplus.plus/send?token={}&title={}&content={}'.format(token,text, msg)# 将 xxxx 换成自己的pushplus的 token
requests.get(uri, headers=github_headers, timeout=10)
except Exception as e:
pass
# 添加Telegram Bot推送支持
def tgbot(text, msg,token,group_id):
import telegram
@ -443,6 +461,9 @@ def sendNews(data):
elif load_config()[0] == "server":
server(text, body, load_config()[2])
print("server酱 发送 CVE 成功")
elif load_config()[0] == "pushplus":
pushplus(text, body, load_config()[2])
print("pushplus 发送 CVE 成功")
elif load_config()[0] == "tgbot":
tgbot(text, body, load_config()[2], load_config()[3])
print("tgbot 发送 CVE 成功")

Binary file not shown.

After

Width:  |  Height:  |  Size: 268 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 298 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 247 KiB