msadigo/detection-workflow

GitHub: msadigo/detection-workflow

基于 Claude Code hooks 实现安全检测规则编写时自动化格式与元数据校验的工作流工具。

Stars: 0 | Forks: 0

# detection-workflow 通过 Claude Code hooks 实现自动化验证的检测规则编写工作流。 ## 前置条件 - [Git Bash](https://git-scm.com/downloads)(或您 `PATH` 上的其他 `bash`)—— hooks 以 bash 脚本形式运行 - [Node.js](https://nodejs.org/) —— 用于解析 hook 的 JSON payload(无需依赖 `jq`) - [Python 3](https://www.python.org/) 且已安装 [PyYAML](https://pypi.org/project/PyYAML/): pip install pyyaml ## 设置 1. 克隆仓库: git clone https://github.com/msadigo/detection-workflow.git cd detection-workflow 2. 在 Claude Code 中打开该项目。`.claude/settings.json` 中的验证 hook 会被自动识别 —— 无需额外配置。 3. (可选)验证验证脚本是否能独立运行: echo '{"tool_input":{"file_path":"rules/example.yaml"}}' | bash scripts/validate-rule.sh ## 编写检测规则 检测规则以 YAML 文件(`.yml` 或 `.yaml`)的形式存放在 `rules/` 目录下。每个规则 必须定义: - `title` —— 非空字符串 - `description` —— 非空字符串 - `tags` —— 包含至少一个 MITRE ATT&CK 技术标签的列表 (例如 `attack.t1059.001`) 示例: ``` title: Suspicious PowerShell Encoded Command description: Detects execution of PowerShell with base64-encoded command arguments. tags: - attack.t1059.001 - attack.execution ``` 每当 Claude Code 在 `rules/` 下写入或编辑文件时,`PostToolUse` hook (`scripts/validate-rule.sh`)都会自动根据这些要求进行检查, 并向 Claude 报告错误或成功信息。 ## 仓库结构 ``` .claude/ hooks/log-edit-write.sh # logs every Edit/Write tool call to .claude/hook.log settings.json # hook configuration (checked in, shared by the team) settings.local.json # personal overrides (gitignored) scripts/ validate-rule.sh # validates rules/*.yaml files (title, description, ATT&CK tag) rules/ # detection rules (created as you add them) ```
标签:Claude Code, Cloudflare, MITM代理, MITRE ATT&CK, Python, Shell, 安全运营, 应用安全, 开发工作流, 恶意代码分类, 扫描框架, 无后门, 检测规则, 网络资产发现, 自动化验证, 逆向工具