Autonomous AI-Powered Purple Team Orchestration Platform
OpenElia is a next-generation cybersecurity operations library designed to handle multi-agent offensive and defensive operations. Powered by LLMs and the Model Context Protocol (MCP), it provides a secure, high-performance ecosystem for simulating realistic attacks and automating real-time defense.
Check COMMANDS.txt for COMPLETE COMMAND REFERENCE & MODEL CONFIGURATION GUIDE!
- Identity & Configuration: API keys stored in OS-native keystores (macOS Keychain, Linux Secret Service). Credentials at rest are Fernet AES-256 encrypted (
state/vault.bin). The encryption key never touches disk β stored exclusively in the OS keyring. - Double Firewall: Every tool call is validated by a Mathematical Firewall (scope/IP validation, fail-closed without
roe.json) and a Semantic Firewall (payload sanitization). SIEM webhooks use a strict hostname allowlist (SIEM_WEBHOOK_ALLOWLIST), not a blocklist. - Sterile Execution: Offensive modules run inside ephemeral, rootless Docker containers with
cap_drop=ALL. MSF commands are written to a signed temp resource file β never injected as CLI strings. Nmap targets and args are validated viaipaddressand metacharacter stripping before execution. - Immutable Auditing: Every audit event carries an HMAC-SHA256 chain link over the previous entry. Tampering with any entry breaks the chain. All sensitive files are written with
chmod 0o600. - Supply Chain Integrity: Hash-locked dependencies, automated SAST/Secret scanning, and a Software Bill of Materials (
python main.py sbom).
- π΄ Red Team (Pentester): Autonomous reconnaissance, vulnerability assessment, and exploitation using the Atomic Red Team library.
- π΅ Blue Team (Defender): Real-time log analysis, SIEM-style telemetry, and active remediation (block IP via iptables, kill process via SIGKILL). Operates in simulation mode by default; live execution enabled via
BLUE_REMEDIATE_LIVE=1with RBAC token verification. - π£ Purple Team (Simulation): Collaborative, iterative attack/defend loops (Continuous Chaos) for rapid security drills.
- πΊ War Room Dashboard: Live, real-time TUI with MITRE heatmap, findings, red/blue logs, and active pivot session panel.
- π§ Autonomic Self-Healing: Agents automatically detect tool errors, reflect on the cause, and issue corrected commands.
- π΅οΈ Stealth Mode (OPSEC): Randomized jitter and LotL techniques to evade detection.
- π Subnet Swarming: Launch parallel agent threads to scan and assess entire CIDR ranges simultaneously.
- βοΈ Risk/Success Engine: Real-time probabilistic modeling of exploit success and detection risk.
- π¨ Shadow Shell: Interactive human-AI tactical handoff for live session control.
- π Role-Based Access Control (RBAC): Hardware-backed identity verification and OS-level privilege enforcement.
- π Global Kill-Switch: A technical fail-safe that allow the operator to instantly pause or terminate all active agents.
- π‘ Strategic Message Bus: Enables real-time inter-agent communication and coordination.
- β‘ Elite Efficiency: Built-in Semantic Caching (ChromaDB) and Massive Output Auto-Compression to slash API costs and latency.
OpenElia/
βββ main.py # Main entry point for Python engine
βββ orchestrator.py # Core orchestration logic
βββ agents/ # AI agent implementations
β βββ base_agent.py # Base agent class
β βββ reporter_agent.py # Executive reporting, MITRE heatmap, chain of custody
β βββ blue/ # Defensive agents
β β βββ defender_ana.py # Tier 2 LLM-based triage
β β βββ defender_hunt.py # Proactive threat hunting
β β βββ defender_mon.py # Tier 1 Sigma/regex monitoring
β β βββ defender_os.py # Blue team orchestrator
β β βββ defender_res.py # Tier 4 containment & response
β βββ red/ # Offensive agents
β βββ pentester_os.py # Red team phase orchestrator
β βββ pentester_recon.py# Reconnaissance phase
β βββ pentester_vuln.py # Vulnerability assessment
β βββ pentester_exploit.py # Exploitation phase
β βββ pentester_lat.py # Lateral movement phase
β βββ pentester_ex.py # Exfiltration phase
βββ adversaries/ # Adversary emulation profiles
β βββ apt29.json # APT29 TTPs
β βββ fin7.json # FIN7 TTPs
βββ artifacts/ # Generated artifacts and evidence
βββ lab/ # Testing environment
β βββ docker-compose.yml # Lab setup
βββ mcp_servers/ # Model Context Protocol servers
β βββ atomic/ # Atomic Red Team integration
β βββ blue_remediate/ # Automated remediation
β βββ blue_telemetry/ # Telemetry collection
β βββ graph/ # Attack surface graph
β βββ memory/ # Long-term memory
β βββ pivot/ # Pivoting tools
β βββ red_recon/ # Reconnaissance
β βββ siem/ # SIEM integration
β βββ threat_intel/ # Threat intelligence
β βββ vault/ # Secure credential storage
βββ skills/ # Domain-specific skill modules
βββ src/ # TypeScript CLI (project root)
β βββ src/ # TypeScript source files
β β βββ cli.ts # CLI implementation
β β βββ index.ts # Entry point
β βββ dist/ # Compiled JavaScript output
β βββ package.json # Node.js dependencies
β βββ tsconfig.json # TypeScript config
βββ state/ # Persistent state and databases
βββ requirements.txt # Python dependencies
βββ pyproject.toml # Python project config
βββ roe.json # Rules of Engagement
βββ setup.sh & setup.ps1 # Installation scripts
βββ scrub.py # Data sanitization tool
- Docker (for sterile execution)
- Ollama (running locally with
llama3.1:8bor similar) - Python 3.11+
- Node.js 18+ (for TypeScript CLI)
Python Engine (Required):
# Clone the Repository
git clone https://github.com/M3tan01/OpenElia.git
cd OpenElia
# Create and activate a virtual environment (required on Debian/Ubuntu)
python3 -m venv .venv
source .venv/bin/activate # Linux/macOS
# .venv\Scripts\activate # Windows
# Install Python dependencies
pip install -r requirements.txt
# Or install as editable package
pip install -e .
# Or use setup scripts (also handles venv creation)
chmod +x setup.sh && ./setup.sh # Unix/macOS
# .\setup.ps1 # Windows
# Verify environment readiness
python3 main.py checkNote (Debian/Ubuntu): If
python3 -m venvfails with anensurepiperror, install the venv package first:sudo apt install python3.12-venvThen re-run the venv creation steps above.
Note: Always activate the virtual environment before running any
python3 main.pyorpip installcommands:source .venv/bin/activate
TypeScript CLI (Optional but Recommended):
# Install TypeScript CLI
cd src
npm install
npm run build
npm link # Make globally available as 'openelia-cli'Global Command (Optional):
pip install .
# Now you can use 'openelia' instead of 'python main.py'Spin up a standardized, vulnerable lab environment for immediate testing:
cd lab
docker-compose up -dEnsure your data is purged before pushing, or generate forensic artifacts:
# Purge all local state and artifacts
python3 scrub.py
# Package the entire engagement into a secure, hashed Case File
python3 main.py archive
# Note: On first run, a GUI prompt will ask you to set a password for the
# OS keyring ("Choose password for new keyring"). Enter and confirm a password,
# then click Continue. This keyring protects your API keys and vault encryption key.
# Leave the password blank only if you are in a headless/server environment.
# Generate Software Bill of Materials
python3 main.py sbomBefore running any command, activate the virtual environment:
source .venv/bin/activate
# Verify environment readiness
python3 main.py check
# Launch the interactive War Room TUI
python3 main.py dashboard
# Run a red team engagement (Single Target)
python3 main.py red --target 10.10.10.50 --stealth
# Run a parallel subnet swarm (CIDR Range) emulating APT29
python3 main.py red --target 10.10.10.0/29 --apt apt29
# Run a collaborative purple team loop (2 iterations)
python3 main.py purple --target 10.10.10.50 --iterations 2
# Generate executive report with MITRE heatmap and chain of custody
python3 main.py report
python3 main.py report --brain-tier expensive
# Execute an approved response action by its logged ID
python3 main.py execute-remediation --action-id 42# Interactive mode (recommended)
openelia-cli
# Direct commands
openelia-cli red --target 10.10.10.50 --stealth
openelia-cli blue --logs /var/log/auth.log
openelia-cli purple --target 10.10.10.50 --iterations 3
openelia-cli nmap --target 10.10.10.50
openelia-cli msf --target 10.10.10.50
openelia-cli report
openelia-cli report --task "Board-level summary" --brain-tier expensive
openelia-cli execute-remediation --action-id 42
openelia-cli check
openelia-cli status
openelia-cli dashboard
openelia-cli lock
openelia-cli unlock
openelia-cli archive
openelia-cli sbom
openelia-cli doctor
# Switch agents in interactive mode
openelia-cli interactive
> agent Pentester
> red --target 10.10.10.50# Switch to Pentester agent
/agent Pentester
# Generate a final report with MITRE ATT&CK coverage
/agent ReporterAll operations are governed by roe.json. The scope validator fails closed β if roe.json is missing or authorized_subnets is empty, every target is blocked.
{
"authorized_subnets": ["10.10.10.0/24"],
"blacklisted_ips": ["10.10.10.1", "10.10.10.254"]
}Remove
127.0.0.0/8fromauthorized_subnetsbefore any real engagement. It is included in the default config for local lab use only.
Outbound traffic is automatically redacted for PII by the Privacy Guard. All tool results are sanitized for prompt injection before re-entering the model context.
| Variable / File | Purpose | Effect if missing |
|---|---|---|
roe.json with authorized_subnets |
Defines legal target scope | All operations blocked |
SIEM_WEBHOOK_ALLOWLIST |
Comma-separated approved SIEM hostnames | All webhook forwarding blocked |
THEHIVE_URL |
TheHive instance base URL | TheHive case dispatch silently skipped |
THEHIVE_API_KEY |
TheHive API key | TheHive case dispatch silently skipped |
| OS Keyring secrets | API keys, vault encryption key | Prompted interactively on first run |
BLUE_REMEDIATE_LIVE |
Set to 1 to enable live iptables/kill execution |
Runs in safe simulation mode |
BLUE_REMEDIATE_RBAC_TOKEN |
RBAC token env var (must match keyring value) | Live remediation actions denied |
Set before running the SIEM MCP server:
export SIEM_WEBHOOK_ALLOWLIST="splunk.corp.com,siem.internal"Credentials stored via store_credential are automatically encrypted with Fernet AES-256. The key is generated on first use and stored in the OS keyring under VAULT_ENCRYPTION_KEY. If a legacy plaintext state/vault.json exists, it is migrated and deleted on first load.
Disclaimer: This tool is for authorized security testing and research purposes only.