SamiAdamMoughli/Mosaic
GitHub: SamiAdamMoughli/Mosaic
Mosaic 是一个 AI 编排的多智能体侦察框架,通过协调专业智能体和安全工具在严格范围控制下绘制组织的攻击面。
Stars: 0 | Forks: 0
# AI Recon 框架
授权参与的、仅用于侦察的多智能体系统。协调一个由专业 AI 智能体和经过实战检验的安全工具(nmap、subfinder、nuclei、httpx 等)组成的团队,以绘制组织的外部和内部攻击面。
每次工具调用都受到范围限制,并记录到仅追加的审计跟踪中,且只能针对您明确定义范围内的目标执行。
## 功能
- **仅限被动和主动侦察** — 无漏洞利用、无 payload、无持久化、无横向移动。
- 多智能体团队:Orchestrator (o3) 负责规划;DNS、Network、Port、Fingerprint、Web 和 OSINT 智能体并行运行;ValidationAgent 在 orchestrator 执行操作前过滤噪音;ReportAgent 将发现综合成 Markdown 报告。
- 发现结果会被去重,并存储在每次活动运行的 SQLite 数据库中。
- 每次工具执行都通过 Go sidecar (`recon-runner`) 进行代理,该 sidecar 将范围作为权威的第二道闸门来强制执行,并在停止活动时立即终止子进程。
- 紧急停止开关:`Ctrl-C` 或 `touch /tmp/.redteam_stop` 会在一次工具调用延迟内停止所有工具进程。
## 架构
```
cli.py
└── OrchestratorAgent (o3)
├── DNSAgent (Gemini 2.5 Flash)
├── NetworkMapperAgent (Gemini 2.5 Flash)
├── PortScannerAgent (Gemini 2.5 Flash) ← spawned per host
├── ServiceFingerprintAgent (GPT-4o-mini) ← spawned per HTTP service
├── WebReconAgent (Claude Sonnet 4.6) ← spawned per web app
├── OSINTAgent (Perplexity Sonar Pro)
└── ReportAgent (Gemini 2.5 Pro)
ValidationAgent (GPT-4o-mini) — critic that confirms noisy HOST/PORT/SUBDOMAIN
findings before the orchestrator reacts to them.
FindingsStore (SQLite) — shared blackboard with pub/sub, deduplication, and
two-tier subscription (raw → validated, rich findings auto-confirmed).
recon-runner (Go HTTP sidecar) — executes tool binaries with:
- Scope enforcement (CIDRs + domain allowlist)
- Per-tool goroutine semaphores (e.g. nmap ≤ 3 concurrent)
- exec.CommandContext — child processes killed on context cancel
```
## 前置条件
**API 密钥**(参见 `.env.example`):
| 变量 | 用途 |
| --- | --- |
| `ANTHROPIC_API_KEY` | WebReconAgent (Claude) |
| `OPENAI_API_KEY` | OrchestratorAgent (o3)、ServiceFingerprinter、ValidationAgent |
| `GOOGLE_API_KEY` | DNS、Network、Port、Report 智能体 (Gemini) |
| `PERPLEXITY_API_KEY` | OSINTAgent |
| `SHODAN_API_KEY` | 可选 — 通过 `shodan` CLI 进行 Shodan 查询 |
**安全工具**(必需 — 启动时会进行检查):
```
nmap subfinder httpx nuclei
```
**推荐**(如果缺失将自动跳过):
```
amass dnsx masscan rustscan katana ffuf gowitness gau theHarvester fierce
```
**Go 1.22+** — 构建 `recon-runner` 所需。
## 设置
```
# 复制并填写 API keys
cp .env.example .env
# 编辑 .env
# 安装 Python 依赖
pip install -r requirements.txt
# 构建 Go tool runner
make runner # outputs ./recon-runner
# (可选)安装到 PATH
make install
```
## 用法
```
# 映射网络范围
python cli.py --networks 10.0.0.0/24 --domains corp.example.com
# 多个范围 + 自定义目标
python cli.py \
--networks 10.0.0.0/24 192.168.1.0/24 \
--domains corp.example.com staging.example.com \
--exclude 10.0.0.1/32 \
--goal "Focus on web-facing services and DNS footprint"
# 详细 (DEBUG) 日志记录
python cli.py --networks 10.0.0.0/24 --verbose
```
**随时停止:**
```
Ctrl-C
# 或从另一个 shell:
touch /tmp/.redteam_stop
```
## 输出
每次活动都会写入 `runs/campaign_/`:
| 文件 | 内容 |
| --- | --- |
| `findings.db` | SQLite — 所有去重后的发现 |
| `audit.jsonl` | 包含每个决策和工具调用的仅追加日志 |
| `report.md` | 由 ReportAgent 生成的 Markdown 摘要 |
## 法律声明
仅限在您拥有或获得明确书面授权进行测试的系统上使用。遵守所有适用法律。此工具中内置的范围强制执行是技术保障措施,不能替代法律授权。
# Mosaic
# Mosaic
标签:GitHub, TShark, 多智能体, 实时处理, 密码管理, 攻击面映射, 数据展示, 日志审计, 红队, 自动化侦察, 运行时操纵, 逆向工具