yoelapu/intelstrike

GitHub: yoelapu/intelstrike

基于 CrewAI 多智能体框架的自动化 pipeline,将网络威胁情报映射到 MITRE ATT&CK 并生成可执行的渗透测试用例清单。

Stars: 1 | Forks: 0

# IntelStrike 一个多智能体 AI pipeline,用于将网络威胁情报 (CTI) 运用到渗透测试项目中。基于 CrewAI、Claude 和 Tavily 构建。 ## 工作原理 三个智能体按顺序运行,每个智能体将上下文传递给下一个: ``` [config.py] │ ▼ Agent 1: Threat Profiler Identifies 2-3 threat groups relevant to the client's industry, geography, and tech stack │ ▼ Agent 2: TTP Extractor Extracts and filters TTPs applicable to the known stack, mapped to MITRE ATT&CK, prioritized by exploitation frequency │ ▼ Agent 3: Test Case Builder Translates TTPs into an actionable checklist with steps, tools, payloads, success criteria, and quick wins │ ▼ [intelstrike_report.md] ``` ### 输出 一份包含以下内容的 Markdown 报告: - **执行摘要** - 项目的威胁背景 - **威胁行为者档案** - 相关组织及其攻击目标模式 - **优先级 TTP 表格** - 按技术栈过滤,按优先级评分 - **可操作的测试用例** - 复选框格式,包含步骤、工具和标准 - **Top 5 速赢项** - 影响最高/成本最低,可优先解决的事项 - **威胁叙事** - 攻击链故事,用于在报告中提供调查结果的背景 ## 项目结构 ``` intelstrike/ ├── .gitignore # protects secrets and outputs from version control ├── README.md ├── requirements.txt # dependencies ├── config.py # only file you edit per engagement ├── agents.py # agent definitions ├── tasks.py # task definitions └── main.py # entry point ``` **config.py** pipeline 的集中配置。包含项目概况(行业、地理位置、技术栈、范围、持续时间)、LLM 提供商和模型选择、输出文件路径以及搜索设置。这是在运行新项目之前唯一需要编辑的文件。 **agents.py** 定义了 pipeline 中使用的三个 AI 智能体。每个智能体都有特定的角色、目标和背景故事,这决定了它们如何处理任务。还包含 `_build_llm()` 函数,该函数根据 `config.py` 中配置的提供商动态构建 LLM 对象。 | 智能体 | 角色 | 职责 | |---|---|---| | `threat_profiler` | 威胁情报分析师 | 为客户档案研究和识别相关的威胁行为者组织 | | `ttp_extractor` | 进攻性安全 TTP 专家 | 从已识别的组织中提取和过滤 TTP,映射到 MITRE ATT&CK | | `test_case_builder` | 渗透测试负责人 | 将 TTP 转化为可操作的渗透测试清单 | **tasks.py** 定义了 pipeline 执行的三个任务,使用来自 `config.py` 的项目背景动态构建。每个任务指定了智能体必须做什么、预期输出是什么,以及它可以通过 CrewAI 的上下文机制访问哪些先前任务的结果。 **main.py** pipeline 的入口点。导入配置,初始化智能体和任务,组装 CrewAI 团队,并运行 pipeline。同时处理在执行开始前显示项目概况的控制台输出。 ## 设置说明 ### 前置条件 需要 Python 3.10 或更高版本。CrewAI 支持 3.10-3.12。 ``` python3 --version # verify your version ``` ### 1. 创建虚拟环境 建议在所有平台上使用虚拟环境。它可以隔离项目依赖并避免与系统包发生冲突。 ``` python3 -m venv venv source venv/bin/activate # Mac / Linux venv\Scripts\activate # Windows ``` 你应该会在终端提示符的开头看到 `(venv)`,确认环境已激活。 ### 2. 安装依赖 ``` ./venv/bin/pip3 install -r requirements.txt ``` ### 3. 设置环境变量 为你选择的 LLM 提供商和 Tavily 设置 API 密钥: ``` # Tavily(Web search 必需) export TAVILY_API_KEY="your-key" # https://tavily.com (free tier: 1,000 calls/month) # 选择一个 LLM provider: export ANTHROPIC_API_KEY="your-key" # https://console.anthropic.com export OPENAI_API_KEY="your-key" # https://platform.openai.com export GOOGLE_API_KEY="your-key" # https://aistudio.google.com export GROQ_API_KEY="your-key" # https://console.groq.com (free tier available) # Ollama:无需 key,只需运行:ollama pull llama3.2 ``` ### 4. 配置项目概况 使用客户详细信息和首选 LLM 编辑 `config.py`: ``` # LLM provider - 选择一个 LLM_PROVIDER = "anthropic" # anthropic / openai / google / groq / ollama / azure / bedrock LLM_MODEL = "claude-sonnet-4-5" # model name for the selected provider ENGAGEMENT = { "client_industry": "Financial Services", "client_geography": "Latin America", "tech_stack": ["WordPress", "AWS", "MySQL"], "scope_type": "web application", "scope_focus": "initial access, authentication bypass, data exfiltration", "engagement_days": 10, } ``` **提供商和模型示例:** | 提供商 | `LLM_PROVIDER` | `LLM_MODEL` | |---|---|---| | Anthropic | `"anthropic"` | `"claude-sonnet-4-5"` | | OpenAI | `"openai"` | `"gpt-4o"` | | Google Gemini | `"google"` | `"gemini/gemini-1.5-pro"` | | Groq | `"groq"` | `"groq/llama-3.1-70b-versatile"` | | Ollama (本地) | `"ollama"` | `"ollama/llama3.2"` | ### 5. 运行 pipeline ``` python main.py ``` 在不运行的情况下验证配置和 API 密钥: ``` python main.py --dry-run ``` 报告默认保存到 `intelstrike_report.md`。输出路径可以在 `config.py` 中更改。 ## 配置参考 所有设置都位于 `config.py` 中: | 设置 | 描述 | 默认值 | |---|---|---| | `ENGAGEMENT["client_industry"]` | 客户所在行业 | `"Financial Services"` | | `ENGAGEMENT["client_geography"]` | 客户的运营地理区域 | `"Latin America"` | | `ENGAGEMENT["tech_stack"]` | 范围内的已知技术 | `["WordPress", "AWS", "MySQL"]` | | `ENGAGEMENT["scope_type"]` | 项目类型 | `"web application"` | | `ENGAGEMENT["scope_focus"]` | 在范围内优先考虑的关键目标 | `"initial access, authentication bypass, data exfiltration"` | | `ENGAGEMENT["engagement_days"]` | 项目持续时间(天) | `10` | | `OUTPUT_FILE` | 输出报告文件名 | `"intelstrike_report.md"` | | `LLM_PROVIDER` | 要使用的 LLM 提供商 | `"anthropic"` | | `LLM_MODEL` | 所选提供商的模型名称 | `"claude-sonnet-4-5"` | | `LLM_MAX_ITER` | 最大智能体迭代次数 | `3` | | `VERBOSE` | 控制台输出详细程度 | `True` | | `SEARCH_MAX_RESULTS` | 每次查询的 Tavily 结果数 | `3` | ## 适应不同类型的项目 该 pipeline 不仅限于 Web 应用程序测试。它适用于任何项目类型——智能体会根据 `scope_type`、`scope_focus` 和 `tech_stack` 调整其研究和 TTP 选择。 **Web 应用程序** ``` ENGAGEMENT = { "client_industry": "Financial Services", "client_geography": "Latin America", "tech_stack": ["WordPress", "AWS", "MySQL"], "scope_type": "web application", "scope_focus": "initial access, authentication bypass, data exfiltration", "engagement_days": 10, } ``` **Active Directory / 内部网络** ``` ENGAGEMENT = { "client_industry": "Government", "client_geography": "United States", "tech_stack": ["Active Directory", "Windows Server 2022", "Exchange"], "scope_type": "internal network", "scope_focus": "lateral movement, privilege escalation, domain compromise", "engagement_days": 14, } ``` **基础设施 / 网络** ``` ENGAGEMENT = { "client_industry": "Energy", "client_geography": "Europe", "tech_stack": ["Cisco IOS", "Windows Server", "VMware"], "scope_type": "infrastructure", "scope_focus": "network access, credential harvesting, persistence", "engagement_days": 10, } ``` **云** ``` ENGAGEMENT = { "client_industry": "Technology", "client_geography": "Asia Pacific", "tech_stack": ["AWS", "S3", "EC2", "IAM", "Lambda"], "scope_type": "cloud", "scope_focus": "misconfiguration, IAM privilege escalation, data exfiltration", "engagement_days": 7, } ``` ## 许可证 MIT - 可自由使用,请注明出处。
标签:AES-256, AI代理, AI安全工具, CISA项目, Claude, Cloudflare, CrewAI, CVE检测, IP 地址批量处理, MITRE ATT&CK, PE 加载器, PyRIT, Python, Tavily, TTP提取, 人工智能, 反取证, 多智能体系统, 威胁建模, 威胁情报分析, 安全报告, 安全评估, 战术技术与程序, 插件系统, 数据展示, 无后门, 无线安全, 智能安全, 测试用例生成, 漏洞评估, 用户模式Hook绕过, 红队, 网络威胁情报, 网络安全, 网络攻击防护, 自动化渗透测试, 逆向工具, 隐私保护, 黑客攻击模拟