feat: complete lab 7 grade 4 security controls and report

This commit is contained in:
Dmitrii Grishko
2026-11-15 21:58:27 +03:00
parent c5e3ac3aff
commit c69d735692
52 changed files with 1124 additions and 129 deletions
+15
View File
@@ -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())))