This repository has been archived on 2026-09-11. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files

90 lines
2.1 KiB
Python

#!/usr/bin/env python3
import json
import os
# vars
JSON_FILE = "wordfence_vulnerabilities.json"
BAD_LIST = []
JSON_OUT = "matches.json"
def load_local(path):
with open(path, "r", encoding="utf-8") as f:
return json.load(f)
def get_entries(data):
# try to find the main list of vulnerabilities
if isinstance(data, dict):
if "vulnerabilities" in data:
return data["vulnerabilities"]
for value in data.values():
if isinstance(value, list):
return value
return []
elif isinstance(data, list):
return data
else:
return []
def main():
if os.path.exists(JSON_FILE):
print("Loading ...", JSON_FILE)
data = load_local(JSON_FILE)
else:
print("Error: JSON file not found:", JSON_FILE)
return
entries = get_entries(data)
bad_set = set(BAD_LIST)
hits = []
for item in entries:
if not isinstance(item, dict):
continue
if item.get("type") != "plugin":
continue
slug = (item.get("slug") or "").strip()
if not slug:
continue
if slug in bad_set:
hit = {
"slug": slug,
"title": item.get("title"),
"cve": item.get("cve"),
"severity": item.get("severity"),
"cvss_score": item.get("cvss_score"),
"cve_link": item.get("cve_link"),
"raw": item
}
hits.append(hit)
if not hits:
print("No matches at all")
else:
print("Found", len(hits), "matches:")
for h in hits:
print(
"-",
h["slug"],
"| CVE:", h.get("cve"),
"| sev:", h.get("severity"),
"| CVSS:", h.get("cvss_score")
)
print(" link:", h.get("cve_link"))
# save
with open(JSON_OUT, "w", encoding="utf-8") as f:
json.dump(hits, f, ensure_ascii=False, indent=2)
print("Saved to", JSON_OUT)
if __name__ == "__main__":
main()