Snapshot: full project state

This commit is contained in:
2026-10-06 23:43:38 -07:00
commit 73d1640e25
9 changed files with 521 additions and 0 deletions

24
manifest_patch.py Normal file
View File

@@ -0,0 +1,24 @@
import json, hashlib, os
MAN = "/opt/threatmarket/archive/manifest.json"
def update_manifest(zip_path, domain, date, categories, finding_count):
"""Register a finished pack in the archive manifest so the web app lists it."""
h = hashlib.sha256(open(zip_path, "rb").read()).hexdigest()
man = json.load(open(MAN)) if os.path.exists(MAN) else []
pid = domain + "-" + date.replace("-", "")
if not any(m.get("pack_id") == pid for m in man):
man.append({
"pack_id": pid,
"domain": domain,
"date": date,
"categories": categories,
"finding_counts": {"total_findings": finding_count},
"size_bytes": os.path.getsize(zip_path),
"sha256": h,
"file": os.path.basename(zip_path),
})
tmp = MAN + ".tmp"
json.dump(man, open(tmp, "w"), indent=1)
os.replace(tmp, MAN)