diff --git a/flask-consul/units/avd/avd_list.py b/flask-consul/units/avd/avd_list.py index 888dc36..e992b7c 100644 --- a/flask-consul/units/avd/avd_list.py +++ b/flask-consul/units/avd/avd_list.py @@ -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"# {avd_dict['avd_name']}\n" \ f"- 编号:{avd_dict['avd_id']}[【详情】]({avd_dict['avd_id_url']})\n" \ f"- 类型:{avd_dict['avd_type']}\n" \ @@ -42,7 +43,14 @@ 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'} params = {'msgtype': 'markdown', 'markdown': {'content' : content}} @@ -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",}]}} + data = json.dumps(params) + response = requests.post(webhook, headers=headers, data=data) + print('【feishu】',response.json(),flush=True) diff --git a/flask-consul/units/token_auth.py b/flask-consul/units/token_auth.py index e083332..f704231 100644 --- a/flask-consul/units/token_auth.py +++ b/flask-consul/units/token_auth.py @@ -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": "登录过期,请重新登录!"} diff --git a/vue-consul/src/views/avd/index.vue b/vue-consul/src/views/avd/index.vue index 2d507f2..940c9ac 100644 --- a/vue-consul/src/views/avd/index.vue +++ b/vue-consul/src/views/avd/index.vue @@ -23,6 +23,12 @@ + + + + + 机器人安全设置的自定义关键词请设置为:漏洞告警 +