EDR-BETA is a production-grade, hybrid EDR platform combining a lightweight Rust daemon on each monitored host with a scalable Python/FastAPI cloud backend for centralized threat intelligence, ML-based malware scoring, YARA signature scanning, and Docker-isolated sandbox detonation.
📄 Full developer documentation with Mermaid flow diagrams:
DOCS.md
- YARA Scanning — Offline, zero-latency detection via
libyaraFFI. Rules compiled at startup; scanning offloaded tospawn_blockingso the Tokio event loop stays non-blocking. - Atomic Quarantine —
quarantine_safe.rsperforms atomic rename (with cross-device copy-verify fallback), strips execute bits, writes a.meta.jsonsidecar, and appends a structured audit log. - eBPF Kernel Monitoring — Optional
sys_enter_execveinterception via the Aya crate; falls back to inotify if unavailable. - Async Event Loop — Built on Tokio +
notifyfor real-time file drop interception. - Offline Resilience — LRU verdict cache + JSONL offline queue keeps the daemon operational when the backend is unreachable.
- AV Management API — Three new routers:
/av/scans,/av/quarantine,/av/signatures(see API Reference). - Microservices Pipeline — Decoupled analysis via RabbitMQ: Static → ML → Sandbox worker chain.
- ML Static Analysis — Extracts PE/ELF attributes (entropy, imports, strings) via LIEF; evaluated by a Scikit-Learn
RandomForestmodel. - Dynamic Sandbox — Ambiguous files routed to an isolated Docker container (
deadsec/sandbox, network=none, cap_drop=ALL) withstraceheuristics. - Redis Caching — 24h SHA-256 → verdict cache; also powers SlowAPI rate limiting.
- PostgreSQL — Dual schema: SQLAlchemy ORM tables (reputation, static/dynamic features) + asyncpg native AV suite tables (scan events, quarantine records, audit log).
- 7 ClamAV-compatible YARA rules covering EICAR, PowerShell droppers, bash reverse shells, polyglot loaders, XOR shellcode stubs, XMRig coinminers, and ransomware shadow copy deletion.
[ Endpoint Host (Linux) ]
┌─────────────────────────────────────────────────────────────┐
│ inotify / eBPF → av-daemon (Rust/Tokio) │
│ │ │
│ ┌─────────────┴──────────────┐ │
│ ▼ ▼ │
│ YARA Engine LRU Verdict Cache │
│ signatures.yar (2048 entries) │
│ │ │ │
│ ▼ hit ▼ miss │
│ quarantine_safe.rs api_client (HTTPS) │
│ atomic rename + audit → backend lookup / upload │
└─────────────────────────────────────────────────────────────┘
│ HTTPS
▼
[ Cloud Backend ]
┌─────────────────────────────────────────────────────────────┐
│ FastAPI Gateway :8000 │
│ ├── /api/v1 (Agent API — upload / hash / report) │
│ ├── /av (AV Mgmt — scans / quarantine / signatures) │
│ └── /dashboard (Stats + paginated reputation) │
│ │
│ RabbitMQ Task Broker │
│ ├── static-analysis-queue → static_worker (LIEF) │
│ ├── ml-inference-queue → ml_worker (RandomForest) │
│ └── sandbox-queue → sandbox_worker (Docker/strace)│
│ │
│ PostgreSQL :5432 · Redis :6379 │
└─────────────────────────────────────────────────────────────┘
See
DOCS.md §4for full Mermaid flow diagrams of every pipeline stage.
| Tool | Version |
|---|---|
| Docker Engine | 24+ |
| Docker Compose | v2 |
| Rust (stable) | 1.75+ |
| libyara-dev | 4.x |
| Python | 3.11+ |
git clone https://github.com/noble6/EDR-BETA
cd EDR-BETA
# Build the sandbox image first
cd sandbox && docker build -t deadsec/sandbox:latest . && cd ..
# Launch all services
docker compose --env-file .env up -d --buildAccess the dashboard at: http://localhost:8000/dashboard
cd backend
DATABASE_URL=postgresql+psycopg2://threatuser:threatpass@localhost:5432/threatdb \
alembic upgrade headcd models
pip install scikit-learn pandas joblib
python train.py
# → models/saved_models/rf_malware_model.pklcd agent
# Edit config.json: set api_url, api_key, monitor_dir, signatures_path
cargo build --release
./target/release/hybrid-edr-agentOr install as a systemd service:
sudo cp systemd/antivirus.service /etc/systemd/system/
sudo systemctl daemon-reload && sudo systemctl enable --now antivirusEDR-BETA/
├── agent/ # Rust EDR daemon (Tokio, YARA, inotify, eBPF)
├── backend/ # FastAPI backend + workers + routers
│ ├── api/ # Agent API routes
│ ├── routers/ # AV management: scans, quarantine, signatures
│ ├── workers/ # RabbitMQ consumers (static, ML, sandbox)
│ ├── services/ # static_analyzer, ml_inference, reputation
│ └── database/ # asyncpg schema (6 AV tables)
├── signatures/ # YARA rules (7 ClamAV-compatible)
├── models/ # RandomForest training script
├── sandbox/ # Docker sandbox image + strace runner
├── frontend/ # Single-page dashboard (HTML/JS)
├── systemd/ # Hardened systemd unit file
├── tests/ # YARA corpus + pytest rules
├── DOCS.md # Full developer documentation + Mermaid diagrams
└── docker-compose.yml
See DOCS.md §12 for the full list. Top priorities:
- AES-256 quarantine encryption —
quarantine_safe.rshas a// TODOmarker; files are currently protected by path + stripped execute bits only. - Real S3/MinIO —
static_worker.pymocks object storage via/tmp/object-store/. - mTLS — Daemon↔backend currently uses plain HTTPS. mTLS is required for production.
- CORS —
allow_origins=["*"]must be restricted to the dashboard domain. - No CI/CD — No GitHub Actions or Makefile exists yet.
Licensed under the GNU General Public License v3.0 (GPLv3).
You are free to use, modify, and distribute this software. Any distribution of modified versions must also be released under GPLv3. See LICENSE for full details.