MacTash/web-cross
GitHub: MacTash/web-cross
一款原生 CLI 的 Web 漏洞扫描器,提供检测、AI 辅助分析及多格式专业报告生成功能。
Stars: 0 | Forks: 0
# Web-Cross 漏洞扫描器 v4.0
一个原生 CLI 的 Web 漏洞扫描器。从单个二进制文件进行检测、AI 辅助分析和报告;没有服务器,没有 UI,没有 daemon。
```
$ webcross scan -u https://example.com --watch
[+] Scanning https://example.com
[+] Done in 12.4s - 7 findings across 1 target(s)
[+] Wrote html: ./webcross-out/20260719-134022/webcross-20260719-134022.html
```
## 为什么使用 CLI
v3.x 在 CLI 旁边发布了一个 Flask Web UI。v4.0 放弃了 UI:每个功能都可以作为子命令访问,每个输出都是一个 flag,每个长时间运行的任务都可以被管道传输或监视。如果你需要 daemon,请使用 systemd 或 cron job 包装 `webcross`。有关基本原理,请参阅 `docs/adr/0001-drop-server.md`。
## 安装
```
# 推荐:pipx(隔离,CLI 优先)
pipx install web-cross
# 或者:pip
pip install web-cross
# 可选 extras:
pip install 'web-cross[ai]' # Anthropic + Groq SDKs
pip install 'web-cross[pdf]' # WeasyPrint for PDF reports
pip install 'web-cross[all]' # everything
```
## 快速开始
```
# 快速扫描
webcross scan -u https://example.com
# 全面扫描,保存报告并持久化扫描
webcross scan -u https://example.com --format all --out report/
# 运行部分模块
webcross scan -u https://example.com --modules sqli,xss,csrf
# 从文件读取目标(每行一个,允许 # 注释)
webcross scan --file targets.txt
# 从 stdin 读取目标
cat targets.txt | webcross scan --stdin
# TUI 进度覆盖层(计划于 Phase 1)
webcross scan -u https://example.com --watch
# 60 秒后取消(计划于 Phase 1)
webcross scan -u https://example.com --cancel-after 60
```
## 子命令
```
webcross
├── scan Run a vulnerability scan
├── list List stored scans
├── show SCAN_ID Show one scan's findings
├── report SCAN_ID Render a scan to a file
├── diff SCAN_A SCAN_B Compare two scans finding-by-finding
├── delete SCAN_ID Delete a stored scan
├── payload Manage the payload corpus
├── cve Local CVE cache
├── config Inspect the resolved configuration
├── tui SCAN_ID Open the textual dashboard for a stored scan
└── shell-completion Emit a shell completion script
```
## 输出格式
`webcross scan` 和 `webcross report` 都支持:
- `html` (默认)— 包含风险仪表、发现卡片和修复建议的单文件报告
- `json` — 机器可读;非常适合通过管道传递给 `jq` 或其他工具
- `text` — 对终端友好
- `pdf` — 可打印的高管报告
- `sarif` — SARIF 2.1.0,准备好用于 `gh code-scanning upload` (第二阶段)
- `all` — 输出所有内容
将 JSON 输出通过管道传递给其他工具:
```
# 仅以 TSV 格式显示严重发现结果
webcross show --severity critical --format tsv
# 生成 GitHub-PR-comment 风格的 diff
webcross diff --format markdown > /tmp/diff.md
```
## AI 分析
`--ai` 启用基于 LLM 的二次分析。支持的 provider:Anthropic (Claude), Groq (Llama 3.3 / Mixtral), Ollama (本地)。
```
webcross scan -u https://example.com --ai --ai-provider anthropic --ai-key sk-ant-...
webcross scan -u https://example.com --ai --ai-provider ollama
```
如果没有配置 provider,`--ai` 将是一个空操作,并且扫描将继续输出确定性扫描器的结果。
## 配置
分层结构:CLI flags > `WEBCROSS_*` 环境变量 > `~/.config/webcross/config.toml` > `./webcross.toml` > 默认值。
```
webcross config show # print the resolved config
webcross config path # show which TOML files are read
```
## 测试
```
# 单元 + 集成测试
pytest tests/ -v
# 仅 CLI 冒烟测试(无需网络)
pytest tests/test_cli.py -v
# 针对进程内 fixture 应用进行 End-to-end 扫描
pytest tests/test_cli_integration.py -v
```
## Docker
```
# 构建
docker build -t webcross:4.0 .
# 扫描
docker run --rm -v "$PWD/out:/home/webcross/.local/share/webcross/out" \
webcross:4.0 scan -u https://example.com --out-dir out/
# Shell 进入预装 [dev] extra 的镜像
docker run --rm -it -v "$PWD:/app" webcross:4.0 bash
```
该容器仅提供 CLI。没有暴露的端口,也没有 HEALTHCHECK —— `docker run` 是每次扫描即发即弃的。
## 架构(阶段 0)
```
webcross/ # new top-level package
cli.py # click group, --version, --color, --debug
errors.py # WebcrossError hierarchy
console.py # rich console singleton, color/unicode detection
config.py # layered config: TOML < env < explicit
commands/
scan.py # delegates to scanner.py via _shim
list_cmd.py # `webcross list`
show.py # `webcross show`
report.py # `webcross report`
diff.py # `webcross diff`
delete.py # `webcross delete`
payload.py # `webcross payload`
cve.py # `webcross cve` (Phase 3)
config_cmd.py # `webcross config`
tui.py # `webcross tui` (Phase 4)
completion.py # `webcross shell-completion`
_shim.py # back-compat bridge to scanner.py
core/ # existing infra, mostly unchanged
http_client.py # AsyncHTTPClient (httpx-based)
store.py # renamed from scan_store.py
...
modules/ # existing scanners, unchanged in Phase 0
reporting/ # existing generators, unchanged
database/ # existing SQLAlchemy layer, unchanged
tests/
test_cli.py # click CliRunner smoke tests
test_cli_integration.py# fixture-app end-to-end tests
fixtures/
vuln_app.py # stdlib http.server fixture
scanner.py # legacy argparse shim, will be removed in 4.0.0 final
```
## 状态
这是 `4.0.0a0` —— 原生 CLI 重新设计的第一个 alpha 版本。有关至 4.0.0 final 的路线图,请参阅
`/mnt/Extra1/aiprojects/web-cross/.hermes/plans/2026-07-19-cli-native.md`
阶段 0 已完成:
- [x] `server.py` 已删除;Flask 依赖已移除
- [x] `core/scan_store.py` -> `core/store.py`
- [x] `pyproject.toml` 包含 `extras_require` 和 `webcross` 入口点
- [x] `webcross` 包具有完整的子命令树
- [x] `scanner.py` shim 保留了 `python scanner.py -u URL` 的向后兼容性
- [x] `tests/fixtures/vuln_app.py` 标准库 fixture
- [x] `tests/test_cli.py` 冒烟测试
- [x] `tests/test_cli_integration.py` 端到端测试
- [x] Dockerfile 切换至 `python:3.12-slim` 和 `ENTRYPOINT ["webcross"]`
- [x] docker-compose profiles (`cli`, `dev`)
- [x] `ruff.toml` 和 `pytest.ini` 已移除;合并至 `pyproject.toml`
- [x] CI 矩阵提升至 py3.12 + py3.13,并带有 CLI 冒烟测试任务
阶段 1+ 的工作记录在计划文件中。
## 法律声明
Web-Cross 仅用于授权的安全测试。在扫描任何系统之前,请务必获得适当的授权。作者不对任何滥用行为负责。
## 许可证
MIT — 请参阅 `LICENSE`。
标签:AI辅助分析, CISA项目, Python, Web漏洞扫描, 无后门, 请求拦截, 运行时操纵, 逆向工具