How niranjan20061907/ai-threat-detection works
This repository currently provides a command-line nginx-log detector: users scan logs with signature rules or inspect per-request features. The runtime flow parses each line, scores valid requests, and displays findings; feature inspection parses a selected line and prints its measurements. Rule detection and feature extraction share attack signatures and User-Agent lists. The README also describes planned ML, behavioral, alerting, and service capabilities, but these are not implemented in the supplied tree, so they are not mapped as runtime components.
Main entry points: __main__.py Scan and inspect commands · rules.py Signature rule engine · extractor.py Request feature extractor · patterns.py Attack patterns and decoding
Components 10
CLI
- Scan and inspect commands
backend/app/__main__.py
Log ingestion
- Combined-log parser
backend/app/core/ingestion/parsers.py
Rule detection
- Signature rule engine
backend/app/core/detection/rules.py - Severity classifier
backend/app/core/detection/severity.py
Request features
- Attack patterns and decoding
backend/app/core/features/patterns.py - Client-agent signatures
backend/app/core/features/signatures.py - Request feature extractor
backend/app/core/features/extractor.py - Entropy statistics
backend/app/core/features/stats.py
Other components
- User
- nginx log file
Connections 11
- User → Scan and inspect commands: runs commands
README.md - nginx log file → Scan and inspect commands: supplies log
backend/app/__main__.py - Scan and inspect commands → Combined-log parser: parses lines
backend/app/__main__.py - Scan and inspect commands → Signature rule engine: scores entries
backend/app/__main__.py - Scan and inspect commands → Request feature extractor: extracts features
backend/app/__main__.py - Signature rule engine → Severity classifier: classifies score
backend/app/core/detection/rules.py - Signature rule engine → Attack patterns and decoding: matches patterns
backend/app/core/detection/rules.py - Signature rule engine → Client-agent signatures: matches agents
backend/app/core/detection/rules.py - Request feature extractor → Attack patterns and decoding: decodes and matches
backend/app/core/features/extractor.py - Request feature extractor → Client-agent signatures: checks agents
backend/app/core/features/extractor.py - Request feature extractor → Entropy statistics: calculates entropy
backend/app/core/features/extractor.py