cognis-digital/playbookforge

GitHub: cognis-digital/playbookforge

一款将事件响应 playbook 映射到 MITRE ATT&CK 并提供渲染、校验与脚手架生成的命令行工具。

Stars: 0 | Forks: 0

# playbookforge 事件响应 playbook 生成器和 linter,映射到 MITRE ATT&CK 战术和技术。 分析师将 IR playbook 编写为结构化数据 —— 步骤按标准的事件响应阶段(准备、检测、遏制、根除、恢复、经验教训)进行分组,每个步骤可选择性地使用 ATT&CK 技术 ID 进行标记。`playbookforge` 将 playbook 渲染为整洁的 Markdown 和 JSON,并对其进行 **lint**,以便格式错误或不完整的 playbook 无法通过您的 CI 门禁。 ## 安装 ``` pip install cognis-playbookforge ``` 核心部分**仅依赖标准库**。可选的 YAML 输入支持: ``` pip install "cognis-playbookforge[yaml]" ``` Python 3.10+。 ## 用法 ### 将 playbook 渲染为 Markdown(核心输出) ``` playbookforge render examples/phishing-response.json --format md ``` ``` # 凭据钓鱼响应 Response playbook for a reported or detected credential-harvesting phishing campaign... **Author:** Cognis Digital **Version:** 1.0.0 ## ATT&CK 覆盖 **Tactics:** TA0001 (Initial Access), TA0006 (Credential Access), TA0009 (Collection) | Technique | Type | | --- | --- | | `T1566.002` | Sub-technique | | `T1056.003` | Sub-technique | | `T1078` | Technique | _Total techniques referenced: 3_ ## 准备 ### 1. 确认报告渠道可用 ... ``` 或者使用 `--format json` 渲染规范的 JSON。使用 `-o FILE` 写入文件,或者传递 `-` 作为 playbook 从 stdin 读取。 ### Lint 一个 playbook(CI 门禁) ``` playbookforge lint examples/phishing-response.json ``` ``` 0 error(s), 0 warning(s) ``` 对于格式错误的 playbook,该工具会打印发现的问题并**以非零状态退出**: ``` playbookforge lint broken.json ``` ``` ERROR: PB031 [phase:Detection/step#0] technique 'XXX' is not a valid ATT&CK ID (expected Txxxx or Txxxx.xxx) WARNING: PB022 [phase:Containment] phase has no steps 1 error(s), 1 warning(s) ``` 添加 `--strict` 也会在出现警告时失败。 ### 构建新 playbook 脚手架 ``` playbookforge new --title "Business Email Compromise" -o bec.json ``` 生成一个包含所有六个标准 IR 阶段以及每个阶段一个占位符步骤的入门 playbook。 ### 显示 ATT&CK 覆盖范围 ``` playbookforge coverage examples/phishing-response.json ``` ``` Playbook: Credential Phishing Response Tactics: TA0001 Initial Access TA0006 Credential Access TA0009 Collection Techniques (3): T1566.002 (sub-technique, base T1566) T1056.003 (sub-technique, base T1056) T1078 (technique, base T1078) ``` 添加 `--json` 以获取机器可读的输出。 ## Lint 规则 | 代码 | 严重性 | 检查内容 | | --- | --- | --- | | PB001 | error | Playbook 具有标题 | | PB002 | error | Playbook 至少有一个阶段 | | PB010 | error | Tactic 标签匹配 `TAxxxx` 格式 | | PB011 | warning | Tactic 是已知的企业战术 | | PB020 | warning | 没有重复的阶段名称 | | PB021 | warning | 阶段名称是标准的 IR 阶段 | | PB022 | warning | 阶段至少有一个步骤 | | PB030 | error | 每个步骤都有名称 | | PB031 | error | 技术 ID 匹配 `Txxxx` / `Txxxx.xxx` | | PB032 | warning | 检测步骤带有检测指南 | | PB033 | warning | 响应阶段带有响应/描述 | | PB040 | warning | 存在所有标准的 IR 阶段 | ## Playbook 格式 Playbook 是一个 JSON(或者通过 `yaml` 额外依赖,使用 YAML)对象: ``` { "title": "Credential Phishing Response", "description": "...", "author": "Cognis Digital", "version": "1.0.0", "tactics": ["TA0001", "TA0006"], "phases": [ { "name": "Detection", "steps": [ { "name": "Triage the reported message", "description": "...", "techniques": ["T1566.002"], "detection": "Mail-gateway logs for the sending domain..." } ] } ] } ``` 请参阅 `examples/` 获取完整的网络钓鱼响应和勒索软件响应 playbook。 ## 功能 - Markdown 渲染器,带有 ATT&CK 覆盖率汇总表和技术徽章 - 规范的 JSON 渲染器(可完美往返转换) - 带有技术 ID 正则表达式验证、必填字段检查和阶段覆盖警告的 linter;在出现错误时以非零状态退出以适配 CI - 用于生成入门 playbook 的 `new` 脚手架工具 - 用于提取引用的战术和技术的 `coverage` 提取器 - 内置 14 种企业 ATT&CK 战术列表,用于标记和验证 - 核心仅依赖标准库;通过额外依赖支持可选的 YAML 输入 ## 范围 仅用于防御和分析用途。 ## 许可证 许可证:COCL 1.0
标签:Cloudflare, DevSecOps, Markdown, MITRE ATT&CK, Playbook, Python, 上游代理, 安全运营, 库, 应急响应, 扫描框架, 无后门, 逆向工具