diff --git a/github_cve_monitor.py b/github_cve_monitor.py index ac76f2f..2c56d74 100644 --- a/github_cve_monitor.py +++ b/github_cve_monitor.py @@ -3,7 +3,7 @@ # @Author : yhy&ddm&w4ter # 每3分钟检测一次githu -# 是否有新的cve漏洞提交记录,若有则通过server酱和钉钉机器人推送(二者配置一个即可) +# 是否有新的cve漏洞提交记录,若有则通过server酱和钉钉机器人推送,飞书捷径推送(二者配置一个即可) # 建议使用screen命令运行在自己的linux vps后台上,就可以愉快的接收各种cve了 # https://my.oschina.net/u/4581868/blog/4380482 @@ -28,6 +28,10 @@ def load_config(): dingding_secretKey = config['all_config']['dingding'][2]['secretKey'] app_name = config['all_config']['dingding'][3]['app_name'] return app_name,github_token,dingding_webhook,dingding_secretKey + elif int(config['all_config']['feishu'][0]['enable']) == 1: + feishu_webhook = config['all_config']['feishu'][1]['webhook'] + app_name = config['all_config']['feishu'][2]['app_name'] + return app_name,github_token,feishu_webhook,feishu_webhook elif int(config['all_config']['server'][0]['enable']) == 1: server_sckey = config['all_config']['server'][1]['sckey'] app_name = config['all_config']['server'][2]['app_name'] @@ -37,7 +41,7 @@ def load_config(): 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']['server'][0]['enable']) == 0 and int(config['all_config']['dingding'][0]['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']['dingding'][0]['enable']) == 0: print("[-] 配置文件有误,三个社交软件的enable不能为0") github_headers = { @@ -277,6 +281,8 @@ def send_body(url,query_pushed_at,query_tag_name): body = "工具名称:" + tools_name + "\r\n" + "更新详情地址:" + download_url + "\r\n" + "commit更新日志:" + "\r\n" + update_log if load_config()[0] == "dingding": dingding(text, body,load_config()[2],load_config()[3]) + elif load_config()[0] == "feishu": + feishu(text,body,load_config()[2]) elif load_config()[0] == "server": server(text, body,load_config()[2]) elif load_config()[0] == "tgbot": @@ -301,6 +307,8 @@ def send_body(url,query_pushed_at,query_tag_name): body = "工具名称:" + tools_name + "\r\n" + "工具地址:" + download_url + "\r\n" + "commit更新日志:" + "\r\n" + update_log if load_config()[0] == "dingding": dingding(text, body, load_config()[2], load_config()[3]) + elif load_config()[0] == "feishu": + feishu(text,body,load_config[2]) elif load_config()[0] == "server": server(text, body, load_config()[2]) elif load_config()[0] == "tgbot": @@ -371,6 +379,10 @@ def translate(word): def dingding(text, msg,webhook,secretKey): ding = cb.DingtalkChatbot(webhook, secret=secretKey) ding.send_text(msg='{}\r\n{}'.format(text, msg), is_at_all=False) +## 飞书 +def feishu(text,msg,webhook): + ding = cb.DingtalkChatbot(webhook) + ding.send_text(msg='{}\r\n{}'.format(text, msg), is_at_all=False) # server酱 http://sc.ftqq.com/?c=code def server(text, msg,sckey): try: @@ -422,6 +434,9 @@ def sendNews(data): if load_config()[0] == "dingding": dingding(text, body, load_config()[2], load_config()[3]) print("钉钉 发送 CVE 成功") + elif load_config()[0] == "feishu": + feishu(text, body, load_config()[2]) + print("飞书 发送 CVE 成功") elif load_config()[0] == "server": server(text, body, load_config()[2]) print("server酱 发送 CVE 成功")