Omar-tamerr/Thoth
GitHub: Omar-tamerr/Thoth
一款 AI 驱动的 CTF 终端导师,通过渐进式提示引导解题而非直接给出答案,帮助学习者在实战中真正掌握渗透技能。
Stars: 1 | Forks: 0
```
████████╗██╗ ██╗ ██████╗ ████████╗██╗ ██╗
██╔══╝██║ ██║██╔═══██╗╚══██╔══╝██║ ██║
██║ ███████║██║ ██║ ██║ ███████║
██║ ██╔══██║██║ ██║ ██║ ██╔══██║
██║ ██║ ██║╚██████╔╝ ██║ ██║ ██║
╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝ ╚═╝
```
**CTF AI 导师 · 学习。解题。成长。**
[](https://python.org)
[](https://kali.org)
[](LICENSE)
[](https://github.com/omar-tamerr)
[-purple?style=flat-square)](https://console.groq.com)
*开源 CLI 工具,利用 AI 引导你通过 CTF 挑战 —— 而不直接剧透答案。*
[**安装**](#-installation) · [**功能**](#-features) · [**题解协作**](#-writeup-collaboration) · [**命令**](#-command-reference)

## 什么是 THOTH?
THOTH 是一个由免费 AI 驱动的 **终端版 CTF 导师**。它在当你进行黑客攻击时陪伴在你身边 —— 扫描端口、推荐工具、提供循序渐进的提示,并随着时间推移学习你的风格。
核心理念很简单:**授人以渔,而非直接告知。**
当你卡住时,THOTH 不会直接把答案交给你。它会询问你尝试过什么,为你指引正确的方向,并且只有在你请求更多帮助时才会逐步深入。每一个提示都是通过努力获得的。
## 两大杀手级功能
### 1. 了解你挑战的 AI
THOTH 的 AI 不是通用的 ChatGPT。每一次回复都会注入你的完整会话上下文 —— 你的目标 IP、哪些端口是开放的、你尝试过哪些工具、你卡了多久,以及你处于哪个阶段。
```
$ thoth ask "why is my reverse shell dying immediately?"
THOTH: Three likely reasons on this box:
1. Your LHOST is wrong — use tun0 not eth0
Run: thoth vpn to check your IP
2. The service runs in a restricted shell environment
3. Try a different payload: cmd/unix/reverse_python
instead of reverse_netcat
```
这不是一个通用的回答。THOTH 知道你在 TryHackMe 上,知道你的 tun0 IP,知道你已经在立足点(foothold)卡了 25 分钟。AI 会适应你 —— 而不是让你去适应 AI。
**AI 命令:**

```
thoth hint # progressive hint — nudge → clue → near-solution
thoth ask "why is X not working" # free-form AI chat about your challenge
thoth analyze --output "error msg" # paste any error, AI explains it
thoth rabbit # AI detects if you are in a rabbit hole
thoth review # post-solve AI performance review
thoth mindset # stuck? get a direct redirect
thoth script "scan all ports then check vulns" # generate shell scripts from English
thoth tools # context-aware tool suggestions
thoth explain CVE-2007-2447 # deep explanation tied to your challenge
```
### 2. 题解智能 —— 无剧透的提示
这是让 THOTH 与众不同的功能。
**问题所在:** 你卡住了。你打开了一篇题解(writeup)。你不小心读得太快。挑战的乐趣毁了。
**THOTH 的解决方案:** 锁定题解 URL。THOTH 会获取它,将其静默解析为各个阶段,并提取关键步骤。你永远看不到原始题解 —— 但你的提示直接来源于它。
```
$ thoth writeup --url https://your-writeup-url.com/room
✓ Writeup fetched and locked.
· 4 stages parsed · 9 key facts extracted
· Solution is protected — you only get nudges
$ thoth hint
Which area are you stuck on?
[1] Enumeration [2] Exploitation [3] Getting a shell [4] PrivEsc
> 1
𓂀 Hint — Enumeration [nudge]
──────────────────────────────
Have you checked what's on port 80 carefully?
Not just what's running — what's inside it.
$ thoth hint ← run again for deeper hint
𓂀 Hint — Enumeration [clue]
──────────────────────────────
The Apache default page has been modified.
Look at the HTML source — there is something hidden there.
```
三个级别。每次你请求提示,它都会变得更加具体。

除非你自己解锁,否则永远不会显示完整的解决方案。**你在学习。而不只是复制。**

## 功能特性
|
**会话管理**
- 命名会话 —— 随时恢复
- 每个会话的完整活动日志
- 将会话导出为 JSON
- 永不丢失你的进度
**智能扫描**
- nmap 集成及自动加载的 playbook
- 20 多个服务 playbook(FTP, SSH, SMB, MySQL, Redis...)
- 每个 playbook 包含默认凭据、CVE 和精确命令
- 从扫描结果生成排名的攻击路径
- 目标的 ASCII 思维导图
**ExploitDB 集成**
- 按文本、CVE ID 或 EDB 编号搜索
- 扫描后自动搜索所有服务
- 通过 searchsploit 离线工作
- 在线回退到 exploit-db.com
|
**题解库**
- 内置精心策划的题解库
- 使用交互式箭头键菜单浏览
- 输入时实时模糊搜索
- 按平台、难度、类别筛选
- 粘贴 THM/HTB URL —— THOTH 会找到题解
- 会话名称自动检测
- 每页 10 个结果
**游戏化**
- 🔥 每日解题连续记录追踪
- ⚡ 成就徽章(Pure Solve, Speed Demon, Veteran...)
- 房间难度评分系统
- 可分享的会话摘要卡片
- 公共排行榜统计
**生活质量**
- 自动 VPN IP 检测(tun0/tun1)
- 网络横向移动指南(chisel, socat, SSH, ligolo-ng)
- 编码解码器(Base64, hex, ROT13, morse, JWT, binary)
- 从会话自动生成 Markdown 题解
- 基于提示历史建立的玩家技能画像
|

## 安装
```
# Clone 仓库
git clone https://github.com/Omar-tamerr/Thoth
cd thoth
# 安装 (全局添加 'thoth' 命令)
chmod +x install.sh
./install.sh
# 或直接运行
python3 thoth.py
```
**系统要求:**
- Python 3.8+(零外部 pip 包)
- nmap(用于扫描):`sudo apt install nmap`
- searchsploit(可选):`sudo apt install exploitdb`
**设置免费 AI(需要 2 分钟):**
```
# 1. 在 https://console.groq.com 获取免费 key (无需信用卡)
# 2. 设置它:
thoth config groq_api_key gsk_your_key_here
# 3. 完成 — 所有 AI 功能现已激活
```

## 快速开始
```
# 1. 为你的 room 启动 session
thoth new
> Session name: THM-Wgel
> Target IP: 10.10.10.3
> Platform: TryHackMe
> Category: web
# 2. 扫描 target
thoth scan
# 3. 加载 writeup (可选但功能强大)
thoth writeup --url https://your-writeup.com
# 4. 卡住时获取提示
thoth hint
# 5. 提交你的 flag
thoth flag THM{your_flag_here}
```
## 题解库
```
thoth library # browse with arrow keys
thoth library --search "web" # search by keyword
thoth library --load wgel # fuzzy load by name
thoth library --url https://tryhackme.com/room/wgelctf # paste room URL
thoth library --update # fetch latest writeups from GitHub
```
**库界面预览:**
```
𓂀 THOTH Writeup Library
─────────────────────────────────────────────────────────
Type to search · Tab for filters · ↑↓ navigate · q quit
ROOM PLATFORM DIFF TAGS
─────────────────────────────────────────────────────────
► Wgel CTF TryHackMe Easy web, ssh
RootMe TryHackMe Easy web, upload
Lame HackTheBox Easy smb, samba
Blue HackTheBox Easy windows, smb
...
Apache web server, hidden SSH key, wget sudo exploitation
slug: THM-Wgel · Enter to load
```
## 题解协作
THOTH 的提示引擎通过加载结构化的题解来工作 —— 而不是原始博客文章。每个题解都是一个 JSON 文件,每个阶段包含 3 个级别的渐进式提示。
**如果你编写 CTF 题解并希望将其加入 THOTH 库,我非常乐意合作。**
### 协作方式:
1. 你编写一个房间题解(博客、Medium、GitHub —— 任何地方)
2. 我们商定条款 —— 你的名字将出现在你的题解生成的每一条提示中
3. 我将其转换为 THOTH 格式并添加到库中
4. 每个解开该房间的 THOTH 用户都会看到你的名字
### 你将获得:
- 你的名字将出现在源自你题解的每一条提示中
- 面向整个 THOTH 用户群的曝光
- 你的题解 URL 将链接在库中
- 仓库中的贡献者徽章
### 联系方式:
在 [thoth-writeups](https://github.com/omar-tamerr/thoth-writeups) 上提出 issue 或直接联系我。
## 命令参考
```
# Session
thoth new # create session
thoth sessions # list all sessions
thoth resume
# resume session
thoth delete # delete session
thoth export # export as JSON
# 扫描
thoth scan # smart nmap + auto-playbooks
thoth scan --ai # scan + AI interpretation
thoth enum --port 445 # service playbook
thoth paths # ranked attack paths
thoth map # ASCII target map
thoth cheat --category web # category cheatsheet
# ExploitDB
thoth exploit --search "vsftpd 2.3.4"
thoth exploit --cve CVE-2007-2447
thoth exploit --id 16320
thoth exploit --auto # auto-search all services
# 指导 (AI)
thoth hint # progressive hint by area
thoth writeup --url # lock + parse writeup
thoth writeup --generate # auto-generate your writeup
thoth tools # context-aware suggestions
thoth explain # deep explanation
thoth decode aGVsbG8= # auto-detect encoding
# AI 命令
thoth ask "question" # free-form AI chat
thoth analyze --output "..." # AI reads command output
thoth rabbit # rabbit hole detection
thoth review # post-solve AI review
thoth mindset # frustration redirect
thoth script "task" # generate shell scripts
# 笔记
thoth note "found anon FTP" # save note
thoth notes # view all notes
thoth log # full activity log
thoth flag THM{...} # submit flag
# 进度
thoth progress # session stage timeline
thoth stats # full dashboard
thoth profile # skill map
thoth streak # solving streak
thoth badges # achievement badges
thoth rate 4 # rate the room
# 库
thoth library # interactive browser
thoth library --search web # search
thoth library --load wgel # fuzzy load
thoth library --url # load by room URL
thoth library --update # fetch latest
# 网络 & 工具
thoth pivot # pivoting guide (chisel, socat, SSH)
thoth pivot chisel # specific technique
thoth vpn # show VPN IP (tun0)
thoth share # shareable session card
thoth leaderboard --share # share stats publicly
# 配置
thoth config # view settings
thoth config groq_api_key gsk_ # set AI key
thoth setup # first-run wizard
thoth help # full help
```
## 文件结构
```
thoth/
├── thoth.py # entry point + CLI router
├── install.sh # global install script
├── requirements.txt # zero pip dependencies
├── core/
│ ├── ai.py # Groq API client (free AI)
│ ├── banner.py # ASCII banner
│ ├── colors.py # ANSI terminal colors
│ ├── config.py # settings management
│ ├── db.py # SQLite — sessions, notes, logs
│ ├── session.py # session CRUD
│ └── writeup_engine.py # fetch + parse + stage writeups
├── commands/
│ ├── scan.py # thoth scan
│ ├── hint.py # thoth hint (AI + writeup)
│ ├── exploit.py # thoth exploit (ExploitDB)
│ ├── library.py # thoth library (interactive)
│ ├── pivot.py # thoth pivot (tunneling)
│ ├── gamify.py # badges, streak, share, vpn
│ ├── decode.py # thoth decode
│ ├── enum_cmd.py # thoth enum, paths, cheat
│ ├── notes.py # thoth note, log, flag
│ ├── progress.py # thoth stats, profile, map
│ ├── tools.py # thoth tools, explain, writeup
│ └── ai_cmds.py # thoth ask, rabbit, review...
└── data/
└── playbooks/ # 20+ service knowledge modules
└── __init__.py # FTP, SSH, SMB, MySQL, Redis...
```
**数据存储位置:**
```
~/.thoth/thoth.db # SQLite — all sessions, notes, profile
~/.thoth/library/ # cached writeup library
~/thoth-writeups/ # generated writeups (.md)
~/thoth-exports/ # exported sessions (.json)
```
## 支持的平台
| Platform | Status |
|---|---|
| TryHackMe | ✓ 完全支持 |
| HackTheBox | ✓ 完全支持 |
| PicoCTF | ✓ 完全支持 |
| VulnHub | ✓ 完全支持 |
| CTFTime | ✓ 完全支持 |
| Any CTF | ✓ 平台无关 |
## 技术栈
- **语言:** Python 3.8+ —— 零外部 pip 依赖
- **AI:** Groq API(免费)—— LLaMA 3.3 70B
- **数据库:** SQLite via stdlib `sqlite3`
- **HTTP:** stdlib `urllib` only
- **终端 UI:** stdlib `termios` + ANSI codes
**Made with ♥ by Omar Tamer · EG**
[GitHub](https://github.com/omar-tamerr) · [题解仓库](https://github.com/omar-tamerr/thoth-writeups)
*如果 THOTH 帮助你攻克了一个房间,请给它一个 ⭐ —— 这有助于更多人发现它。*
标签:AI助手, CLI, DNS解析, Hacking, Python, Ruby, Sysdig, WiFi技术, Writeup, 人工智能, 人机交互, 安全教育, 开源项目, 技能培训, 文档结构分析, 无后门, 渐进式提示, 用户模式Hook绕过, 知识库, 编程辅导, 网络安全, 网络调试, 自动化, 解题思路, 逆向工具, 隐私保护