|
@@ -25,6 +25,7 @@ import re
|
|
import subprocess
|
|
import subprocess
|
|
import requests # URL checking
|
|
import requests # URL checking
|
|
import json
|
|
import json
|
|
|
|
+import ijson
|
|
import certifi
|
|
import certifi
|
|
import distutils.version
|
|
import distutils.version
|
|
import time
|
|
import time
|
|
@@ -231,11 +232,11 @@ class CVE:
|
|
for year in range(NVD_START_YEAR, datetime.datetime.now().year + 1):
|
|
for year in range(NVD_START_YEAR, datetime.datetime.now().year + 1):
|
|
filename = CVE.download_nvd_year(nvd_dir, year)
|
|
filename = CVE.download_nvd_year(nvd_dir, year)
|
|
try:
|
|
try:
|
|
- content = json.load(gzip.GzipFile(filename))
|
|
|
|
|
|
+ content = ijson.items(gzip.GzipFile(filename), 'CVE_Items.item')
|
|
except:
|
|
except:
|
|
print("ERROR: cannot read %s. Please remove the file then rerun this script" % filename)
|
|
print("ERROR: cannot read %s. Please remove the file then rerun this script" % filename)
|
|
raise
|
|
raise
|
|
- for cve in content["CVE_Items"]:
|
|
|
|
|
|
+ for cve in content:
|
|
yield cls(cve['cve'])
|
|
yield cls(cve['cve'])
|
|
|
|
|
|
def each_product(self):
|
|
def each_product(self):
|