markl-a/phantom-secops
GitHub: markl-a/phantom-secops
一个基于phantom-mesh的多智能体安全运营研究平台,用于在隔离环境中模拟红蓝对抗的完整杀伤链与防御检测流程。
Stars: 0 | Forks: 0
# phantom-secops
[](https://github.com/markl-a/phantom-mesh)
[](LICENSE)
[](docker-compose.yml)
## 当前验证
最新的本地验证:
- `python scenarios/run_kill_chain.py --target juice-shop --mock`:通过
- `python -m pytest tests -q`:28 个通过
目前的声明仅限于红/蓝队编排、报告生成和仅限实验室的证据。不包含生产级 SOC 自动化、0-day 漏洞发现或第三方扫描。
## 它的功能(60 秒了解)
两组 phantom-mesh agent 并行运行,针对运行在 Docker compose 实验环境中的故意设置漏洞的目标(OWASP Juice Shop、DVWA、Metasploitable):
```
RED TEAM (attack simulation) BLUE TEAM (defensive ops)
───────────────────────────── ─────────────────────────────
Recon ── Nmap, dnsrecon, subfinder Alert Triage ── classify SIEM
│ │ alerts, dedupe
▼ ▼
Vuln Scan ── Nuclei, Nikto Log Anomaly ── baseline +
│ │ outlier detect
▼ ▼
Exploit Suggest ── CVE matcher, Threat Correlate ── kill chain
│ POC text only │ reconstruction
▼ ▼
Pentest Report ─── markdown out Incident Report ── exec summary
```
两个团队都会生成 markdown 报告。有趣的部分在于**并排对比**:攻击者达到影响所需的时间与防御者检测到威胁所需的时间的对比——该指标直接映射到真实 SOC 中使用的 MTTD(平均检测时间)。
## 为什么会有这个项目
phantom-mesh 的多 agent 运行时非常适合安全操作,原因如下:
1. **XDR 本质上是多源关联。** Trend Vision One™、Microsoft Defender XDR、CrowdStrike Falcon 都会交叉引用来自 endpoint + network + identity + cloud 的信号。将每个源映射到一个 agent,并让它们通过 phantom-mesh 进行协调,是一种非常契合的方案。
2. **Pentest 工作流是会分叉的顺序管道。** 侦察结果为漏洞扫描提供输入,而漏洞扫描又为漏洞利用建议提供输入。每个步骤都是一个带有工具预算的 agent。
3. **LLM 辅助的分类可减轻警报疲劳。** 蓝队 agent 以一种小规模、可观察的方式展示了这一点。
这个仓库是一个**研究游乐场**——不是生产工具,不是 0-day 武器,也不是一项商业服务。
## 快速开始
### Mock 模式 —— 无需 docker,无需 API key,在任何地方运行耗时不到 1 秒
```
git clone https://github.com/markl-a/phantom-secops
cd phantom-secops
make demo-mock
```
输出:
```
→ phantom-secops kill-chain :: target=juice-shop mock=True
[t+ 0.0s] red-recon → 1 open ports
[t+ 0.0s] red-vuln-scan → 5 findings (1 medium, 2 low, ...)
[t+ 0.0s] red-exploit-suggest done
[t+ 0.0s] blue-log-anomaly → 21 raw alerts
[t+ 0.0s] blue-alert-triage → 5 triaged groups
[t+ 0.0s] blue-threat-correlate → 1 actor(s)
[t+ 0.0s] done
→ artifacts: reports/runs//{pentest-report.md, incident-report.md,
recon.json, vuln-scan.json,
alerts.jsonl, triage-queue.jsonl,
kill-chains.jsonl, exploit-suggestions.md}
```
这会在预设数据上运行完整的红/蓝 agent pipeline。使用它来探索工件结构和报告模板,而无需启动 docker。测试通过 `make test` 运行(7 个单元测试,涵盖模式匹配器和分类逻辑)。
### Live 模式 —— 针对 docker 实验环境
```
make lab-up # bring up Juice Shop + DVWA on the private docker network
make demo # full kill-chain against the live lab
make lab-down # tear down
# Optional: with phantom-mesh LLM-driven prose
phantom serve & # phantom-mesh HTTP API at :7878
make demo # runner picks it up if phantom is reachable
```
实验环境目标绑定到一个私有的 docker 网络。它们**不会暴露给你的主机或互联网**(参见 `docker-compose.yml`)。所有的 `Makefile` 目标都可以通过 `make help` 列出。
## phantom-mesh 集成(live 模式 v2)
自 2026-05-04 起,phantom-secops 附带了三个 MCP server wrapper,允许 phantom-mesh agent 直接驱动 kill-chain pipeline:
- `secops_recon` —— 包装 `tools/nmap_runner.py`
- `secops_log` —— 包装 `tools/log_anomaly.py`
- `secops_self_audit` —— 扫描 phantom 自己的 `agents.toml`
要在配备了 phantom-mesh 的主机上启用:
```
export PHANTOM_SECOPS_ROOT=$(pwd)
make mesh-mcp-config # prints [[mcp_servers]] entries
make mesh-sync # prints [agent.X] rendered fragments
# Append both outputs to ~/.phantom-mesh/agents.toml on the phantom-mesh
# coordinator host, then restart phantom serve.
```
设计:参见 `docs/specs/2026-05-04-phantom-mesh-integration.md`。
计划:参见 `docs/superpowers/plans/2026-05-04-phantom-mesh-integration.md`。
## 仓库布局
```
phantom-secops/
├── docker-compose.yml # isolated lab (Juice Shop, DVWA, Metasploitable)
├── agents/
│ ├── red/ # attack-side agent configs (TOML, phantom format)
│ │ ├── recon.toml
│ │ ├── vuln-scan.toml
│ │ ├── exploit-suggest.toml
│ │ └── pentest-report.toml
│ └── blue/ # defense-side agent configs
│ ├── alert-triage.toml
│ ├── log-anomaly.toml
│ ├── threat-correlate.toml
│ └── incident-report.toml
├── tools/ # phantom tool wrappers (Python)
│ ├── nmap_runner.py
│ ├── nuclei_runner.py
│ └── log_ingest.py
├── lab/ # docs for each target's setup
├── scenarios/ # markdown scenarios runnable by phantom
│ ├── full-kill-chain.md
│ └── alert-triage-demo.md
├── reports/ # sample output reports (anonymized)
├── docs/
│ ├── ARCHITECTURE.md
│ └── INTERVIEW-TALK-TRACK.md
├── ETHICS.md # legal/ethical framing — read first
└── LICENSE
```
## 状态
| 组件 | 状态 |
|---|---|
| Docker compose 实验环境 (Juice Shop, DVWA) | ✅ 语法已验证,可运行 |
| Mock 模式端到端演示 (`make demo-mock`) | ✅ 可在任何机器上运行,<1s |
| 侦察 agent(Nmap 编排) | ✅ 正常工作,带有 lab-target 门控 |
| 漏洞扫描 agent(Nuclei wrapper) | ⚙️ wrapper 已完成;实时集成进行中 |
| 漏洞利用建议器(CVE → POC 文本) | ✅ 模板驱动的文本生成;可通过 `--use-llm` 选择启用 LLM 驱动 |
| 蓝队日志异常检测(URL 解码的模式匹配器) | ✅ 正常工作,7 个单元测试通过 |
| 蓝队分类与关联(按 actor + ATT&CK 阶段分组) | ✅ 正常工作 |
| 红蓝队并排报告(pentest + incident markdown) | ✅ 正常工作 |
| 测试 (`python -m pytest tests -q`) | ✅ 在最新本地验证中通过 28 个测试 |
| Live 模式 kill-chain(针对运行中的 docker 实验环境) | ⚙️ 部分完成 —— 侦察路径正常工作;nuclei 路径需要预装 nuclei 的容器 |
## 道德与合法性
**使用前请阅读 [ETHICS.md](ETHICS.md)。**
简述:
- 本实验环境中的所有目标都是合法分发、故意设置漏洞的应用程序,专为安全研究和教育而维护(OWASP Juice Shop、DVWA、Metasploitable)。
- 使用的所有工具(Nmap、Nuclei、Nikto)均是合法、公开可用的防御性研究工具。
- 漏洞利用建议器 agent **仅以文本形式生成 POC 描述**。它不生成或执行武器化的漏洞利用。
- 实验环境运行在隔离的 docker 网络上——从不在公共网络或第三方系统上运行。
## 相关项目
- 🌟 [phantom-mesh](https://github.com/markl-a/phantom-mesh) —— 本项目所依赖的 agent 运行时。
- 📖 [GarageSwarm](https://github.com/markl-a/GarageSwarm) —— phantom-mesh 的 Python 前身。
## 许可证
Apache-2.0
标签:AMSI绕过, CISA项目, Claude, CTI, Cursor, CVE检测, DNS 反向解析, Docker, DVWA, FTP漏洞扫描, IP 地址批量处理, MCP Server, Metasploitable, OPA, OWASP Juice Shop, PE 加载器, phantom-mesh, PyRIT, SecOps, TGT, 云安全架构, 多智能体系统, 大语言模型应用, 威胁检测, 子域名变形, 安全报告生成, 安全测试, 安全编排, 安全运营, 安全防御评估, 密码管理, 异常检测, 扫描框架, 插件系统, 攻击性安全, 攻防演练, 数据泄露, 模型上下文协议, 混合加密, 红队模拟, 网络信息收集, 网络安全, 网络安全审计, 网络靶场, 自动化与自动化化(Automation), 蓝队防御, 请求拦截, 逆向工具, 隐私保护, 靶场