Spaces:
Running
Running
Download src/models/domain.py from reputeradar/ioc-core: direct link, hf CLI and curl.
- Browser
- Download file 3.54 kB
-
https://huggingface.co/spaces/reputeradar/ioc-core/resolve/main/src/models/domain.py
- Command line
-
hf download hf://spaces/reputeradar/ioc-core/src/models/domain.py
-
curl -L -o domain.py https://huggingface.co/spaces/reputeradar/ioc-core/resolve/main/src/models/domain.py
3.54 kB
| """Pydantic models for domain reputation analysis.""" | |
| from pydantic import BaseModel, Field | |
| class DomainResult(BaseModel): | |
| """Result model for domain reputation analysis with all VirusTotal fields.""" | |
| domain: str = Field(..., description="Domain name analyzed") | |
| # Detection statistics | |
| malicious_count: int | None = Field( | |
| None, description="Number of engines flagging as malicious", ge=0 | |
| ) | |
| suspicious_count: int | None = Field( | |
| None, description="Number of engines flagging as suspicious", ge=0 | |
| ) | |
| harmless_count: int | None = Field( | |
| None, description="Number of engines flagging as harmless", ge=0 | |
| ) | |
| undetected_count: int | None = Field( | |
| None, description="Number of engines with no detection", ge=0 | |
| ) | |
| total_engines: int | None = Field( | |
| None, description="Total number of engines that scanned", ge=0 | |
| ) | |
| timeout_count: int | None = Field( | |
| None, description="Number of engines that timed out", ge=0 | |
| ) | |
| # Reputation and categorization | |
| reputation_score: int | None = Field( | |
| None, description="VirusTotal reputation score" | |
| ) | |
| categories: str | None = Field( | |
| None, description="Domain categories (comma-separated)" | |
| ) | |
| tags: list[str] | None = Field(None, description="Tags associated with domain") | |
| # Registration information | |
| registrar: str | None = Field(None, description="Domain registrar") | |
| creation_date: str | None = Field( | |
| None, description="Domain creation date (ISO format)" | |
| ) | |
| last_update_date: str | None = Field( | |
| None, description="Last WHOIS update date (ISO format)" | |
| ) | |
| expiration_date: str | None = Field( | |
| None, description="Domain expiration date (ISO format)" | |
| ) | |
| # Analysis dates | |
| last_analysis_date: str | None = Field( | |
| None, description="Last VirusTotal analysis date (ISO format)" | |
| ) | |
| last_modification_date: str | None = Field( | |
| None, description="Last modification date (ISO format)" | |
| ) | |
| # DNS information | |
| last_dns_records: list[dict] | None = Field( | |
| None, description="Last known DNS records" | |
| ) | |
| # WHOIS | |
| whois: str | None = Field(None, description="Raw WHOIS data") | |
| # Popularity | |
| popularity_ranks: dict | None = Field( | |
| None, description="Popularity rankings (Alexa, Umbrella, etc.)" | |
| ) | |
| # Error | |
| error: str | None = Field(None, description="Error message if analysis failed") | |
| class Config: | |
| json_schema_extra = { | |
| "example": { | |
| "domain": "google.com", | |
| "malicious_count": 0, | |
| "suspicious_count": 0, | |
| "harmless_count": 70, | |
| "undetected_count": 15, | |
| "total_engines": 85, | |
| "timeout_count": 0, | |
| "reputation_score": 100, | |
| "categories": "search engines, technology", | |
| "tags": ["top-1m", "alexa-top-1000"], | |
| "registrar": "MarkMonitor Inc.", | |
| "creation_date": "1997-09-15T00:00:00Z", | |
| "last_update_date": "2019-09-09T00:00:00Z", | |
| "expiration_date": "2028-09-14T00:00:00Z", | |
| "last_analysis_date": "2026-01-10T12:00:00Z", | |
| "last_modification_date": None, | |
| "last_dns_records": [{"type": "A", "value": "142.250.185.46"}], | |
| "whois": None, | |
| "popularity_ranks": {"Alexa": 1, "Umbrella": 1}, | |
| "error": None, | |
| } | |
| } | |