Pin dependencies; drop dead severity/quality-score code from review.py
requirements.txt (new) pins python-telegram-bot, feedparser, aiohttp, and beautifulsoup4 to their current stable versions — the repo had no lockfile or pinned deps at all, just a pip-install line in the README. validation/review.py still had a --severity filter and printed a quality_score that content_classifier.py stopped producing a while back (see "Remove severity and quality scoring, classifier is extraction-only"). Every record scored UNKNOWN/?, so the flag could never match anything. Removed; --category/--has/--today/--limit and the extracted-field printing are unchanged. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
+2
-19
@@ -5,7 +5,6 @@ Review validation results — pretty-prints results.jsonl with optional filters.
|
||||
Usage:
|
||||
python3 validation/review.py # all results
|
||||
python3 validation/review.py --category research # filter by category
|
||||
python3 validation/review.py --severity critical # filter by severity
|
||||
python3 validation/review.py --has cves # only articles with CVEs
|
||||
python3 validation/review.py --has malware # only articles with malware hits
|
||||
python3 validation/review.py --has actors # only articles with threat actors
|
||||
@@ -20,13 +19,10 @@ from datetime import datetime, timezone
|
||||
|
||||
RESULTS_FILE = Path(__file__).parent / "results.jsonl"
|
||||
|
||||
SEVERITY_ORDER = {"critical": 0, "high": 1, "medium": 2, "low": 3, "unknown": 4}
|
||||
|
||||
|
||||
def parse_args():
|
||||
p = argparse.ArgumentParser()
|
||||
p.add_argument("--category", help="Filter by category (news, malware, threat_intel, osint, research)")
|
||||
p.add_argument("--severity", help="Filter by severity (critical, high, medium, low)")
|
||||
p.add_argument("--has", choices=["cves", "malware", "actors"], help="Only show articles with these detections")
|
||||
p.add_argument("--today", action="store_true", help="Only show results from today")
|
||||
p.add_argument("--limit", type=int, default=0, help="Max articles to show (0 = all)")
|
||||
@@ -55,8 +51,6 @@ def load_results(args):
|
||||
continue
|
||||
if args.category and r.get("category") != args.category:
|
||||
continue
|
||||
if args.severity and r.get("severity") != args.severity:
|
||||
continue
|
||||
if args.has == "cves" and not r.get("cves"):
|
||||
continue
|
||||
if args.has == "malware" and not r.get("malware_families"):
|
||||
@@ -66,18 +60,13 @@ def load_results(args):
|
||||
|
||||
records.append(r)
|
||||
|
||||
records.sort(key=lambda x: SEVERITY_ORDER.get(x.get("severity", "unknown"), 4))
|
||||
return records
|
||||
|
||||
|
||||
def print_record(r):
|
||||
sev = r.get("severity", "unknown").upper()
|
||||
sev_icons = {"CRITICAL": "🚨", "HIGH": "🔴", "MEDIUM": "🟠", "LOW": "🟡"}
|
||||
icon = sev_icons.get(sev, "⚪")
|
||||
|
||||
print(f"\n{'─' * 80}")
|
||||
print(f"{icon} [{r.get('category', '?').upper()}] {r.get('title', 'No title')}")
|
||||
print(f" 📡 {r.get('source')} · {r.get('published')} · Score: {r.get('quality_score', '?')}/100")
|
||||
print(f"[{r.get('category', '?').upper()}] {r.get('title', 'No title')}")
|
||||
print(f" 📡 {r.get('source')} · {r.get('published')}")
|
||||
|
||||
if r.get("cves"):
|
||||
print(f" 🆔 {', '.join(r['cves'])}")
|
||||
@@ -104,13 +93,7 @@ def main():
|
||||
records = records[:args.limit]
|
||||
|
||||
total = len(records)
|
||||
sev_counts = {}
|
||||
for r in records:
|
||||
s = r.get("severity", "unknown")
|
||||
sev_counts[s] = sev_counts.get(s, 0) + 1
|
||||
|
||||
print(f"\n=== Validation Results ({total} articles) ===")
|
||||
print(" " + " ".join(f"{s.upper()}: {c}" for s, c in sorted(sev_counts.items(), key=lambda x: SEVERITY_ORDER.get(x[0], 4))))
|
||||
|
||||
for r in records:
|
||||
print_record(r)
|
||||
|
||||
Reference in New Issue
Block a user