Spaces:
Running
Running
Download src/models/threat_context.py from reputeradar/ioc-core: direct link, hf CLI and curl.
- Browser
- Download file 2.48 kB
-
https://huggingface.co/spaces/reputeradar/ioc-core/resolve/main/src/models/threat_context.py
- Command line
-
hf download hf://spaces/reputeradar/ioc-core/src/models/threat_context.py
-
curl -L -o threat_context.py https://huggingface.co/spaces/reputeradar/ioc-core/resolve/main/src/models/threat_context.py
2.48 kB
| """Threat context and MSSP summary models.""" | |
| from pydantic import BaseModel | |
| class ThreatContext(BaseModel): | |
| """ | |
| Rich threat context aggregated from all intelligence sources. | |
| This provides APT attribution, campaign linkage, and MITRE ATT&CK mapping | |
| for MSSP-grade reporting. | |
| """ | |
| # Threat Actor Attribution | |
| threat_actors: list[str] = [] # e.g., ["APT28", "Lazarus Group"] | |
| campaigns: list[str] = [] # e.g., ["SolarWinds", "Operation Aurora"] | |
| # Malware Intelligence | |
| malware_families: list[str] = [] # e.g., ["Emotet", "TrickBot", "Cobalt Strike"] | |
| malware_aliases: list[str] = [] # Alternative names for malware | |
| # MITRE ATT&CK Framework | |
| mitre_tactics: list[str] = [] # e.g., ["Initial Access", "Execution"] | |
| mitre_techniques: list[str] = [] # e.g., ["T1566", "T1059.001"] | |
| # Raw Tags (for transparency) | |
| tags: list[str] = [] # All raw tags from sources | |
| # Temporal Data | |
| first_seen: str | None = None | |
| last_seen: str | None = None | |
| # Confidence Assessment | |
| confidence: str = "unknown" # "high", "medium", "low", "unknown" | |
| # Source Attribution | |
| sources_contributing: list[str] = [] # Which sources provided this context | |
| class MSSPSummaryRow(BaseModel): | |
| """ | |
| Single row in the MSSP executive summary table. | |
| Designed for direct export to customer reports. | |
| """ | |
| # IOC Identification | |
| ioc: str | |
| ioc_type: str # "ip", "domain", "url", "hash" | |
| # Verdict & Risk | |
| verdict: str # "MALICIOUS", "SUSPICIOUS", "UNKNOWN", "CLEAN" | |
| risk_level: str # "๐ด CRITICAL", "๐ HIGH", "๐ก MEDIUM", "๐ข LOW" | |
| risk_score: int # 0-100 | |
| # Attribution (top result only for table brevity) | |
| threat_actor: str | None = None # Primary threat actor if known | |
| malware_family: str | None = None # Primary malware family if known | |
| # MITRE ATT&CK | |
| mitre_techniques: list[str] = [] # Up to 5 techniques | |
| # Temporal | |
| first_seen: str | None = None | |
| last_seen: str | None = None | |
| # Detection Sources | |
| sources_detected: list[str] = [] # e.g., ["VirusTotal", "ThreatFox"] | |
| detection_count: int = 0 # Number of sources with positive detection | |
| # Actionable Output | |
| recommended_action: str = "Monitor" # Primary recommendation | |
| # Context Confidence | |
| confidence: str = "unknown" | |