Add TLS reports capabilities
This commit is contained in:
+4
-2
@@ -5,7 +5,7 @@ from datetime import date, datetime, timedelta, timezone
|
||||
from sqlalchemy import func, select
|
||||
from sqlalchemy.orm import Session
|
||||
|
||||
from app.models import Alert, DailyStat, InboxStatus, LLMReport, Record, Report
|
||||
from app.models import Alert, DailyStat, InboxStatus, LLMReport, Record, Report, TLSReport
|
||||
|
||||
|
||||
def _pct(pass_count: int, total: int) -> str:
|
||||
@@ -110,7 +110,9 @@ def homepage_summary(
|
||||
date_to: str | None = None,
|
||||
) -> dict:
|
||||
start, end, scope_label = resolve_date_range(session, period=period, domain=domain, date_from=date_from, date_to=date_to)
|
||||
domains = session.scalar(select(func.count(func.distinct(Report.domain)))) or 0
|
||||
dmarc_domains = set(session.execute(select(Report.domain).distinct()).scalars().all())
|
||||
tls_domains = set(session.execute(select(TLSReport.domain).distinct()).scalars().all())
|
||||
domains = len(dmarc_domains | tls_domains)
|
||||
reports_stmt = select(func.count(Report.id))
|
||||
records_stmt = select(Record).join(Report)
|
||||
unknown_stmt = select(func.count(func.distinct(Record.source_ip))).join(Report).where(Record.is_known_sender.is_(False))
|
||||
|
||||
Reference in New Issue
Block a user