Giter Site home page Giter Site logo

github-cve-monitor's Issues

请问运行py程序后数据库database()报错怎么解决呀?

[root@ddddd-1 github-cve-monitor]# python3 github_cve_monitor.py
cve 和 github 发布工具 监控中 ...
成功创建CVE监控表
成功创建红队工具监控表
Traceback (most recent call last):
File "/root/github-cve-monitor/github_cve_monitor.py", line 440, in
create_database()
File "/root/github-cve-monitor/github_cve_monitor.py", line 75, in create_database
if load_config()[0] == "dingding":
File "/root/github-cve-monitor/github_cve_monitor.py", line 26, in load_config
if int(config['all_config']['dingding'][0]['enable']) == 1:
KeyError: 0

TypeError: 'NoneType' object is not iterable

出现如下错误,且telegram无法推送更新消息:

tools_insert_into_sqlite3 函数: Keka插入数据成功!

                  用户仓库监控

^[[A^[[A^[[ATraceback (most recent call last):
  File "/root/github-cve-monitor/github-cve-monitor/github_cve_monitor.py", line 689, in <module>
    for user in user_list:
TypeError: 'NoneType' object is not iterable
^[[A^[[A^

有时候程序会突然崩溃,再次启动就输出github连接不通

下面是详细信息, 麻烦看一下是什么原因 (这里我使用的美国VPS)
`root@linux:/home/github-cve-monitor# python3 github_cve_monitor.py
cve 和 github 发布工具 监控中 ...
成功创建CVE监控表
成功创建红队工具监控表
tools_insert_into_sqlite3 函数 打开数据库成功!
[-] 红队工具表数据库里存在Godzilla
[-] 红队工具表数据库里存在Behinder
[-] 红队工具表数据库里存在antSword
[-] 红队工具表数据库里存在shiro_attack
[-] 红队工具表数据库里存在ExpDemo-JavaFX
[-] 红队工具表数据库里存在github-cve-monitor
[-] 红队工具表数据库里存在mimikatz
[-] 红队工具表数据库里存在nps
[-] 红队工具表数据库里存在xray
[-] 红队工具表数据库里存在pystinger
[-] 红队工具表数据库里存在Neo-reGeorg
[-] 红队工具表数据库里存在fscan
[-] 红队工具表数据库里存在MDUT
[-] 红队工具表数据库里存在Vulnerability
local variable 'cve_name' referenced before assignment github链接不通
--- Logging error ---
Traceback (most recent call last):
File "github_cve_monitor.py", line 112, in getNews
today_cve_info_tmp.append({"cve_name":cve_name,"cve_url":cve_url,"pushed_at":pushed_at})
UnboundLocalError: local variable 'cve_name' referenced before assignment

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/lib/python3.6/logging/init.py", line 994, in emit
msg = self.format(record)
File "/usr/lib/python3.6/logging/init.py", line 840, in format
return fmt.format(record)
File "/usr/lib/python3.6/logging/init.py", line 577, in format
record.message = record.getMessage()
File "/usr/lib/python3.6/logging/init.py", line 338, in getMessage
msg = msg % self.args
TypeError: not all arguments converted during string formatting
Call stack:
File "github_cve_monitor.py", line 486, in
cve_data = getNews()
File "github_cve_monitor.py", line 130, in getNews
logging.error(e, "github链接不通")
Message: UnboundLocalError("local variable 'cve_name' referenced before assignment",)
Arguments: ('github链接不通',)
Traceback (most recent call last):
File "github_cve_monitor.py", line 487, in
today_cve_data = get_today_cve_info(cve_data)
File "github_cve_monitor.py", line 179, in get_today_cve_info
print("[-] 数据库里存在{}".format(today_cve_name.upper()))
UnboundLocalError: local variable 'today_cve_name' referenced before assignment
`

钉钉不推送为题

按照教程更新的,不知道为啥钉钉不会推送,已经设置了github_token和钉钉机器人hook

Docker start

初始化

git clone https://github.com/yhy0/github-cve-monitor.git /opt/cve

Config

保存为 start.sh

#!/bin/env sh

set -ex

if ! [ "$(cat /etc/timezone)" = "$TZ" ];then
	apt update -y
	ln -fs /usr/share/zoneinfo/${TZ} /etc/localtime
	echo ${TZ} > /etc/timezone
	apt install -y tzdata
	dpkg-reconfigure --frontend noninteractive tzdata
	apt install -y python3.9 python3-pip
	pip install -r /opt/cve/requirements.txt
	rm -rf /var/lib/apt/lists/*
fi

cd /opt/cve/
python3 /opt/cve/github_cve_monitor.py

Start

路径需要稍微修改下

docker run -it --name cve \
	-v /docker/cve:/opt/cve \
	--restart=always \
	-e TZ=Asia/Shanghai \
	ubuntu /opt/cve/start.sh

功能建议

建议配合 github action 使用,不需要单独找 vps 进行部署。

关于推送

不能只设置企业微信或者钉钉来进行推送吗

添加Telegram Bot推送支持

代码

import telegram

def tgbot(text,msg):
    # Your Telegram Bot Token
    bot = telegram.Bot(token='123456:aaa-sdasdsa')
    group_id='Your Group ID'
    bot.send_message(chat_id=group_id,text='{}\r\n{}'.format(text,msg))

安装telegram bot

pip install python-telegram-bot

生成bot 获得群组或用户聊天ID

创建bot详情谷歌

获得ID

将bot加入群组后,发送几条消息。访问https://api.telegram.org/bot{TOKEN}/getUpdates

用户ID同理,

预览

image

telegram推送问题解决方法

RuntimeWarning: coroutine 'Bot.send_message' was never awaited
新版本python-telegram-bot调用Bot.send_message时使用了异步方式进行调用

为了避免这个问题大家安装python-telegram-bot时指定老版本安装就行了

pip install python-telegram-bot==13.15

使用钉钉报错

{'errcode': 310000, 'errmsg': 'sign not match, more: [https://ding-doc.dingtalk.com/doc#/serverapi2/qf2nxq]'}

[bug?]工具监控数据库时间粒度不够,导致推送异常

例子:
7月20日9:00 AM 更新commit ,数据库会推送并插入时间2022-07-20
7月20日10:00 PM 更新commit和release ,根据以下代码逻辑,判断push时间由于粒度不够而导致相等
image
导致出现下列情况,不会推送commit和release更新
image
简单来说,当天推送更新后,之后的一天内不管出现多次更新都不会进行推送
是不是应该再将时间细化一些?🤭

代码建议

项目代码判定是否翻译使用 if load_config()[4](536行), load_config() 函数返回的列表如 41 行会不足,会导致索引超出,可以修改索引为 -1

建议

建议关键字部分加上仓库描述

运行不了

File "github_cve_monitor.py", line 455, in
create_database()
File "github_cve_monitor.py", line 76, in create_database
print("\u521b\u5efacve\u76d1\u63a7\u8868\u5931\u8d25\uff01\u62a5\u9519\uff1a{}".format(e))
UnicodeEncodeError: 'latin-1' codec can't encode characters in position 0-1: ordinal not in range(256)

时区问题

北京时间会漏掉美国东部时间的内容,纽约时间会漏掉北京时间内容(美国7/2022/21&**7/2022/22)建议后一天内容也进行推送,就不会漏掉内容了

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.