yiwtng/ctf-analytics-platform
GitHub: yiwtng/ctf-analytics-platform
这是一个自动化CTF竞赛分析平台,通过AI反馈评估玩家解题技能并提升学习效果。
Stars: 0 | Forks: 0
# CTF 分析平台
[](LICENSE)
[](docker-compose.yml)
[](platform/orchestrator/requirements.txt)
[](https://ctfd.io)
本仓库包含了一个研究系统的完整实现,该系统已提交至:
## 概述
传统的 CTF 平台仅通过得分或解题数量来评估玩家——忽略了隐藏在*玩家如何解决问题*这一过程中的更丰富的行为信号。该系统扩展了 [CTFd](https://ctfd.io),增加了:
- **事件级遥测** — 捕获每一次有意义的交互(Web 请求、TCP 握手、SSH 命令、Flag 提交、提示使用)
- **基于规则的技能分析** — 从事件日志中推导出 7 个技能维度
- **AI 驱动的个性化报告** — 使用 Gemini / OpenAI 生成泰语自然语言反馈
- **纵向队列跟踪** — 比较玩家在多轮比赛中的发展
### 关键成果(原型阶段 — NCCIT 2026)
| 指标 | 数值 |
|---|---|
| 跟踪的真实用户 | 32 个账户 |
| 捕获的总事件数 | 2,434 |
| 生成的技能报告数 | 538 |
| 生成的 AI 报告数 | 172(31/32 通过 Gemini 2.5) |
| 调查问卷回复 | 39 份 |
| 平均解题数(队列第 1 轮 → 第 3 轮) | 4.33 → **7.00** |
| 平均准确率(队列第 1 轮 → 第 3 轮) | 65.33% → **85.67%** |
## 系统架构
```
Players / Browser
│
[Traefik] ─── reverse proxy (HTTP/HTTPS/TCP/SSH)
/ \
[CTFd] [Orchestrator] ←── FastAPI analytics backend
(game UI) │
[Analytics DB] ─── PostgreSQL (events, skill reports, AI reports)
│
[AI Backend] ─── Gemini 2.5 / OpenAI / rule-based fallback
│
[Grafana] ─── monitoring dashboards
[CTFd DB] PostgreSQL [Redis] cache
```
### 数据流
```
Player action
→ event logged (CTFd plugin / challenge container)
→ stored in analytics_db.events
→ Rule-Based Analysis → 7 skill scores
→ AI pipeline (Gemini → OpenAI → rule-based fallback)
→ personalized report (strengths, weaknesses, recommendations)
→ displayed on /report page + /admin-reports dashboard
```
## 题目集
### 红队(交互式 — 基于 Docker)
| 题目名称 | 类型 | 测量技能 |
|---|---|---|
| Red - Ghost Login | Web / HTTP | Web 侦察 |
| Red - Protocol Probe | TCP / nc | 协议分析 |
| Red - Pivot Notes | SSH | SSH 跳板 |
| Red - Log Poisoning | Web / HTTP | Web 侦察 + 准确性 |
### 蓝队(分析型 — 静态)
| 题目名称 | 难度 | 测量技能 |
|---|---|---|
| Blue - Misleading Intel | 简单 | 蓝队分析 |
| Blue - Slow Think Fast Guess | 简单 | 蓝队分析 + 时间效率 |
| Blue - Beacon Pattern | 简单 | 蓝队分析 + 时间效率 |
| Blue - Hint Dependency | 中等 | 蓝队分析 + 持久性 |
| Blue - Suspicious Archive | 中等 | 蓝队分析 + 持久性 |
| Blue - Multi-stage Flag | 中等 | 蓝队分析 + 准确性 |
| Blue - Lateral Movement Clue | 困难 | 蓝队分析 + 持久性 |
| Blue - Persistence Finder | 困难 | 蓝队分析 + 准确性 |
## 技能维度
根据事件日志推导出的七个技能分数(0-100):
| 维度 | 公式 |
|---|---|
| 准确性 | `C / (C + W) × 100` |
| 持久性 | `max(0, 40 + 5S − 10G − 3E)` |
| Web 侦察 | `max(0, 50 + 2Q − 8F + 15W_web)` |
| 协议分析 | `max(0, 50 + 10H + 20P − 6M − 5A)` |
| SSH 跳板 | `max(0, 50 + 3K + 20L − 8E_ssh)` |
| 蓝队分析 | `max(0, 50 + 4U + min(O,10) + 12B − 4X − 3Y)` |
| 时间效率 | `max(0, 70 − 10R − 3W − 3E)` |
总体水平:**发展中**(<60)/ **中级**(60–79)/ **高级**(≥80)
## 研究方法论
该平台支持一项准实验性、被试间设计的纵向重复测量研究(3 轮 CTF 比赛)。参与者被随机分配到:
- **对照组**:仅提供得分反馈的标准 CTF
- **处理组**:标准 CTF + 七维度技能报告 + LLM 生成的个性化反馈
分配采用**区组随机化**(区组大小 = 4),以确保整个招募过程中组别分配的均衡。学习理论基础见 [docs/design_rationale.md](docs/design_rationale.md),完整的复现步骤见 [REPRODUCE.md](REPRODUCE.md)。
## 研究伦理
本研究在 KMUTNB 人类研究伦理委员会的 IRB 批准下进行,并符合泰国《个人数据保护法》(PDPA, B.E. 2562)。所有参与者数据均使用稳定的参与者代码(P001, P002, …)进行假名化处理。没有个人身份信息传输给第三方 AI API。知情同意书和 PDPA 合规文件见 [docs/ethics/](docs/ethics/)。
## 仓库结构
```
ctf-analytics-platform/
├── docker-compose.yml # Full stack deployment
├── .env.example # Environment variable template
├── LICENSE # MIT License
├── CITATION.cff # Machine-readable citation
│
├── platform/ # Core platform services
│ ├── ctfd/ # CTFd customization
│ │ ├── Dockerfile
│ │ └── plugins/
│ │ └── admin_reports/ # Custom admin UI (reports, cohort comparison)
│ ├── orchestrator/ # FastAPI analytics backend
│ │ └── app/
│ │ ├── main.py # API endpoints
│ │ ├── session_manager.py # Docker session lifecycle
│ │ ├── report_service.py # Skill analysis + AI pipeline
│ │ └── events.py # Event storage
│ ├── traefik/ # Reverse proxy config
│ └── monitoring/ # Grafana dashboards
│
├── challenges/ # CTF challenge set
│ ├── red/ # Interactive Docker challenges
│ └── blue/ # Analysis-based (static) challenges
│
├── database/ # PostgreSQL schemas & migrations
│ ├── init/ # Auto-run on first startup
│ └── migrations/
│
├── tools/ # Research & operational scripts
│ ├── setup/ # create_all_challenges.py, create_users.py
│ ├── research/ # export_anonymized_dataset.py, generate_manifest.py, verify_data_provenance.py
│ └── analysis/ # generate_all_ai_reports.py, analyze_red_behavior.py
│
├── scripts/ # Shell scripts (start, stop, setup)
├── apt42_ctfd_themes/ # CTFd themes (git submodule)
└── docs/ # Documentation & figures
├── deployment.md
└── figures/
```
## 快速入门
完整的设置说明请参见 [docs/deployment.md](docs/deployment.md)。
**快速启动:**
```
git clone --recurse-submodules https://github.com/yiwtng/ctf-analytics-platform.git
cd ctf-analytics-platform
cp .env.example .env # fill in your credentials
docker compose up -d
```
## 管理界面
| URL | 描述 |
|---|---|
| `/admin-reports` | 查看并为所有玩家生成技能报告和 AI 报告 |
| `/admin-feedback` | 查看参与者调查问卷回复 |
| `/admin-round-comparison` | 比较玩家在不同轮次中的发展 |
| `/report?user=` | 玩家个人报告(面向玩家) |
| `/survey` | 赛后反馈问卷 |
## 引用
如果您在研究中使用了本系统或数据集,请引用:
```
@article{wutthiamornthada2026ctf,
title = {Automated Analysis of Problem-Solving Skills with {LLM}-Generated
Feedback in Capture-the-Flag Cybersecurity Education},
author = {Wutthiamornthada, Thanagrit and Wisitpongphan, Nawaporn},
journal = {IEEE Transactions on Learning Technologies},
year = {2026},
note = {Manuscript under review}
}
```
## 许可证
本项目采用 [MIT 许可证](LICENSE) 授权。
标签:AI反馈, Apex, CTF竞赛, Docker容器化, FastAPI框架, Gemini模型, Grafana监控, OpenAI集成, PostgreSQL数据库, Python开发, SEO优化, 个性化学习, 事件监控, 人工智能应用, 代码示例, 反馈生成, 性能跟踪, 技能评估, 搜索引擎查询, 教育技术, 数据分析, 数据管道, 机器学习, 测试用例, 用户行为分析, 研究平台, 纵向研究, 网络安全, 自动化系统, 自然语言生成, 规则分析, 请求拦截, 软件工程, 逆向工具, 隐私保护