realnits/Agamotto

GitHub: realnits/Agamotto

一款基于 AI 视觉模型的威胁建模 CLI 工具,能够自动解析架构图并生成 STRIDE、LINDDUN、MITRE ATT&CK 等框架的安全分析报告。

Stars: 0 | Forks: 0

# Agamotto 👁️ **技**术**威**胁**操**作的**自**动**化**图**谱**分**析**与**建**模 (**A**utomated **G**raph **A**nalysis & **M**odeling **O**f **T**echnical **T**hreat **O**perations)。 一个强大的、AI 驱动的 CLI 框架,利用先进的视觉模型分析架构并在威胁显现前进行预测。 ## 功能特性 - 👁️ **AI 视觉分析**:使用先进的视觉模型解析架构图(PNG, JPG) - 📄 **多格式解析**:支持 draw.io XML 文件、图像和文本描述 - 🛡️ **自动化威胁建模**:使用 STRIDE、LINDDUN 和 MITRE ATT&CK 进行全面的风险分析 - 📊 **丰富的报告**:生成交互式 HTML、PDF、Markdown 或 JSON 报告 - 🔌 **模型无关性**:无缝集成 OpenAI、Azure、Anthropic、Ollama(本地)或自定义 API - 🔒 **企业级**:内置输入清理、元数据剥离和离线模式支持 ## 安装 ### 从源码安装 ``` # 克隆 repository git clone https://github.com/tm-ai-cli/agamotto.git cd agamotto # 构建 artifact make build # 安装 (可选) make install ``` ### 预构建产物 从 [发布页面](https://github.com/tm-ai-cli/agamotto/releases) 下载。 ## 快速开始 1. **初始化配置**: ``` agamotto config init ``` 2. **设置您的 API key**: ``` export OPENAI_API_KEY="your-key-here" ``` 3. **运行完整分析**: ``` agamotto fullrun architecture.png -o report.html ``` ## 使用方法 ### 命令 | 命令 | 描述 | |---------|-------------| | `agamotto parse ` | 使用视觉 AI 解析架构图像/draw.io/文本 | | `agamotto analyse ` | 执行威胁建模分析 | | `agamotto scan ` | CI/CD 扫描,输出 HTML/SARIF 并返回退出码 | | `agamotto generate-report ` | 生成 PDF/MD/JSON/HTML 报告 | | `agamotto fullrun ` | 一键执行:解析 → 分析 → 报告 | | `agamotto config test` | 验证 YAML 模型配置 | | `agamotto config init` | 创建示例配置 | | `agamotto model list` | 显示可用模型 | | `agamotto model test` | 测试 AI 模型连接 | ### 示例 **解析架构图:** ``` agamotto parse system-architecture.png -o architecture.json ``` **使用特定方法论分析威胁:** ``` agamotto analyse architecture.json --stride --linddun --attack -o threats.json ``` **生成 Markdown 报告:** ``` agamotto generate-report threats.json -o report.md ``` **生成交互式 HTML 报告:** ``` agamotto generate-report threats.json -o report.html ``` **单命令完整流程:** ``` agamotto fullrun diagram.png -o report.html --keep-json ``` ## 配置 创建一个 `config.yaml` 文件: ``` ai: provider: openai # openai | azure-openai | anthropic | ollama | custom model: gpt-4-vision-preview # api_key: "your-key" # Or use environment variable # For custom enterprise models: # base_url: "https://internal-llm.company.com/v1/inference" # headers: # X-API-Key: "YOUR_KEY_HERE" timeouts: connect_timeout: 10s read_timeout: 60s max_tokens: 4096 parsing: enable_vision_parsing: true drawio_fallback: true reports: default_format: pdf include_diagrams: true security: disable_network: false # Enable for airgap mode strip_metadata: true ``` ### 环境变量 | 变量 | 提供商 | |----------|----------| | `OPENAI_API_KEY` | OpenAI | | `ANTHROPIC_API_KEY` | Anthropic | | `AZURE_OPENAI_API_KEY` | Azure OpenAI | ## 支持的 AI 提供商 | 提供商 | 视觉支持 | 本地 | 需要 API Key | |----------|---------------|-------|------------------| | OpenAI | ✅ | ❌ | ✅ | | Azure OpenAI | ✅ | ❌ | ✅ | | Anthropic | ✅ | ❌ | ✅ | | Ollama | ✅ | ✅ | ❌ | | Custom HTTP | ✅ | ❌ | 可配置 | ### 使用 Ollama(本地模型) ``` # 安装 Ollama curl -fsSL https://ollama.ai/install.sh | sh # 拉取 vision model ollama pull llava # 配置 agamotto 以使用 Ollama # config.yaml: # ai: # provider: ollama # model: llava ``` ## 报告输出 报告包含: 1. **执行摘要** - 整体风险等级和关键发现 2. **架构概览** - 解析的组件和数据流 3. **已识别威胁** - 按 STRIDE 分类 4. **缓解建议** - 按优先级排序的安全控制措施 5. **攻击场景** - 潜在的攻击路径 6. **风险摘要** - 剩余风险评估 ### HTML 报告 生成的交互式 HTML 报告包含: - **仪表板视图**:高层风险指标 - **过滤功能**:按严重程度排序/过滤威胁 - **动画效果**:现代化、响应式 UI - **自动打开**:自动在默认浏览器中启动 ### PDF 生成 如需 PDF 输出,请安装 [pandoc](https://pandoc.org/installing.html): ``` # macOS brew install pandoc # Ubuntu/Debian apt install pandoc # Windows choco install pandoc ``` ## 安全特性 - **输入清理**:所有文件输入均经过验证 - **元数据剥离**:从图像中移除 EXIF 和其他元数据 - **离线模式**:禁用网络访问,仅使用本地模型 - **PII 安全日志**:日志中隐去敏感数据 - **可配置代理**:支持企业代理服务器 ## 项目结构 ``` agamotto/ ├── cmd/ # CLI commands │ ├── root.go │ ├── parse.go │ ├── analyse.go │ ├── report.go │ ├── fullrun.go │ ├── config.go │ └── model.go ├── pkg/ │ ├── ai/ # AI model implementations │ │ ├── model_interface.go │ │ ├── openai.go │ │ ├── anthropic.go │ │ ├── ollama.go │ │ └── custom_http.go │ ├── parser/ # Architecture parsing │ │ ├── vision.go │ │ └── drawio.go │ ├── engine/ # Threat modeling engine │ │ └── threatmodel.go │ ├── reports/ # Report generation │ │ ├── markdown.go │ │ ├── pdf.go │ │ └── templates/ │ ├── config/ # Configuration │ │ └── config.go │ └── security/ # Security utilities │ └── sanitizer.go ├── config.yaml ├── Makefile └── go.mod ``` ## 许可证 MIT License - 详见 [LICENSE](LICENSE)。 ## 路线图 - [ ] SBOM 分析集成 - [ ] 云架构自动检测(AWS/GCP/Azure 图标)
标签:AI安全, AI风险缓解, Anthropic, Chat Copilot, CISA项目, CIS基准, Cloudflare, DevSecOps, DLL 劫持, draw.io, EVTX分析, Go, HTML报告, JSONLines, LINDDUN, LLM评估, MITRE ATT&CK, Ollama, OpenAI, PDF报告, Python, Ruby工具, SARIF, STRIDE, 上游代理, 云安全监控, 交互式报告, 企业级安全, 元数据清理, 内存规避, 图形化分析, 大语言模型, 威胁建模, 安全合规, 数据隐私, 文档结构分析, 无后门, 日志审计, 智能运维, 本地部署, 架构分析, 架构图解析, 混合云安全, 渗透测试辅助, 离线模式, 结构化查询, 网络代理, 网络安全, 自动化安全, 计算机视觉, 软件供应链安全, 远程方法调用, 隐私保护, 零信任, 静态分析, 风险预测