From 57c8367e2a174790c50c8e124fe449591543da73 Mon Sep 17 00:00:00 2001 From: arvindrai Date: Tue, 2 Dec 2025 04:42:40 +0000 Subject: [PATCH] Upload files to "scripts" added the better one --- scripts/cve_scanner_new1.py | 77 +++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 scripts/cve_scanner_new1.py diff --git a/scripts/cve_scanner_new1.py b/scripts/cve_scanner_new1.py new file mode 100644 index 0000000..1ee9111 --- /dev/null +++ b/scripts/cve_scanner_new1.py @@ -0,0 +1,77 @@ +#!/usr/bin/env python3 +import json +import os + +JSON_FILE = "wordfence_vulnerabilities.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()