|
@@ -24,6 +24,7 @@ import json
|
|
|
import sys
|
|
|
import cve as cvecheck
|
|
|
|
|
|
+
|
|
|
class Package:
|
|
|
def __init__(self, name, version, ignored_cves):
|
|
|
self.name = name
|
|
@@ -31,6 +32,7 @@ class Package:
|
|
|
self.cves = list()
|
|
|
self.ignored_cves = ignored_cves
|
|
|
|
|
|
+
|
|
|
def check_package_cves(nvd_path, packages):
|
|
|
if not os.path.isdir(nvd_path):
|
|
|
os.makedirs(nvd_path)
|
|
@@ -41,6 +43,7 @@ def check_package_cves(nvd_path, packages):
|
|
|
if pkg and cve.affects(pkg.name, pkg.version, pkg.ignored_cves) == cve.CVE_AFFECTS:
|
|
|
pkg.cves.append(cve.identifier)
|
|
|
|
|
|
+
|
|
|
html_header = """
|
|
|
<head>
|
|
|
<script src=\"https://www.kryogenix.org/code/browser/sorttable/sorttable.js\"></script>
|
|
@@ -140,7 +143,7 @@ def dump_json(packages, date, output):
|
|
|
"cves": pkg.cves,
|
|
|
} for pkg in packages
|
|
|
}
|
|
|
- # The actual structure to dump, add date to it
|
|
|
+ # The actual structure to dump, add date to it
|
|
|
final = {'packages': pkgs,
|
|
|
'date': str(date)}
|
|
|
with open(output, 'w') as f:
|
|
@@ -160,7 +163,7 @@ def parse_args():
|
|
|
output.add_argument('--json', dest='json', type=resolvepath,
|
|
|
help='JSON output file')
|
|
|
parser.add_argument('--nvd-path', dest='nvd_path',
|
|
|
- help='Path to the local NVD database',type=resolvepath,
|
|
|
+ help='Path to the local NVD database', type=resolvepath,
|
|
|
required=True)
|
|
|
args = parser.parse_args()
|
|
|
if not args.html and not args.json:
|
|
@@ -189,4 +192,5 @@ def __main__():
|
|
|
print("Write JSON")
|
|
|
dump_json(packages, date, args.json)
|
|
|
|
|
|
+
|
|
|
__main__()
|