How sakoleat-kh/threat-detection-platform works
This is a rule-based threat-detection platform. Its principal workflow reads Linux authentication and web access logs, parses and normalizes events, evaluates detection rules, enriches alerts with MITRE ATT&CK data, and persists alerts for REST API investigation. The graph also includes alert-query/statistics capabilities. The dashboard is documented, but no dashboard source appears in the supplied tree. Relationships are limited to those shown in excerpts, the source index, or README; unsampled implementation details are not inferred.
Main entry points: ingestion.py Ingestion service · main.py API application · engine.py Detection engine · alert_repository.py Alert repository
Components 24
Log processing
- Ingestion service
app/services/ingestion.py - Auth log reader
app/parsers/auth_log_reader.py - Linux parser
app/parsers/linux_parser.py - Access log reader
app/parsers/access_log_reader.py - Apache parser
app/parsers/apache_parser.py - Event normalizer
app/services/normalizer.py - Event models
app/models
Detection and enrichment
- Engine factory
app/services/detection_engine.py - Detection engine
app/detection/engine.py - Rule interface
app/detection/rule_base.py - Detection rules
app/detection/rules - Alert model
app/models/alert.py - MITRE mapping
app/mitre/mapping.py
Alert persistence
- Database config
app/models/database.py - Alert repository
app/repository/alert_repository.py - Alert record
app/models/db_alert.py - SQLite database
REST API
- API application
app/api/main.py - Ingestion endpoint
app/api/routers/ingest.py - Alert endpoints
app/api/routers/alerts.py - Statistics endpoint
app/api/routers/stats.py
Other components
- Log files
- API clients
- Web dashboard
Connections 31
- Log files → Ingestion service: provides logs
- Ingestion service → Auth log reader: reads auth logs
app/services/ingestion.py - Ingestion service → Access log reader: reads access logs
app/services/ingestion.py - Auth log reader → Linux parser: parses lines
app/parsers/auth_log_reader.py - Access log reader → Apache parser: parses lines
app/parsers/access_log_reader.py - Ingestion service → Event normalizer: normalizes events
app/services/ingestion.py - Auth log reader → Event models: yields auth events
app/parsers/auth_log_reader.py - Access log reader → Event models: yields access events
app/parsers/access_log_reader.py - Event normalizer → Event models: creates normalized events
app/services/normalizer.py - Engine factory → Detection engine: creates engine
app/services/detection_engine.py - Engine factory → Detection rules: registers rules
app/services/detection_engine.py - Detection engine → Rule interface: evaluates rules
app/detection/engine.py - Detection rules → Rule interface: implement interface
app/detection/rules/excessive_sudo.py - Ingestion service → Detection engine: runs detection
app/services/ingestion.py - Detection engine → MITRE mapping: enriches alerts
app/detection/engine.py - Detection engine → Alert model: collects alerts
app/detection/engine.py - Ingestion service → Database config: opens session
app/services/ingestion.py - Ingestion service → Alert repository: saves alerts
app/services/ingestion.py - Alert repository → Alert record: creates records
app/repository/alert_repository.py - Database config → SQLite database: configures SQLite
app/models/database.py - Alert repository → SQLite database: queries and writes
app/repository/alert_repository.py - API application → Database config: initializes database
app/api/main.py - API application → Ingestion endpoint: mounts routes
app/api/main.py - API application → Alert endpoints: mounts routes
app/api/main.py - API application → Statistics endpoint: mounts routes
app/api/main.py - Ingestion endpoint → Ingestion service: invokes ingestion
app/api/routers/ingest.py - Ingestion endpoint → Engine factory: builds engine
app/api/routers/ingest.py - Alert endpoints → Alert repository: queries alerts
app/api/routers/alerts.py - Statistics endpoint → Alert repository: requests statistics
app/api/routers/stats.py - API clients → API application: requests API
- API application → Web dashboard: serves API data