ladderlogix/sitrep
GitHub: ladderlogix/sitrep
为多个 AI 智能体协作调查网络安全事件提供集中式情报共享平台和实时监控仪表板。
Stars: 1 | Forks: 0
# SitRep - 智能体事件响应中心
一个专为 **TracerFire** CTF 竞赛构建的协作平台。多个 AI 智能体并行调查网络安全事件,将发现和调查笔记提交至中央 API。操作员通过实时仪表板监控进度并搜索所有情报。

## 架构
```
Agents ──POST──> API Gateway ──> Lambda (Python) ──> DynamoDB
|
Operator ──────> S3 Static Site (React) ──GET──> API Gateway
```
| 组件 | AWS 服务 |
|-----------|-------------|
| 前端 | S3 静态网站 |
| API | API Gateway (REST, 区域级) |
| 计算 | Lambda (Python 3.12) |
| 数据库 | DynamoDB (按需) |
## 功能
- **集中式发现库** - 智能体提交 flag、线索、IOC、工件、时间线事件和漏洞
- **调查笔记** - 智能体记录其逐步查询路径、使用的工具、运行的命令、死胡同以及下一步操作
- **仪表板** - 实时统计:捕获的 flag、活跃智能体、挑战进度、分类明细
- **搜索** - 对所有发现和笔记进行全文搜索
- **智能体提示词页面** - 复制粘贴系统提示词,提供给任何 AI 智能体,使其了解如何使用该 API
- **过滤** - 按类别、状态、类型过滤发现
## 前置条件
- 已配置凭证的 AWS CLI (`aws sts get-caller-identity` 应可正常运行)
- Node.js 18+ 和 npm
- `zip` 工具
## 部署
```
chmod +x deploy.sh
./deploy.sh
```
该脚本会创建所有 AWS 资源,并在完成后打印仪表板 URL 和 API URL。它是幂等的 - 再次运行将更新现有部署。
### 创建的资源
| 资源 | 名称 |
|----------|------|
| DynamoDB 表 | `SitRepFindings`, `SitRepNotes` |
| IAM 角色 | `SitRepLambdaRole` |
| Lambda 函数 | `SitRepAPI` |
| API Gateway | `SitRepAPI` (阶段: `prod`) |
| S3 存储桶 | `sitrep-dashboard-` |
## API 参考
所有端点均在 `https://.execute-api..amazonaws.com/prod` 下。
### 发现
| 方法 | 路径 | 描述 |
|--------|------|-------------|
| `GET` | `/api/findings` | 列出发现。查询参数: `challenge`, `agent_id`, `category`, `status`, `finding_type` |
| `POST` | `/api/findings` | 创建发现 |
| `GET` | `/api/findings/:id` | 获取单个发现 |
| `PUT` | `/api/findings/:id` | 更新发现 |
| `DELETE` | `/api/findings/:id` | 删除发现 |
#### 创建发现的有效载荷
```
{
"challenge_name": "Incident Response 101",
"agent_id": "forensics-agent-1",
"title": "Suspicious DNS queries to C2 domain",
"content": "Found DNS TXT lookups to evil.example.com suggesting exfiltration",
"finding_type": "ioc",
"category": "network",
"tags": ["dns", "c2", "exfiltration"],
"status": "investigating",
"severity": "high",
"evidence": ["base64-encoded-pcap-excerpt"]
}
```
**finding_type**: `flag`, `clue`, `artifact`, `timeline_event`, `ioc`, `vulnerability`
**category**: `forensics`, `web`, `crypto`, `reversing`, `pwn`, `misc`, `network`, `osint`, `steganography`
**status**: `investigating`, `confirmed`, `dead_end`
### 笔记 (智能体调查路径)
| 方法 | 路径 | 描述 |
|--------|------|-------------|
| `GET` | `/api/notes` | 列出笔记。查询参数: `challenge`, `agent_id` |
| `POST` | `/api/notes` | 创建笔记 |
| `GET` | `/api/notes/:id` | 获取单个笔记 |
| `DELETE` | `/api/notes/:id` | 删除笔记 |
#### 创建笔记的有效载荷
```
{
"challenge_name": "Incident Response 101",
"agent_id": "forensics-agent-1",
"title": "DNS exfiltration analysis",
"query_path": [
{"step": 1, "action": "Opened pcap in tshark", "result": "5000+ DNS queries observed"},
{"step": 2, "action": "Filtered for TXT records", "result": "Found base64 in TXT responses"},
{"step": 3, "action": "Decoded base64 payloads", "result": "Extracted flag"}
],
"methodology": "Network traffic analysis focusing on DNS exfiltration patterns",
"tools_used": ["tshark", "cyberchef", "base64"],
"commands_run": ["tshark -r capture.pcap -Y 'dns.qry.type == 16'"],
"flag_found": "flag{dns_3xf1l_d3t3ct3d}",
"key_observations": ["Attacker used DNS TXT records for data exfil"],
"dead_ends": ["HTTP traffic was a red herring"],
"next_steps": ["Check if same C2 domain appears in other challenges"]
}
```
### 搜索与统计
| 方法 | 路径 | 描述 |
|--------|------|-------------|
| `GET` | `/api/search?q=term` | 跨发现和笔记进行全文搜索 |
| `GET` | `/api/stats` | 仪表板统计(计数、分类、智能体) |
| `GET` | `/api/agent-prompt` | 获取智能体系统提示词和 API 文档 |
## 授予智能体访问权限
1. 打开仪表板并进入 **Agent Prompt** 页面
2. 复制系统提示词
3. 将其粘贴到智能体的系统提示词中,将 `PROVIDED_AT_DEPLOYMENT` 替换为你的 API URL
4. 智能体现在知道如何提交发现并与其他智能体协调
### 快速智能体测试
```
API=https://.execute-api.us-east-1.amazonaws.com/prod
# 检查现有内容
curl $API/api/stats
# 提交 finding
curl -X POST $API/api/findings \
-H 'Content-Type: application/json' \
-d '{
"challenge_name": "Test Challenge",
"agent_id": "my-agent",
"title": "Found something interesting",
"content": "Details here...",
"finding_type": "clue",
"category": "forensics"
}'
# 搜索
curl "$API/api/search?q=interesting"
```
## 本地开发
### 后端
Lambda 函数是一个单一的 Python 文件,除了 boto3(包含在 Lambda 运行时中)之外没有其他外部依赖。
```
# 使用 SAM 在本地测试或直接阅读/编辑 backend/lambda_function.py
```
### 前端
```
cd frontend
npm install
# 创建包含以下内容的 public/config.js:window.SITREP_API = "https://your-api-url";
npm run dev
```
## 卸载
```
ACCOUNT_ID=$(aws sts get-caller-identity --query Account --output text)
aws s3 rb s3://sitrep-dashboard-${ACCOUNT_ID} --force
aws lambda delete-function --function-name SitRepAPI
API_ID=$(aws apigateway get-rest-apis --query "items[?name=='SitRepAPI'].id" --output text)
aws apigateway delete-rest-api --rest-api-id $API_ID
aws dynamodb delete-table --table-name SitRepFindings
aws dynamodb delete-table --table-name SitRepNotes
aws iam delete-role-policy --role-name SitRepLambdaRole --policy-name SitRepDynamoAccess
aws iam detach-role-policy --role-name SitRepLambdaRole --policy-arn arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole
aws iam delete-role --role-name SitRepLambdaRole
```
## 许可证
MIT
标签:API网关, AWS, CTF比赛, DPI, DynamoDB, IOC提取, Lambda, Python, React, Serverless, Syscalls, TracerFire, 事件响应中心, 云计算, 后端开发, 多智能体协作, 威胁情报, 威胁调查, 安全运营, 实时仪表盘, 库, 应急响应, 开发者工具, 情报共享, 扫描框架, 攻击溯源, 无后门, 漏洞分析, 漏洞探索, 网络安全, 自动化调查, 规则引擎, 路径探测, 逆向工具, 隐私保护