Comprehensive documentation for SONAR (SIEM-Oriented Neural Anomaly Recognition) - the scenario-based anomaly detection system for IDPS-ESCAPE.
β οΈ All commands should be run from project root (
/home/alab/soar)
π» For Python API reference: See sonar/README.md for developer quickstart and programmatic usage examples.
| Document | Purpose | Audience |
|---|---|---|
| setup-guide.md | Installation, configuration, CLI usage, debug mode | Everyone |
| scenario-guide.md | Complete scenario system guide with examples | Users & Developers |
| data-injection-guide.md | Inject synthetic data for fast testing | Testers & Developers |
| data-shipping-guide.md | Ship anomalies to Wazuh data streams (production feature) | Operators & DevOps |
| model-naming-guide.md | Model naming and versioning strategies | Users & Developers |
| troubleshooting.md | Error solutions and diagnostics | Everyone |
| architecture.md | System design, patterns, and principles | Developers & Architects |
| uml-diagrams.md | Visual system design diagrams | Developers & Architects |
# 1. Install (from project root)
cd /home/alab/soar
poetry install --with sonar
# 2. Run a scenario (from project root)
poetry run sonar scenario --use-case sonar/scenarios/brute_force_detection.yaml --debug
Read: setup-guide.md
sonar/scenarios/ (from project root):
brute_force_detection.yaml - SSH/authentication attackslateral_movement_detection.yaml - Network traversal attacksprivilege_escalation_detection.yaml - Privilege abuselinux_resource_monitoring.yaml - Resource utilization anomaliesCheck troubleshooting.md for:
For developers extending the system:
../ with architecture context| Task | Document | Section |
|---|---|---|
| Install SONAR | setup-guide.md | Installation |
| Configure Wazuh connection | setup-guide.md | Configuration |
| Run first scenario | scenario-guide.md | Overview β Example |
| Test with synthetic data | data-injection-guide.md | Quick start |
| Enable data shipping (production) | data-shipping-guide.md | Quick start |
| Integrate with RADAR | data-shipping-guide.md | Integration with RADAR |
| View system diagrams | uml-diagrams.md | All diagrams |
SONAR uses YAML scenarios to define anomaly detection workflows:
name: "Brute Force Detection"
training:
lookback_hours: 168 # 1 week baseline
numeric_fields: ["rule.level"]
detection:
mode: "batch"
threshold: 0.7
See scenario-guide.md for complete details.
Scenarios automatically execute based on sections present:
Test without Wazuh infrastructure:
poetry run sonar scenario --use-case scenario.yaml --debug
Uses local JSON test data for development and CI/CD.
See setup-guide.md
sonar/default_config.yaml): Infrastructure (Wazuh connection, paths)sonar/scenarios/*.yaml): Detection logic (features, thresholds)See setup-guide.md
Conceptual view (high-level components):
CLI Commands (train, detect, scenario, check)
β
Configuration (YAML β Python dataclasses)
β
Data Ingestion (WazuhIndexerClient | LocalDataProvider)
β
Feature Engineering (WazuhFeatureBuilder)
β
ML Engine (MVADModelEngine - Microsoft MVAD)
β
Post-processing (MVADPostProcessor)
β
Storage (Wazuh Indexer / OpenSearch)
Details: architecture.md
| Scenario | Use Case | File (from project root) |
|---|---|---|
| Brute Force Detection | Authentication attacks | sonar/scenarios/brute_force_detection.yaml |
| Lateral Movement | Cross-host authentication | sonar/scenarios/lateral_movement_detection.yaml |
| Privilege Escalation | Unusual sudo/su usage | sonar/scenarios/privilege_escalation_detection.yaml |
| Resource Monitoring | CPU/memory anomalies | sonar/scenarios/linux_resource_monitoring.yaml |
# All tests
poetry run pytest tests/
# Specific component
poetry run pytest tests/engine_test.py
# With coverage
poetry run pytest --cov=sonar
Test files in ../../tests/
wazuh-alerts-* indiceswazuh-anomalies-mvadSONAR anomalies trigger RADAR automated responses:
Details: setup-guide.md
Relative to project root (/home/alab/soar/):
sonar/
βββ README.md # SONAR overview
βββ scenarios/ # Built-in detection scenarios
β βββ brute_force_detection.yaml
β βββ lateral_movement_detection.yaml
β βββ privilege_escalation_detection.yaml
β βββ linux_resource_monitoring.yaml
βββ test_data/ # Test datasets for debug mode
β βββ synthetic_alerts/
β βββ generated_scenarios/
β βββ resource_monitoring/
βββ models/ # Trained model storage
βββ cli.py # Command-line interface
βββ config.py # Configuration system
βββ scenario.py # Scenario loader
βββ engine.py # MVAD model wrapper
βββ features.py # Feature engineering
βββ pipeline.py # Post-processing
βββ wazuh_client.py # Wazuh API client
βββ local_data_provider.py # Debug mode data provider
When extending SONAR:
setup-guide.md, not Setup-Guide.md[file](./file.md)All documentation in this folder follows these standards:
[File.md](./File.md)[file.md](../file.md)[file.md](../../../file.md)# From project root (/home/alab/soar)
poetry run pytest tests/sonartests/ -v
# From project root (/home/alab/soar)
poetry run sonar scenario --use-case sonar/scenarios/brute_force_detection.yaml
# From project root (/home/alab/soar)
cat docs/manual/sonar_docs/setup-guide.md
cat docs/manual/sonar_docs/scenario-guide.md
cat docs/manual/sonar_docs/architecture.md
For help with specific topics: