From 1d14560e29d43e8cb5c59ff83a4e67cd85359932 Mon Sep 17 00:00:00 2001 From: arvindrai Date: Tue, 2 Dec 2025 04:56:35 +0000 Subject: [PATCH] Upload files to "old-scripts" uploaded --- old-scripts/top_vulnerability_types.py | 49 ++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 old-scripts/top_vulnerability_types.py diff --git a/old-scripts/top_vulnerability_types.py b/old-scripts/top_vulnerability_types.py new file mode 100644 index 0000000..1d9eaf8 --- /dev/null +++ b/old-scripts/top_vulnerability_types.py @@ -0,0 +1,49 @@ +#!/usr/bin/env python3 +import json +from collections import Counter +import matplotlib.pyplot as plt + +# Path to your JSON file +path = "wordfence_vulnerabilities.json" + +# Load JSON data +with open(path, "r", encoding="utf-8") as f: + data = json.load(f) + +vuln_types = [] + +for entry in data: + title = entry.get("title") + if not isinstance(title, str): + continue + + # Split on the first dash (" - ") and take the right-hand side + if " - " in title: + vuln = title.split(" - ", 1)[1].strip() + vuln_types.append(vuln) + +# Count occurrences +counts = Counter(vuln_types) +top25 = counts.most_common(25) +total = sum(counts.values()) + +if not vuln_types: + print("⚠️ No vulnerability types found — check dash formatting.") + exit() + +# Print table of top 25 +print("\nTop 25 Vulnerability Types:\n") +for name, count in top25: + rel = (count / total) * 100 + print(f"{name:60} {count:5d} ({rel:5.2f}%)") + +# Visualization +labels, values = zip(*top25) +plt.figure(figsize=(10, 6)) +plt.barh(labels[::-1], values[::-1], color="cornflowerblue") +plt.title("Top 25 Most Common Vulnerability Types") +plt.xlabel("Count") +plt.ylabel("Vulnerability Type") +plt.tight_layout() +plt.show() +