[fix] 利用正则对项目名称进行提取cve编号

This commit is contained in:
yhy0 2021-07-30 10:29:21 +08:00
parent f92c46f907
commit d089dc068d

View File

@ -8,7 +8,7 @@
# https://my.oschina.net/u/4581868/blog/4380482 # https://my.oschina.net/u/4581868/blog/4380482
# https://github.com/kiang70/Github-Monitor # https://github.com/kiang70/Github-Monitor
import requests, time import requests, time, re
import dingtalkchatbot.chatbot as cb import dingtalkchatbot.chatbot as cb
import datetime import datetime
import hashlib import hashlib
@ -185,8 +185,9 @@ def sendNews(tools_list):
# 推送标题 # 推送标题
text = r'有新的CVE送达' text = r'有新的CVE送达'
# 获取 cve 名字 根据cve 名字,获取描述,并翻译 # 获取 cve 名字 根据cve 名字,获取描述,并翻译
cve_zh = get_cve_des_zh(req['items'][0]['name']) cve_name = re.findall("(?i)CVE\-\d+\-\d+", req['items'][0]['name'])[0].upper()
msg = "CVE编号"+ req['items'][0]['name'] + "\r\n"+"Github地址"+ str(getNews()[2]) + "\r\n" + "CVE描述"+ cve_zh cve_zh = get_cve_des_zh(cve_name)
msg = "CVE编号"+ cve_name + "\r\n"+"Github地址"+ str(getNews()[2]) + "\r\n" + "CVE描述"+ cve_zh
# 三选一即可,没配置的 注释或者删掉 # 三选一即可,没配置的 注释或者删掉
# server(text, msg) # server(text, msg)