cve监控脚本

该博客介绍了一个通过监控GitHub API来获取CVE告警并使用钉钉和Server酱进行消息推送的脚本。默认启用Server酱推送,所有推送结果均记录在PostgreSQL数据库中,其中GitHub URL作为唯一索引。
摘要由CSDN通过智能技术生成

[1]通过监控github api进行cve告警推送
[2]消息推送通过钉钉和server酱推送
[3]默认启用server酱推送
[4]所有推送结果都写入到PGsql中,github_URL为唯一索引

# -*- coding:utf-8 -*-

import time, re
import json
import requests
from operator import itemgetter
import psycopg2

def timeUp():
    ticks = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
    return ticks

def getNews():
    year = time.strftime("%Y", time.localtime(time.time()))
    try:
        api = f"https://api.github.com/search/repositories?q=CVE-{year}&sort=updated"
        response = requests.get(api).text
        print(ticks, '[-]>> github连接状态:', requests.get(api).status_code)
        if requests.get(api).status_code == 200 :
           data = json.loads(response)
        return data
    except Exception as e:
        print('[-]{} >>'.format(ticks)</
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值