It is often helpful to know how many CVEs are open against a given recipe.
Add a summary table of this to the end of the CVE listing.

Signed-off-by: Richard Purdie <richard.pur...@linuxfoundation.org>
---
 scripts/cve-report.py | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/scripts/cve-report.py b/scripts/cve-report.py
index 7a95668..203ea6d 100755
--- a/scripts/cve-report.py
+++ b/scripts/cve-report.py
@@ -12,6 +12,7 @@ with open(jsonfile) as f:
     cvedata = json.load(f)
 
 cves = dict()
+recipe_counts = {}
 
 for recipe in cvedata['package']:
     if recipe['name'] in ignored_recipes:
@@ -28,3 +29,16 @@ for recipe in cvedata['package']:
 print("Found %d unpatched CVEs" % len(cves))
 for cve in sorted(cves.keys()):
     print("%s: %s https://web.nvd.nist.gov/view/vuln/detail?vulnId=%s *" % 
(cve, cves[cve], cve))
+
+for cve in cves:
+    recipename = cves[cve]
+    if recipename in recipe_counts:
+        recipe_counts[recipename] += 1
+    else:
+        recipe_counts[recipename] = 1
+
+
+print("\n")
+print("Summary of CVE counts by recipes:\n")
+for recipe, count in sorted(recipe_counts.items(), key=lambda x: x[1], 
reverse=True):
+    print("  %s: %s" % (recipe, count))
-- 
2.40.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#62243): https://lists.yoctoproject.org/g/yocto/message/62243
Mute This Topic: https://lists.yoctoproject.org/mt/103910282/21656
Group Owner: yocto+ow...@lists.yoctoproject.org
Unsubscribe: 
https://lists.yoctoproject.org/g/yocto/leave/6691583/21656/737036229/xyzzy 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to