add feishu
parent
eb77f79fa3
commit
0742ff4b99
|
@ -33,6 +33,7 @@ def get_avd():
|
|||
avd_switch = consul_kv.get_value('ConsulManager/avd/switch')
|
||||
wecomwh = avd_switch.get('wecomwh','')
|
||||
dingdingwh = avd_switch.get('dingdingwh','')
|
||||
feishuwh = avd_switch.get('feishuwh','')
|
||||
content = f"# <font color=\"#ff0000\">{avd_dict['avd_name']}</font>\n" \
|
||||
f"- 编号:{avd_dict['avd_id']}[【详情】]({avd_dict['avd_id_url']})\n" \
|
||||
f"- 类型:{avd_dict['avd_type']}\n" \
|
||||
|
@ -42,6 +43,13 @@ def get_avd():
|
|||
wecom(wecomwh,content)
|
||||
if avd_switch['switch'] and avd_switch['dingding'] and dingdingwh.startswith('https://oapi.dingtalk.com'):
|
||||
dingding(dingdingwh,content)
|
||||
if avd_switch['switch'] and avd_switch.get('feishu',False) and feishuwh.startswith('https://open.feishu.cn'):
|
||||
title = '漏洞告警:' + avd_dict['avd_name']
|
||||
md = f"编号:{avd_dict['avd_id']}[【详情】]({avd_dict['avd_id_url']})\n" \
|
||||
f"类型:{avd_dict['avd_type']}\n" \
|
||||
f"披露:{avd_dict['avd_time']}\n" \
|
||||
f"状态:**{avd_dict['avd_stat']}**({avd_dict['avd_collect']})"
|
||||
feishu(feishuwh,title,md)
|
||||
|
||||
def wecom(webhook,content):
|
||||
headers = {'Content-Type': 'application/json'}
|
||||
|
@ -56,3 +64,12 @@ def dingding(webhook,content):
|
|||
data = bytes(json.dumps(params), 'utf-8')
|
||||
response = requests.post(webhook, headers=headers, data=data)
|
||||
print('【dingding】',response.json(),flush=True)
|
||||
|
||||
def feishu(webhook,title,md):
|
||||
headers = {'Content-Type': 'application/json'}
|
||||
params = {"msg_type": "interactive",
|
||||
"card": {"header": {"title": {"tag": "plain_text","content": title},"template": "red"},
|
||||
"elements": [{"tag": "markdown","content": f"{md}\n<at id=all></at>",}]}}
|
||||
data = json.dumps(params)
|
||||
response = requests.post(webhook, headers=headers, data=data)
|
||||
print('【feishu】',response.json(),flush=True)
|
||||
|
|
|
@ -9,8 +9,8 @@ auth = HTTPTokenAuth()
|
|||
def verify_token(token):
|
||||
try:
|
||||
data = s.loads(token)
|
||||
except BadSignature:
|
||||
raise AuthFailed(msg='token不正确')
|
||||
#except BadSignature:
|
||||
#raise AuthFailed(msg='token不正确')
|
||||
except SignatureExpired:
|
||||
raise AuthFailed(msg='token过期')
|
||||
return {"code": 40000, "data": "登录过期,请重新登录!"}
|
||||
|
|
|
@ -23,6 +23,12 @@
|
|||
<el-form-item v-if="avd_config.switch && avd_config.wecom" required label="机器人Webhook地址">
|
||||
<el-input v-model="avd_config.wecomwh" type="textarea" autosize />
|
||||
</el-form-item>
|
||||
<el-form-item v-if="avd_config.switch" label="飞书通知">
|
||||
<el-switch v-model="avd_config.feishu" />
|
||||
</el-form-item>
|
||||
<el-form-item v-if="avd_config.switch && avd_config.feishu" required label="机器人Webhook地址">
|
||||
<el-input v-model="avd_config.feishuwh" type="textarea" autosize /><font size="3px" color="#ff0000">机器人安全设置的自定义关键词请设置为:<strong>漏洞告警</strong></font>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button @click="dialogFormVisible = false">
|
||||
|
@ -56,7 +62,7 @@ export default {
|
|||
return {
|
||||
listLoading: false,
|
||||
dialogFormVisible: false,
|
||||
avd_config: { switch: false, wecom: false, dingding: false, wecomwh: '', dingdingwh: '' },
|
||||
avd_config: { switch: false, wecom: false, dingding: false, feishu: false, wecomwh: '', dingdingwh: '', feishuwh: '' },
|
||||
avd_list: []
|
||||
}
|
||||
},
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
<el-timeline-item timestamp="2022/6/13" placement="top">
|
||||
<el-card>
|
||||
<h4>v0.6.1</h4>
|
||||
<p>漏洞通知增加了飞书的支持。</p>
|
||||
<p>优化了漏洞通知页面的描述信息。</p>
|
||||
<p>修复了一个启动漏洞通知的bug。</p>
|
||||
</el-card>
|
||||
|
|
Loading…
Reference in New Issue