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)
评论列表
文章目录