gusta-ve/wraith

GitHub: gusta-ve/wraith

一款基于 pipeline 的纯 Python 进攻型安全扫描器,覆盖从侦察到 Web 漏洞检测的全流程并对每个发现进行双重确认以消除误报。

Stars: 0 | Forks: 0

# wraith

wraith — offensive recon & vulnerability detection pipeline

一款运行从侦察到检测工作流的安全扫描器,将流程构建为 小型可组合阶段的 pipeline。将其指向目标;它会解析主机、 扫描端口、映射 Web 表面、对其进行测试并报告发现 —— 然后 将成果交给 [hickok](https://github.com/gusta-ve/hickok) 来执行后续操作。 其核心没有任何第三方依赖。 [![PyPI](https://img.shields.io/pypi/v/wraith-sec?color=crimson&label=pypi)](https://pypi.org/project/wraith-sec/) [![CI](https://static.pigsec.cn/wp-content/uploads/repos/2026/06/550edec5c5140455.svg)](https://github.com/gusta-ve/wraith/actions/workflows/ci.yml) [![Release](https://img.shields.io/github/v/release/gusta-ve/wraith?color=crimson)](https://github.com/gusta-ve/wraith/releases) ![Python 3.10+](https://img.shields.io/badge/python-3.10%2B-blue) ![MIT](https://img.shields.io/badge/license-MIT-green) - [安装](#install) - [用法](#usage) - [阶段](#phases) - [Web 测试](#web-testing) - [后渗透](#post-exploitation--hickok) - [扩展](#extending) - [实验环境](#lab) ## 安装 pipx 会为你提供一个全局的 `wraith`(在 Kali 上这是正确的选择,因为它通过 PEP 668 屏蔽了系统 pip): ``` sudo apt install -y pipx && pipx ensurepath pipx install wraith-sec # the command is `wraith` pipx install "wraith-sec[http]" # + httpx, faster probing ``` 通过克隆仓库安装: ``` git clone https://github.com/gusta-ve/wraith && cd wraith python3 -m venv .venv && source .venv/bin/activate pip install -e ".[http]" ``` 或者无需安装任何内容:`PYTHONPATH=src python3 -m wraith run target`。
受限网络(代理 / IPv6 损坏 / HTTP-2 故障) 如果 `pip`/`git` 在访问 PyPI 或 GitHub 时超时,请从 [发布页面](https://github.com/gusta-ve/wraith/releases/latest) 下载预构建的 wheel —— 一个文件, 零依赖,无需克隆也无需构建步骤: ``` python3 -m venv ~/.local/share/wraith-venv ~/.local/share/wraith-venv/bin/pip install ./wraith_sec-*.whl # the wheel you downloaded ln -sf ~/.local/share/wraith-venv/bin/wraith ~/.local/bin/wraith ``` `git clone` 失败并提示 *"HTTP2 framing layer"*?强制使用 HTTP/1.1: `git config --global http.version HTTP/1.1`。
## 用法 `run` 是默认命令,因此你只需要提供一个目标: ``` wraith target.com # full pipeline (no subcommand needed) wraith -u https://target.com:8443 # target as a URL (-u/--url); the port is scanned too wraith 10.10.10.5 -p resolve,tcp-scan,http-probe # only these phases wraith target.com -s sessions.json # adds access-control / IDOR wraith target.com -v # progress; -v 2 = attack detail (payloads/requests), -v 3 = responses wraith target.com -x high # exit code 2 on a High+ finding wraith --theme matrix target.com # crimson (default) | matrix | ice | amber | mono wraith showdown # toggle "showdown mode" — wraith plays the catch out (reveal + verdict) wraith phases # list phases and their dependencies ``` 每次运行会在固定的用户专属位置下写入一个独立目录 — 默认为 `~/.local/share/wraith/runs/`(设置 `WRAITH_RUNS` 来移动它,或者 在每次运行时使用 `--workdir`) — 这样 [hickok](https://github.com/gusta-ve/hickok) 就可以从任何地方找到它: ``` ~/.local/share/wraith/runs/target.com-/ workspace.json every host, service, endpoint and finding (resumable) report.md report.html dark, self-contained findings.json ``` 针对内置实验环境(`examples/vuln_app.py`)的一次运行 —— 展示的每个发现都是 wraith 实际捕获的: ![wraith 运行示例](https://static.pigsec.cn/wp-content/uploads/repos/2026/06/9d745d16bb140501.svg) `--no-banner` 和 `--no-color`(或 `NO_COLOR`)会去除用于日志和 CI 的装饰性内容;`WRAITH_THEME` 可设置默认主题。 ## 阶段 每个阶段都会声明它所依赖的阶段。引擎会解析该依赖图,并 并发运行独立的阶段;失败的阶段会被隔离,其 下游阶段会被跳过。所有内容都通过一个持久化的工作区共享。 ``` resolve DNS resolution tcp-scan async TCP connect scan of common ports http-probe status, Server header and title content-discovery path/file wordlist with soft-404 filtering tech-detect server / language / framework / CMS fingerprint vhost virtual-host discovery via Host-header fuzzing template-checks declarative JSON/YAML vulnerability checks security-headers security headers, cookie flags and CORS injection XSS, SQLi (error/boolean/time), command injection, SSTI, LFI, open redirect access-control Broken Access Control and IDOR (needs sessions) ``` ## Web 测试 `injection` 会爬取目标,从查询字符串和表单中提取参数, 并使用一系列技术对其进行探测。每种技术都有一个单一的、 可解释的 oracle —— 并且 **每一次命中在报告之前都会通过第二种方式进行确认**, 因此发现就是证据,而不是猜测: | 技术 | Oracle | 确认方式 | |---|---|---| | 反射型 XSS | 原始的 `<`/`>`/`"` 标记在未经编码的情况下反射出来 | — | | SQLi(基于错误) | 单引号引发数据库错误 | 一个*平衡的*引号会消除该错误 | | SQLi(布尔盲注) | TRUE 条件页面与正常情况匹配,FALSE 条件则发生偏离 | 第二个不同的注入上下文 | | SQLi(时间盲注) | `SLEEP`/`pg_sleep`/`WAITFOR` 延迟响应 | 更长的睡眠时间会带来成比例增加的延迟 | | 命令注入 | `; sleep N` 延迟响应 | 相同的时间相关性证明 | | SSTI | `{{a*b}}` 返回被计算的结果(乘积) | 第二个随机乘积 | | 路径遍历 / LFI | `../../etc/passwd` 返回 `root:x:0:0:` 签名 | 读取两次 | | 开放重定向 | 重定向参数出现在 `Location` 中 | — | 详细程度与其他扫描器一样是分级设置的。`-v`(级别 1)是轻量级的 进度报告 —— 正在测试哪个参数、爬取括号 —— 这样运行过程永远不会 看起来像是卡住了。`-v 2` 是完整的攻击实况:每个 payload、其 oracle 测量值(相似度比率、响应时间)和确认步骤, 以及每个 HTTP 请求。`-v 3` 会增加响应内容: ``` wraith target.com -p injection -v # level 1 — progress only wraith target.com -p injection -v 2 # the detailed attack trace ``` `security-headers` 会报告缺失的 CSP/HSTS/X-Frame-Options/nosniff、脆弱的 cookie 标志以及反射任意来源的 CORS。 `access-control` 需要经过身份验证的会话。它会以高权限会话进行爬取, 并以低权限和匿名身份重放每个请求;如果 低权限主体获得了相同的内容,则属于垂直越权(bypass),并且突变(mutating) 数字 ID 会暴露 IDOR。通过以下方式获取会话: ``` wraith login http://target/login -u alice -p secret \ --user-field user --pass-field password -o sessions.json ``` ## 后渗透 — [hickok](https://github.com/gusta-ve/hickok) wraith 寻找并证明入侵途径;获取 shell 并控制目标主机则是 [**hickok**](https://github.com/gusta-ve/hickok) —— wraith 的配套工具 —— 的工作。它会 读取 wraith 的运行记录并据此采取行动: ``` hickok call # picks up wraith's latest run on its own, flags the footholds hickok -l 9001 # catch the reverse shell ``` wraith 拿着 A,hickok 带来 8 —— A 和 8,死亡之手(Dead Man's Hand)。 ## 扩展 一个阶段就是一个文件;一个检查可以是纯数据。请参阅 [docs/writing-a-phase.md](docs/writing-a-phase.md) 和 [docs/writing-a-template.md](docs/writing-a-template.md)。 ``` from wraith.core.phase import Phase, register @register class MyPhase(Phase): name = "my-phase" requires = frozenset({"http-probe"}) async def run(self, ws, console): for ep in ws.endpoints: ... # ws.add_finding(...) ``` ## 实验环境 `examples/vuln_app.py` 是一个故意设计成包含漏洞的应用,用于练习和 测试每一个 Web 阶段:BAC、IDOR、反射型 XSS、SQLi(基于错误/布尔/时间)、 命令注入、SSTI、路径遍历/LFI、开放重定向、CORS、不安全的 cookie 以及缺失的标头。它的 `/db?id=` 是针对一个真实的 (小型)SQLite 数据库的布尔盲注 SQLi —— 将 [hickok](https://github.com/gusta-ve/hickok) 的 `hickok sql` 指向它以进行遍历和转储。 ``` python3 examples/vuln_app.py & wraith 127.0.0.1 -s examples/sessions.json -v ``` ## 测试 ``` pip install -e ".[dev]" && pytest ``` ## 免责声明 专为安全研究和测试而构建 —— 请将其指向你被授权的目标。其他人 用它做什么由他们自己负责;作者不对滥用行为或 造成的任何损害承担责任。 ## 许可证 MIT。 *你从未预见它的到来 —— 幽灵早已手握 A。*
标签:Blue Team, CISA项目, Python, 插件系统, 无后门, 自动化流水线, 逆向工具