14 Commits
Author SHA1 Message Date
arvindrai 7c02440a9d Update scripts/CVE_scanner_new.py 2025-12-02 05:00:06 +00:00
arvindrai 5444493997 Update scripts/cve_scanner_new1.py 2025-12-02 04:59:03 +00:00
arvindrai 9907dd8a54 Update scripts/IMPORTANT.txt 2025-12-02 04:58:27 +00:00
arvindrai a5e297ef82 Update old-scripts/CVSS_scores.py 2025-12-02 04:57:51 +00:00
arvindrai 68d03bab49 Update old-scripts/top_vulnerability_types.py 2025-12-02 04:57:23 +00:00
arvindrai 1d14560e29 Upload files to "old-scripts"
uploaded
2025-12-02 04:56:35 +00:00
arvindrai 5b3be73f35 Delete scripts/CVE_scanner.py 2025-12-02 04:54:43 +00:00
arvindrai 36b209e529 Delete scripts/CVSS_scores.py 2025-12-02 04:54:23 +00:00
arvindrai ddbf1c6999 Delete old_scripts 2025-12-02 04:52:31 +00:00
arvindrai 999e6d75af Upload files to "old-scripts"
removed
2025-12-02 04:52:24 +00:00
arvindrai 2d9bbc9044 Update scripts/CVSS_scores.py 2025-12-02 04:48:48 +00:00
arvindrai 72cf84dc2f Add old_scripts 2025-12-02 04:46:30 +00:00
arvindrai 8c77b3a1a8 Upload files to "scripts"
old
2025-12-02 04:44:06 +00:00
arvindrai 57c8367e2a Upload files to "scripts"
added the better one
2025-12-02 04:42:40 +00:00
7 changed files with 520474 additions and 138 deletions
@@ -1,40 +1,40 @@
import json
import matplotlib.pyplot as plt
# path to your vulnerability JSON file
json_path = "wordfence_vulnerabilities.json"
def load_cvss_scores(path):
"""Load JSON data and extract all CVSS scores into a list"""
with open(path, "r", encoding="utf-8") as f:
data = json.load(f)
scores = []
for entry in data:
# make sure cvss_score exists and is numeric
if "cvss_score" in entry and isinstance(entry["cvss_score"], (int, float)):
scores.append(entry["cvss_score"])
return scores
def plot_hist(scores):
"""Plot a histogram of CVSS scores"""
plt.figure(figsize=(8, 5))
plt.hist(scores, bins=10, edgecolor="black", color="skyblue")
plt.title("Distribution of CVSS Scores in Vulnerability Data")
plt.xlabel("CVSS Score")
plt.ylabel("Number of Vulnerabilities")
plt.grid(alpha=0.4)
plt.savefig("cvss_distribution.png")
plt.show()
if __name__ == "__main__":
scores = load_cvss_scores(json_path)
print(f"Loaded {len(scores)} CVSS scores.")
print("Sample:", scores[:10])
if scores:
plot_hist(scores)
else:
print("⚠️ No CVSS scores found in the JSON file.")
import json
import matplotlib.pyplot as plt
json_path = "wordfence_vulnerabilities.json"
def load_cvss_scores(path):
"""Load JSON data and extract all CVSS scores into a list"""
with open(path, "r", encoding="utf-8") as f:
data = json.load(f)
scores = []
for entry in data:
if "cvss_score" in entry and isinstance(entry["cvss_score"], (int, float)):
scores.append(entry["cvss_score"])
return scores
def plot_hist(scores):
"""Plot a histogram of CVSS scores"""
plt.figure(figsize=(8, 5))
plt.hist(scores, bins=10, edgecolor="black", color="skyblue")
plt.title("Distribution of CVSS Scores in Vulnerability Data")
plt.xlabel("CVSS Score")
plt.ylabel("Number of Vulnerabilities")
plt.grid(alpha=0.4)
plt.savefig("cvss_distribution.png")
plt.show()
if __name__ == "__main__":
scores = load_cvss_scores(json_path)
print(f"Loaded {len(scores)} CVSS scores.")
print("Sample:", scores[:10])
if scores:
plot_hist(scores)
else:
print("error")
+49
View File
@@ -0,0 +1,49 @@
#!/usr/bin/env python3
import json
from collections import Counter
import matplotlib.pyplot as plt
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("error")
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()
-96
View File
@@ -1,96 +0,0 @@
#!/usr/bin/env python3
import json
import csv
import os
from urllib.parse import urlparse
REL_PATH = "../"
LOCAL_PATH = REL_PATH + "wordfence_vulnerabilities.json"
RAW_URL = ""
bad_plugins = []
OUT_CSV = "matches.csv"
OUT_JSON = "matches.json"
def load_json_local(path):
with open(path, "r", encoding="utf-8") as f:
return json.load(f)
def load_json_from_url(url):
import requests
r = requests.get(url, timeout=30)
r.raise_for_status()
return r.json()
def main():
data = None
if os.path.exists(LOCAL_PATH):
print(f"Loading local file: {LOCAL_PATH}")
data = load_json_local(LOCAL_PATH)
elif RAW_URL:
print(f"Local file not found, downloading from: {RAW_URL}")
data = load_json_from_url(RAW_URL)
else:
raise SystemExit("Error: no local file and RAW_URL is empty.")
if isinstance(data, dict) and "vulnerabilities" in data:
entries = data["vulnerabilities"]
elif isinstance(data, list):
entries = data
else:
entries = []
if isinstance(data, dict):
for v in data.values():
if isinstance(v, list):
entries = v
break
bad_set = set(bad_plugins)
matches = []
for entry in entries:
try:
if entry.get("type") != "plugin":
continue
slug = entry.get("slug", "").strip()
if not slug:
continue
if slug in bad_set:
matches.append({
"slug": slug,
"title": entry.get("title"),
"cve": entry.get("cve"),
"severity": entry.get("severity"),
"cvss_score": entry.get("cvss_score"),
"cve_link": entry.get("cve_link"),
"raw": entry
})
except Exception:
continue
if not matches:
print("No matches found for the bad_plugins list.")
else:
print(f"Found {len(matches)} matches:")
for m in matches:
print(f"- {m['slug']} | CVE: {m.get('cve')} | sev: {m.get('severity')} | CVSS: {m.get('cvss_score')}")
print(f" link: {m.get('cve_link')}")
with open(OUT_CSV, "w", newline='', encoding="utf-8") as csvf:
writer = csv.DictWriter(csvf, fieldnames=["slug", "title", "cve", "severity", "cvss_score", "cve_link"])
writer.writeheader()
for m in matches:
writer.writerow({
"slug": m["slug"],
"title": m.get("title"),
"cve": m.get("cve"),
"severity": m.get("severity"),
"cvss_score": m.get("cvss_score"),
"cve_link": m.get("cve_link")
})
print(f"Saved CSV results to {OUT_CSV}")
with open(OUT_JSON, "w", encoding="utf-8") as jf:
json.dump(matches, jf, ensure_ascii=False, indent=2)
print(f"Saved JSON results to {OUT_JSON}")
if __name__ == "__main__":
main()
+1 -1
View File
@@ -3,7 +3,7 @@ import json
import os
# vars
JSON_FILE = "../wordfence_vulnerabilities.json"
JSON_FILE = "wordfence_vulnerabilities.json"
BAD_LIST = []
JSON_OUT = "matches.json"
+1 -1
View File
@@ -1,2 +1,2 @@
get_CVE.py **MUST** be ran before better_cve_scanner can be ran since it runs using a list that is fetched daily.
get_CVE.py **MUST** be ran before cve_scanner_new1 can be ran since it runs using a list that is fetched daily.
CVE_scanner.py runs on a static list called wordfence_vulnerabilities.json that is stored in the same directory, which is an old list of major vulnerabilities.
+77
View File
@@ -0,0 +1,77 @@
#!/usr/bin/env python3
import json
import os
JSON_FILE = "wordfence_CVE.json"
JSON_OUT = "malware.json"
BAD_PLUGINS = []
def load_file(path):
with open(path, "r", encoding="utf-8") as f:
return json.load(f)
def main():
if not os.path.exists(JSON_FILE):
print("json file not found:", JSON_FILE)
return
data = load_file(JSON_FILE)
bad_set = set()
for n in BAD_PLUGINS:
if isinstance(n, str):
n = n.strip()
if n:
bad_set.add(n)
hits = []
for key, item in data.items():
if not isinstance(item, dict):
continue
software_list = item.get("software") or []
for s in software_list:
if not isinstance(s, dict):
continue
if s.get("type") != "plugin":
continue
name = (s.get("name") or "").strip()
if name not in bad_set:
continue
affected = s.get("affected_versions") or {}
if not affected:
continue
refs = item.get("references") or []
ref = refs[0] if refs else None
hit = {
"id": item.get("id"),
"title": item.get("title"),
"name": name,
"slug": s.get("slug"),
"affected_versions": list(affected.keys()),
"link": ref,
"raw": item
}
hits.append(hit)
if not hits:
print("no matches found")
else:
print("found", len(hits), "matches")
for h in hits:
print("-", h["name"], "|", ", ".join(h["affected_versions"]))
with open(JSON_OUT, "w", encoding="utf-8") as f:
json.dump(hits, f, ensure_ascii=False, indent=2)
print("saved json to", JSON_OUT)
if __name__ == "__main__":
main()
File diff suppressed because it is too large Load Diff