esrovillar/ir-playbook-engine

GitHub: esrovillar/ir-playbook-engine

基于YAML的自动化事件响应Playbook框架,将应急响应流程标准化为可执行、可审计的代码形式。

Stars: 0 | Forks: 0

# 📊 IR-Playbook-Engine 自动化事件响应 Playbook 框架。将 IR 流程定义为 YAML Playbook,自动执行调查和遏制步骤,并通过实时通知协调团队响应。 ## 功能特性 - **YAML Playbook** — 以代码形式定义 IR 流程(支持版本控制,可审计) - **预置 Playbook** — 勒索软件、BEC(商业邮件诈骗)、数据渗漏、钓鱼、凭据盗窃、内部威胁 - **自动化行动** — 执行遏制、调查和恢复步骤 - **取证收集** — 自动化 Artifact 收集(日志、内存、网络抓包) - **决策树** — 基于每一步发现结果的条件逻辑 - **严重性评分** — 基于证据的动态严重性计算 - **团队协作** — Telegram/Slack 通知、任务分配、状态跟踪 - **时间线生成** — 基于已执行步骤自动生成事件时间线 - **合规就绪** — 符合 NIST 800-61、SANS PICERL、ISO 27035 标准 - **审计跟踪** — 每一项操作均记录时间戳和操作人员信息 ## 架构 ``` ┌─────────────────┐ ┌──────────────────┐ ┌─────────────────┐ │ YAML Playbooks │────▶│ Playbook Engine │────▶│ Action Runner │ │ (IR procedures)│ │ (orchestrator) │ │ (exec steps) │ └─────────────────┘ └────────┬─────────┘ └────────┬────────┘ │ │ ┌────────▼─────────┐ ┌────────▼────────┐ │ Decision Engine │ │ Evidence Store │ │ (conditional │ │ (artifacts, │ │ logic) │ │ logs, files) │ └────────┬─────────┘ └────────┬────────┘ │ │ ┌────────▼─────────┐ ┌────────▼────────┐ │ Notifier │ │ Report Gen │ │ (Telegram/Slack)│ │ (timeline, │ └──────────────────┘ │ executive) │ └─────────────────┘ ``` ## Playbook 结构 ``` # playbooks/ransomware.yaml name: Ransomware Incident Response id: PB-RANSOM-001 version: "1.0" severity: critical framework: NIST-800-61 author: Esteban Rojas Villar triggers: - ransomware_detected - encryption_activity - ransom_note_found variables: affected_host: "" affected_user: "" malware_family: "" encryption_scope: "" phases: - id: identification name: Identification steps: - id: confirm_ransomware action: prompt message: "Confirm ransomware indicators on {{affected_host}}" options: [confirmed, false_positive] on_confirmed: contain_network on_false_positive: close_fp - id: identify_variant action: investigate command: "Check ransom note and encrypted file extensions" collect: - ransom_note - encrypted_sample - process_list - id: containment name: Containment steps: - id: contain_network action: contain type: network_isolate target: "{{affected_host}}" notify: [soc_team, ir_lead, management] severity_bump: +1 - id: disable_account action: contain type: disable_account target: "{{affected_user}}" ``` ## 入门指南 ### 1. 克隆并安装 ``` git clone https://github.com/esrovillar/ir-playbook-engine.git cd ir-playbook-engine pip install -r requirements.txt ``` ### 2. 查看可用的 Playbook ``` python -m src.cli.main playbooks list ``` 这将显示所有 6 个预置的 IR Playbook —— 每一个都涵盖了不同类型的事件,并提供了您的团队可以遵循的分步流程。 ### 3. 查看某个 Playbook 的详细内容 ``` python -m src.cli.main playbooks show ransomware ``` 这将显示每个阶段和步骤:调查什么、遏制什么、通知谁以及收集什么证据。 ### 4. 当事件发生时 —— 启动一个 Playbook ``` python -m src.cli.main incident start \ --playbook ransomware \ --severity critical \ --operator "Your Name" ``` 这将从一开始就创建一个带有完整审计跟踪的可跟踪事件(例如 `INC-2026-0001`)。 ### 5. 交互式地执行 Playbook ``` python -m src.cli.main incident run --id INC-2026-0001 --interactive ``` 引擎将引导您完成每一步:提出问题、记录您的回答、跟踪证据、为所有内容记录时间戳。将其视为一个智能检查清单,可自动记录您的整个响应过程。 ### 6. 随时检查事件状态 ``` python -m src.cli.main incident status --id INC-2026-0001 ``` ### 7. 完成后生成报告 ``` # 完整事件时间线 python -m src.cli.main report timeline --id INC-2026-0001 # 面向管理层的执行摘要 python -m src.cli.main report generate --id INC-2026-0001 --format markdown ``` ### 核心理念 与其在事件发生时手忙脚乱地试图记住该做什么,不如预先将您的 IR 流程定义为 YAML Playbook。当事件发生时,您选择正确的 Playbook,引擎将引导您的团队完成一个经过验证的、可重复的流程 —— 同时自动记录所有内容,以满足合规要求和经验总结。 您也可以 **编写自己的 Playbook** —— 只需按照相同的结构在 `playbooks/` 中创建一个新的 YAML 文件。使其适应您组织的特定需求、工具和流程。 ## 预置 Playbook | Playbook | ID | 阶段数 | 步骤数 | 框架 | |----------|----|--------|-------|-----------| | 🔒 勒索软件 | PB-RANSOM-001 | 5 | 23 | NIST 800-61 | | 📧 商业邮件诈骗 (BEC) | PB-BEC-001 | 5 | 18 | SANS PICERL | | 📤 数据渗漏 | PB-EXFIL-001 | 5 | 19 | NIST 800-61 | | 🎣 钓鱼攻击 | PB-PHISH-001 | 4 | 16 | SANS PICERL | | 🔑 凭据盗窃 | PB-CRED-001 | 5 | 20 | NIST 800-61 | | 👤 内部威胁 | PB-INSIDER-001 | 5 | 22 | ISO 27035 | **总计:118 个步骤**,涵盖 6 个真实世界事件场景,符合行业标准框架。 ## 项目结构 ``` ir-playbook-engine/ ├── src/ │ ├── engine/ │ │ ├── playbook_loader.py # YAML playbook parser & validator │ │ ├── orchestrator.py # Main execution engine │ │ ├── action_runner.py # Step execution & automation │ │ ├── decision_engine.py # Conditional logic processor │ │ └── severity.py # Dynamic severity scoring │ ├── models/ │ │ ├── incident.py # Incident data model │ │ ├── playbook.py # Playbook data model │ │ ├── evidence.py # Evidence & artifact model │ │ └── timeline.py # Timeline event model │ ├── storage/ │ │ ├── database.py # SQLite incident store │ │ └── evidence_store.py # File-based evidence storage │ ├── notifications/ │ │ ├── telegram.py # Telegram notifications │ │ └── slack.py # Slack notifications │ ├── reporting/ │ │ ├── timeline_gen.py # Incident timeline generator │ │ ├── executive_report.py # Executive summary generator │ │ └── technical_report.py # Detailed technical report │ └── cli/ │ ├── main.py # CLI entry point │ └── dashboard.py # Rich incident dashboard ├── playbooks/ │ ├── ransomware.yaml │ ├── bec.yaml │ ├── data_exfil.yaml │ ├── phishing.yaml │ ├── credential_theft.yaml │ └── insider_threat.yaml ├── config/ │ └── config.yaml ├── evidence/ # Collected artifacts ├── reports/ # Generated reports ├── tests/ ├── requirements.txt └── README.md ``` ## 事件生命周期 ``` New → Identified → Contained → Eradicated → Recovered → Closed │ Lessons Learned ``` ## 配置 ``` # config/config.yaml engine: playbook_dir: "playbooks/" evidence_dir: "evidence/" reports_dir: "reports/" auto_severity: true notifications: telegram: enabled: true bot_token: "YOUR_BOT_TOKEN" chat_id: "YOUR_CHAT_ID" database: path: "incidents.db" compliance: framework: "NIST-800-61" # NIST-800-61, SANS-PICERL, ISO-27035 require_approval: true # Require approval for containment actions max_response_time: 60 # Minutes before escalation ``` ## 系统要求 - Python 3.9+ - PyYAML, Jinja2 - Rich (CLI 仪表板) - Click (CLI 框架) - SQLite3 ## 作者 **Esteban Rojas Villar** — 高级网络安全事件响应专家 - LinkedIn: [linkedin.com/in/estebanrojas](https://linkedin.com/in/estebanrojas) - BSides San José (Costa Rica) 创始人兼组织者 ## 许可证 MIT
标签:ESC漏洞, FTP漏洞扫描, HTTP工具, IR自动化, NIST 800-61, PE 加载器, Python安全工具, SOAR, YAML配置, 内部威胁, 剧本引擎, 勒索软件处置, 告警分诊, 安全合规, 安全工作流, 安全编排, 审计追踪, 库, 应急响应, 横向移动遏制, 网络代理, 自动化运维, 证据收集, 逆向工具, 防御工事