findcve.py 文件源码

python
阅读 26 收藏 0 点赞 0 评论 0

项目:findcve 作者: garethr 项目源码 文件源码
def load_vulnerability_database():
    # Currently manually downloaded from
    # https://security-tracker.debian.org/tracker/data/json
    # Should instead download if not found in option localtion
    # or redownload if found but out of date
    # progress bar for download

    url = "https://security-tracker.debian.org/tracker/data/json"
    db = Path('debian.json')
    r = requests.get(url, stream=True)
    if not db.exists():
        with open(db.name, 'wb') as data_file:
            total_length = 1024*20722
            for chunk in progress.bar(r.iter_content(chunk_size=1024), label="Downloading Debian data", expected_size=(total_length/1024) + 1): 
                if chunk:
                    data_file.write(chunk)
                    data_file.flush()
    with open(db.name, 'r') as data_file:
        return json.load(data_file)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号