Continued the Detection Quality roadmap.

This commit is contained in:
larssand
2026-06-24 21:32:18 +02:00
parent cdef3e1355
commit ea4aaf57ed
14 changed files with 258 additions and 8 deletions

25
src/fgai/detectors.py Normal file
View File

@@ -0,0 +1,25 @@
from __future__ import annotations
from .logs import THREAT_ACTIONS
from .models import LogEvent
DETECTOR_MINIMUMS = {
"auth_failure": 5,
"dns_query": 20,
"deny_action": 10,
}
def event_detector_categories(event: LogEvent) -> tuple[str, ...]:
fields = event.fields
action = event.action
event_id = fields.get("eventid", fields.get("event_id", fields.get("winlog_event_id", "")))
categories: list[str] = []
if action in {"fail", "failed", "failure", "login_failed", "logon_failed", "authentication_failed"} or event_id == "4625":
categories.append("auth_failure")
if fields.get("query_domain") or fields.get("qh") or fields.get("dns_query"):
categories.append("dns_query")
if action in THREAT_ACTIONS:
categories.append("deny_action")
return tuple(categories)