Yves Gugger 3485668b5e
Some checks failed
CI / Frontend Lint & Type Check (push) Has been cancelled
CI / Frontend Build (push) Has been cancelled
CI / Backend Lint (push) Has been cancelled
CI / Backend Tests (push) Has been cancelled
CI / Docker Build (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
Deploy / Build & Push Images (push) Has been cancelled
Deploy / Deploy to Server (push) Has been cancelled
Deploy / Notify (push) Has been cancelled
feat: add Alpha Terminal HUNT/CFO modules and Analyze framework
Adds HUNT (Sniper/Trend/Forge), CFO dashboard (burn rate + kill list), and a plugin-based Analyze side panel with caching and SSRF hardening.
2025-12-15 16:15:58 +01:00

57 lines
2.3 KiB
Python

from __future__ import annotations
from app.schemas.analyze import AnalyzeItem
from app.services.analyze.base import AnalyzerContribution, AnalyzeContext
class DomainFactsAnalyzer:
key = "domain_facts"
ttl_seconds = 60 * 60 * 12 # 12h (RDAP/WHOIS changes slowly)
async def analyze(self, ctx: AnalyzeContext) -> list[AnalyzerContribution]:
check = ctx.check
items = [
AnalyzeItem(
key="availability",
label="Availability",
value="available" if check.is_available else "taken",
status="pass" if check.is_available else "warn",
source=str(check.check_method or "internal"),
details={"status": str(check.status.value)},
),
AnalyzeItem(
key="created_at",
label="Creation Date",
value=check.creation_date.isoformat() if check.creation_date else None,
status="pass" if check.creation_date else "na",
source=str(check.check_method or "internal"),
details={"reason": None if check.creation_date else "Not provided by RDAP/WHOIS for this TLD."},
),
AnalyzeItem(
key="expires_at",
label="Expiry Date",
value=check.expiration_date.isoformat() if check.expiration_date else None,
status="pass" if check.expiration_date else "na",
source=str(check.check_method or "internal"),
details={"reason": None if check.expiration_date else "Not provided by RDAP/WHOIS for this TLD."},
),
AnalyzeItem(
key="registrar",
label="Registrar",
value=check.registrar,
status="info" if check.registrar else "na",
source=str(check.check_method or "internal"),
details={},
),
AnalyzeItem(
key="nameservers",
label="Nameservers",
value=check.name_servers or [],
status="info" if check.name_servers else "na",
source="dns",
details={},
),
]
return [AnalyzerContribution(quadrant="authority", items=items)]