A lightweight, extensible SOAR-like incident response automation engine designed for SecOps and SOC engineering.
Features β’ Architecture β’ Tech Stack β’ Quickstart β’ API Docs β’ Playbooks
IRIS is an automated Incident Response (SOAR) engine that ingests security incident tickets (JSON), executes step-by-step security playbooks, enriches IOCs with mock threat intelligence, simulates containment actions, and compiles a comprehensive audit timeline and evidence package.
Built with modern Python, FastAPI, SQLAlchemy 2.0, and Pydantic v2, this project provides a production-style foundation for security automation, backend engineering, and incident response orchestration.
- π Playbook-Driven Automation: Define response logic in declarative YAML with conditional branching and templating.
- π‘οΈ Standardized Incident Schema: Strongly typed Pydantic models for incident payloads, observables, and artifacts.
- π Threat Intel Enrichment (Mocked): Automated lookups for VirusTotal hashes, IP reputation, malicious URLs, and GeoIP.
- β‘ Containment Simulation: Host isolation, account suspension, IP blocking, process termination, VM snapshotting, and file quarantine.
- ποΈ Evidence & Artifact Collection: Persistent record linking raw logs, network captures, and containment output to incidents.
- β±οΈ Timeline Reconstruction: Interactive chronological view rendered in JSON, ASCII (CLI), or formatted HTML.
- π Asynchronous REST API: FastAPI backend with non-blocking background tasks and OpenAPI documentation.
- π» Interactive CLI: Operator-focused terminal tool for incident creation, live tracking, and report generation.
- πΎ Relational Persistence: SQLite storage powered by SQLAlchemy 2.0 ORM.
- π§ͺ Comprehensive Test Suite: Unit and integration tests with coverage reporting.
βββββββββββββββ ββββββββββββββββ βββββββββββββββββββ
β CLI Tool ββββββββΆβ FastAPI API ββββββββΆβ SQLite Database β
β (cli.py) β β (api/main.py)β β (iris.db) β
βββββββββββββββ ββββββββ¬ββββββββ βββββββββββββββββββ
β
βΌ
ββββββββββββββββββ
β IncidentTriage β (Orchestrator)
βββββββββ¬βββββββββ
β
ββββββββββββββββββββββΌβββββββββββββββββββββ
βΌ βΌ βΌ
ββββββββββββββββ βββββββββββββββ βββββββββββββββββββ
β Playbook β β Enricher β β Containment β
β Engine β β (Mock Intel)β β Simulator β
ββββββββββββββββ βββββββββββββββ βββββββββββββββββββ
β β β
ββββββββββββββββββββββΌβββββββββββββββββββββ
βΌ
ββββββββββββββββββ
β Timeline & β
β Evidence β
ββββββββββββββββββ
- Ingest: Incident arrives via REST API or CLI.
- Triage: The
IncidentTriageorchestrator resolves incident severity/type and loads the corresponding playbook. - Execution: Playbook steps are dispatched to target handlers (
enricher,containment, etc.). - Context & Evidence: Step results update the shared incident context, generate evidence artifacts, and record timeline events.
- Reporting: Timeline and artifacts are finalized in the database and made available via API endpoints and CLI views.
| Layer | Technology | Purpose |
|---|---|---|
| Language | Python 3.10+ | Core runtime |
| API Framework | FastAPI | REST API & Async background tasks |
| Data Validation | Pydantic v2 | Strict schema validation & serialization |
| ORM / Database | SQLAlchemy 2.0 / SQLite | Relational persistence & audit trail |
| Playbook Engine | PyYAML + Jinja2 | Dynamic step definitions & templating |
| CLI Framework | argparse | Command-line interface for operators |
| Testing | pytest, pytest-cov | Unit, integration tests & code coverage |
| HTTP Client | httpx (TestClient) | API testing |
iris-response-engine/
βββ api/
β βββ __init__.py
β βββ main.py # FastAPI application & route handlers
βββ playbooks/ # Declarative YAML response playbooks
β βββ malware_outbreak.yml
β βββ phishing_campaign.yml
β βββ data_exfiltration.yml
β βββ insider_threat.yml
βββ src/
β βββ __init__.py
β βββ models.py # SQLAlchemy models & database initialization
β βββ schemas.py # Pydantic schemas (requests, responses, observables)
β βββ playbook_engine.py # YAML loader, parser, and state execution engine
β βββ enricher.py # Threat intel enrichment handlers & cache
β βββ containment.py # Simulated containment actions & sandbox effects
β βββ timeline.py # Timeline aggregation & formatters (JSON/HTML/ASCII)
β βββ triage.py # Main incident triage orchestrator
βββ templates/
β βββ timeline.html # Jinja2 template for HTML timeline rendering
βββ tests/ # Pytest automated test suite
βββ cli.py # Command-line operator interface
βββ requirements.txt # Project dependencies
βββ README.md
- Python 3.10+
- pip and git
-
Clone the repository:
git clone https://github.com/yourusername/iris-response-engine.git cd iris-response-engine -
Create and activate a virtual environment:
# Linux / macOS python3 -m venv venv source venv/bin/activate # Windows python -m venv venv venv\Scripts\activate
-
Install dependencies:
pip install -r requirements.txt
-
Initialize the database: (optional β automatically runs on API startup)
python -c "from src.models import init_db, get_engine; init_db(get_engine())"
Start the development server with hot-reload:
uvicorn api.main:app --reload --host 127.0.0.1 --port 8000- API Base URL:
http://127.0.0.1:8000 - Interactive Swagger UI:
http://127.0.0.1:8000/docs - Alternative ReDoc UI:
http://127.0.0.1:8000/redoc - Health Check:
http://127.0.0.1:8000/health
The CLI operates standalone or alongside the API:
python cli.py --help-
Create an Incident:
python cli.py create-incident \ --type malware \ --host WS-1234 \ --severity critical \ --description "Ransomware detected on workstation" \ --source-ip 185.20.30.40 -
Watch Live Playbook Execution:
python cli.py watch --incident-id INC-2026-0001
-
List Incidents:
python cli.py list --status open --limit 20
-
Show Incident Details:
python cli.py show --incident-id INC-2026-0001
-
Generate Report (Text / JSON):
python cli.py report --incident-id INC-2026-0001 --format text
-
Render ASCII Timeline in Terminal:
python cli.py timeline --incident-id INC-2026-0001 --format ascii
| Method | Endpoint | Description |
|---|---|---|
POST |
/incidents |
Ingest incident and trigger playbook asynchronously (202 Accepted) |
GET |
/incidents |
List incidents (filter by status, severity, or type) |
GET |
/incidents/{id} |
Fetch incident details, execution status, and evidence artifacts |
GET |
/incidents/{id}/timeline |
Retrieve timeline (format=json, format=html, format=ascii) |
GET |
/incidents/{id}/report |
Generate comprehensive incident post-mortem report |
POST |
/incidents/{id}/retry |
Retry a failed playbook execution step |
GET |
/playbooks |
List all available YAML response playbooks |
GET |
/health |
Application status, version, and database connectivity |
IRIS comes pre-configured with four built-in security playbooks:
| Playbook ID | Description | Default Severity Triggers |
|---|---|---|
malware_outbreak |
Standard host containment, hash reputation check, process kill, and VM snapshot | critical, high |
phishing_campaign |
URL reputation scan, credential reset, inbox sweep, and firewall domain block | high, medium |
data_exfiltration |
Egress IP block, DLP artifact capture, user token revocation, and forensic dump | critical |
insider_threat |
User privilege suspension, session termination, audit log extraction | high, critical |
Playbooks are defined under
playbooks/*.ymland can be customized or expanded without modifying application code.
Execute the test suite with coverage reporting:
pytest tests/ -v --cov=src --cov=api --cov-report=term-missing| Module | Statements Covered |
|---|---|
src/schemas.py |
100% |
src/models.py |
95% |
src/enricher.py |
78% |
src/containment.py |
73% |
src/triage.py |
73% |
api/main.py |
65% |
Contributions are welcome! Please follow these steps:
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/NewPlaybook) - Commit your Changes (
git commit -m 'feat: Add cloud lateral movement playbook') - Push to the Branch (
git push origin feature/NewPlaybook) - Open a Pull Request
Distributed under the MIT License. See LICENSE for details.
Mehdi Mejri
- GitHub: @Mejri-Mehdi
- LinkedIn: in/mehdi-mejri
Built with passion β€οΈ for security automation and incident response by Mejri Mehdi











