Merge pull request #16 from wuyoukm/patch-4
Update github_cve_monitor.py
This commit is contained in:
commit
45092e7d08
@ -27,21 +27,21 @@ def load_config():
|
|||||||
with open('config.yaml', 'r') as f:
|
with open('config.yaml', 'r') as f:
|
||||||
config = yaml.load(f,Loader=yaml.FullLoader)
|
config = yaml.load(f,Loader=yaml.FullLoader)
|
||||||
github_token = config['all_config']['github_token']
|
github_token = config['all_config']['github_token']
|
||||||
if int(config['all_config']['dingding'][0].split(":")[1]) == 1:
|
if int(config['all_config']['dingding'][0]['enable']) == 1:
|
||||||
dingding_webhook = "https:"+config['all_config']['dingding'][1].split(":")[2]
|
dingding_webhook = config['all_config']['dingding'][1]['webhook']
|
||||||
dingding_secretKey = config['all_config']['dingding'][2].split(":")[1]
|
dingding_secretKey = config['all_config']['dingding'][2]['secretKey']
|
||||||
app_name = config['all_config']['dingding'][3].split(":")[1]
|
app_name = config['all_config']['dingding'][3]['app_name']
|
||||||
return app_name,github_token,dingding_webhook,dingding_secretKey
|
return app_name,github_token,dingding_webhook,dingding_secretKey
|
||||||
elif int(config['all_config']['server'][0].split(":")[1]) == 1:
|
elif int(config['all_config']['server'][0]['enable']) == 1:
|
||||||
server_sckey = config['all_config']['server'][1].split(":")[1]
|
server_sckey = config['all_config']['server'][1]['sckey']
|
||||||
app_name = config['all_config']['server'][2].split(":")[1]
|
app_name = config['all_config']['server'][2]['app_name']
|
||||||
return app_name,github_token,server_sckey
|
return app_name,github_token,server_sckey
|
||||||
elif int(config['all_config']['tgbot'][0].split(":")[1]) ==1 :
|
elif int(config['all_config']['tgbot'][0]['enable']) ==1 :
|
||||||
tgbot_token = config['all_config']['tgbot'][1].split(":")[1]
|
tgbot_token = config['all_config']['tgbot'][1]['token']
|
||||||
tgbot_group_id = config['all_config']['tgbot'][2].split(":")[1]
|
tgbot_group_id = config['all_config']['tgbot'][2]['group_id']
|
||||||
app_name = config['all_config']['tgbot'][3].split(":")[1]
|
app_name = config['all_config']['tgbot'][3]['app_name']
|
||||||
return app_name,github_token,tgbot_token,tgbot_group_id
|
return app_name,github_token,tgbot_token,tgbot_group_id
|
||||||
elif int(config['all_config']['tgbot'][0].split(":")[1]) == 0 and int(config['all_config']['server'][0].split(":")[1]) == 0 and int(config['all_config']['dingding'][0].split(":")[1]) == 0:
|
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:
|
||||||
print("[-] 配置文件有误,三个社交软件的enable不能为0")
|
print("[-] 配置文件有误,三个社交软件的enable不能为0")
|
||||||
logging.error("[-] 配置文件有误,三个社交软件的enable不能为0")
|
logging.error("[-] 配置文件有误,三个社交软件的enable不能为0")
|
||||||
|
|
||||||
@ -423,4 +423,4 @@ if __name__ == '__main__':
|
|||||||
send_dingding(data3[i]['api_url'],data3[i]['pushed_at'],data3[i]['tag_name'])
|
send_dingding(data3[i]['api_url'],data3[i]['pushed_at'],data3[i]['tag_name'])
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print("main 函数 遇到错误-->{}".format(e))
|
print("main 函数 遇到错误-->{}".format(e))
|
||||||
logging.error("main 函数 遇到错误-->{}".format(e))
|
logging.error("main 函数 遇到错误-->{}".format(e))
|
||||||
|
Loading…
Reference in New Issue
Block a user