Upload files to "old-scripts"

uploaded
This commit is contained in:
2025-12-02 04:56:35 +00:00
parent 5b3be73f35
commit 1d14560e29
+49
View File
@@ -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()