if os.path.exists(db_file):
shutil.copy2(db_file, db_tmp_file)
- if update_db_file(db_tmp_file, d) == True:
+ if update_db_file(db_tmp_file, d):
# Update downloaded correctly, can swap files
shutil.move(db_tmp_file, db_file)
else:
"""
Update the given database file
"""
- import bb.utils, bb.progress
+ import bb.progress
+ import bb.utils
from datetime import date
- import urllib, gzip, sqlite3
+ import sqlite3
+ import urllib
YEAR_START = 2002
cve_socket_timeout = int(d.getVar("CVE_SOCKET_TIMEOUT"))
return False
if response:
- for l in response.read().decode("utf-8").splitlines():
- key, value = l.split(":", 1)
+ for line in response.read().decode("utf-8").splitlines():
+ key, value = line.split(":", 1)
if key == "lastModifiedDate":
last_modified = value
break
secondaries = [c for c in metric if c['type'] == "Secondary"]
if len(primaries) > 0:
return primaries[0]
- elif len(secondaries)>0:
+ elif len(secondaries) > 0:
return secondaries[0]
return None
root = json.loads(jsondata)
for elt in root['cve_items']:
- if not 'vulnStatus' in elt or elt['vulnStatus'] == 'Rejected':
+ if 'vulnStatus' not in elt or elt['vulnStatus'] == 'Rejected':
continue
- if not 'configurations' in elt:
+ if 'configurations' not in elt:
continue
accessVector = None