G36maid/ctf-arsenal
GitHub: G36maid/ctf-arsenal
面向 5 小时 Jeopardy CTF 竞赛的离线工具集,集成 Pwn/Web/ICS 等多题型模板与脚本,支持 OpenCode Agent 技能模块化调用。
Stars: 3 | Forks: 0
# CTF Arsenal - 竞赛工具箱
针对 **5 小时 Jeopardy CTF** 设计的离线工具箱,重点支援:
- **Binary Exploitation (Pwn/Rev)**
- **工业控制情境 (ICS) - Ettercap MITM**
- Web, Crypto, Forensics, Misc
**🆕 现已支持 OpenCode Skills 结构** - 所有工具已整理为可自动发现的技能模块,详见 [`.agents/skills/`](.agents/skills/)
## 快速开始
### 1. 安装
```
cd ctf-arsenal
bash scripts/setup-arch-paru.sh # Arch Linux + paru
# 或使用 scripts/setup.sh (通用版本)
```
### 2. 启用环境
```
source venv/bin/activate
```
### 3. 配置 GDB
```
cp .agents/skills/pwn-exploits/gdb_init/gdbinit-pwndbg ~/.gdbinit
```
## 目录结构
```
ctf-arsenal/
├── .agents/skills/ ⭐ OpenCode 技能模組
│ ├── pwn-exploits/ → Binary exploitation
│ │ ├── SKILL.md → 技能定義與工作流程
│ │ ├── templates/ → Pwn 模板 (pwn_basic.py, pwn_rop.py 等)
│ │ ├── tools/ → checksec, offset_finder 等
│ │ ├── gadgets/ → ROPgadget 腳本
│ │ └── references/ → GDB cheat sheet
│ ├── web-exploits/ → Web vulnerability testing
│ ├── ics-traffic/ → ICS/SCADA (Ettercap, Scapy)
│ ├── crypto-tools/ → Cryptography tools
│ ├── forensics-tools/ → Digital forensics
│ └── misc-tools/ → Miscellaneous challenges
│
├── scripts/ 🛠️ 安裝腳本
│ ├── setup-arch-paru.sh → Arch Linux 自動安裝
│ ├── setup.sh → 通用版本
│ └── INSTALL_INSTRUCTIONS.sh
│
├── docs/ 📚 詳細文檔
│ ├── SESSION_SUMMARY.md → 完整專案總覽
│ ├── INSTALL_INSTRUCTIONS.md
│ ├── SYSTEM_CHECK.md
│ └── ...
│
├── static_bins/ 💾 靜態二進位檔
├── tests/ 🧪 測試與驗證腳本
├── csc2025/ 📂 CSC 2025 比賽相關資源
├── README.md 📘 本文件
├── AGENTS.md 🤖 OpenCode Agent 指南
└── pyproject.toml 🐍 Python 配置 (uv)
```
详见 [`.agents/skills/README.md`](.agents/skills/README.md) 了解完整技能结构。
## 重要提醒
### 工控情境题准备 (官方明确提示)
**必须熟悉 Ettercap!**
1. **启用 IP Forwarding**
sudo sysctl -w net.ipv4.ip_forward=1
2. **ARP Spoofing 基本指令**
sudo ettercap -T -i eth0 -M arp:remote /target_ip/ /gateway_ip/
3. **使用 Filter**
sudo etterfilter modbus_filter.etter -o modbus_filter.ef
sudo ettercap -T -i eth0 -M arp:remote /target/ /gateway/ -F modbus_filter.ef
4. **快速参考**
- 详见 `.agents/skills/ics-traffic/references/ettercap_usage.md`
- Modbus Port: `502`
- IEC 104 Port: `2404`
- DNP3 Port: `20000`
### Pwn 题快速流程
**0. 静态分析** (rev 题型或首次接触):
```
# 查找字串線索
strings ./vuln | grep -i flag
# Ghidra 反編譯理解邏輯
# 或用批次反編譯: python .agents/skills/pwn-exploits/decompile.py vuln
# GDB 動態驗證
python solve.py GDB
```
**1. 复制模板**
```
cp .agents/skills/pwn-exploits/templates/pwn_basic.py solve.py
```
**2. 检查保护**
```
checksec ./vuln
```
**3. 找 offset**
```
python solve.py
```
**4. GDB 调试**
```
python solve.py GDB
```
**5. 打远程**
```
python solve.py REMOTE 192.168.1.100 1337
```
### 常用工具速查
| 类别 | 工具 | 用途 |
|------|------|------|
| **Pwn** | pwntools | Exploit 开发 |
| | ROPgadget/ropper | ROP chain |
| | one_gadget | 快速 shell |
| **ICS** | Ettercap | MITM 攻击 |
| | Scapy | 封包操作 |
| | Wireshark | 流量分析 |
| **Web** | requests | HTTP 操作 |
| | sqlmap | SQL Injection |
| **Crypto** | RsaCtfTool | RSA 攻击 |
| | CyberChef | 编解码 |
## 工具安装清单
### Arch Linux 软件包
```
sudo pacman -S python-pwntools gdb pwndbg gef ropgadget ropper \
ettercap wireshark-qt nmap socat tcpdump \
ruby python-requests python-scapy
```
### Ruby Gems
```
# 安裝到用戶目錄 (無需 sudo)
gem install one_gadget seccomp-tools
# 設置 PATH (臨時)
source scripts/setup_gem_path.sh
# 或永久設置 (添加到 ~/.zshrc)
echo 'export PATH="$HOME/.local/share/gem/ruby/3.4.0/bin:$PATH"' >> ~/.zshrc
```
### Python (venv)
```
pip install pwntools requests beautifulsoup4 scapy pycryptodome
```
## 比赛当天检查清单
- [ ] `git clone` 此 repo 到比赛机器
- [ ] 执行 `bash scripts/setup-arch-paru.sh` 安装工具
- [ ] 测试 `python .agents/skills/pwn-exploits/templates/pwn_basic.py`
- [ ] 确认 GDB 正常 (pwndbg/gef)
- [ ] 设置 Ruby gems PATH: `source scripts/setup_gem_path.sh`
- [ ] 验证 one_gadget: `one_gadget --version`
- [ ] 测试 Ettercap: `sudo ettercap -T -i eth0 -M arp`
- [ ] 确认 IP forwarding: `sudo sysctl -w net.ipv4.ip_forward=1`
- [ ] 快速浏览 `.agents/skills/*/SKILL.md` 了解工作流程
## 常见问题
### GDB 没有载入 pwndbg/gef
```
echo 'source /usr/share/pwndbg/gdbinit.py' >> ~/.gdbinit
```
### one_gadget 或 seccomp-tools 未找到
```
# 臨時設置 PATH
source scripts/setup_gem_path.sh
# 永久設置
echo 'export PATH="$HOME/.local/share/gem/ruby/3.4.0/bin:$PATH"' >> ~/.zshrc
```
### Ettercap 需要 root
```
sudo ettercap ...
```
### Scapy 需要 root
```
sudo python3 script.py
```
### 找不到 rockyou.txt
```
cd .agents/skills/web-exploits/wordlists/SecLists
tar -xzf Passwords/Leaked-Databases/rockyou.txt.tar.gz
```
## 进阶参考资源
### 完整文档
详见 [`docs/`](docs/) 目录:
- [`SESSION_SUMMARY.md`](docs/SESSION_SUMMARY.md) - 完整项目总览与使用指南
- [`INSTALL_INSTRUCTIONS.md`](docs/INSTALL_INSTRUCTIONS.md) - 详细安装说明
- [`SYSTEM_CHECK.md`](docs/SYSTEM_CHECK.md) - 工具安装检查清单
### 工控安全
- Modbus 协议: `.agents/skills/ics-traffic/protocol_docs/`
- Ettercap 官方文档: https://www.ettercap-project.org/
- ICS CTF Writeups: https://github.com/neutrinoguy/awesome-ics-writeups
### Binary Exploitation
- Pwntools 文档: https://docs.pwntools.com/
- Pwndbg GitHub: https://github.com/pwndbg/pwndbg
- ROPEmporium: https://ropemporium.com/
### Web Security
- PayloadsAllTheThings: https://github.com/swisskyrepo/PayloadsAllTheThings
- OWASP: https://owasp.org/
## 授权
教育与 CTF 竞赛使用。工具版权归原作者所有。
标签:Arch Linux, CISA项目, CTF工具箱, CTF框架, Ettercap, GDB调试, ICS/SCADA, OpenCode Skills, PKINIT, Pwn, Pwntools, ROP链构造, Scapy, Web安全, XXE攻击, 中间人攻击, 二进制漏洞利用, 云资产清单, 域环境安全, 安全技能模块, 客户端加密, 客户端加密, 客户端加密, 密码学, 工控安全, 应用安全, 手动系统调用, 插件系统, 数字取证, 漏洞利用模板, 离线工具包, 竞赛工具, 网络安全, 自动化安全代理, 自动化脚本, 蓝队分析, 逆向工具, 逆向工程, 隐私保护