feat: complete lab 7 grade 4 security controls and report
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
"""Print a compact inventory from raw Trivy JSON."""
|
||||
import collections
|
||||
import json
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
for path in sorted(Path(sys.argv[1]).glob("*.json")):
|
||||
report = json.loads(path.read_text())
|
||||
matches = {}
|
||||
for target in report.get("Results", []):
|
||||
for entry in target.get("Vulnerabilities") or []:
|
||||
key = entry["VulnerabilityID"], entry["PkgName"], entry["InstalledVersion"]
|
||||
matches[key] = entry
|
||||
counts = collections.Counter(entry["Severity"] for entry in matches.values())
|
||||
print(path.name, dict(sorted(counts.items())))
|
||||
Reference in New Issue
Block a user