pepperonas/wp-shield
GitHub: pepperonas/wp-shield
wp-shield 是一款基于 Python 异步架构的 WordPress 黑盒安全审计扫描器,提供免费的本地 CVE 数据库与多格式报告输出,作为 WPScan 的纯净开源替代方案。
Stars: 0 | Forks: 0
# wp-shield
**WordPress 安全审计扫描器** — 一款作为 [WPScan](https://wpscan.com/) 的纯净开源替代方案而构建的工具,专为对您拥有或获得授权测试的 WordPress 安装环境进行合法的黑盒安全审计而设计。
_/
wp-shield scan https://example.com
# 3) 同样的扫描,并在完成后在浏览器中打开 HTML 报告
wp-shield scan https://example.com --open
# 4) 跳过磁盘 artefact(仅限 CLI)
wp-shield scan https://example.com --no-save
# 5) 将 JSON 流式传输到 stdout(在 pipelines 中很有用)
wp-shield scan https://example.com --output json --no-save
# 6) 自定义输出目录(也可通过 config.yaml 配置)
wp-shield scan https://example.com --output-dir /var/lib/wp-shield/scans
# 7) 数据库统计
wp-shield db stats
```
### 自动保存布局
每次扫描都会在 `out/`(或您
配置的 `output.output_dir`)内创建一个带有时间戳的子目录:
```
out/
└── 20260529-185717_wpvulnerability.com/
├── report.txt # ANSI-stripped Rich CLI snapshot — audit-trail friendly
├── report.html # standalone styled report (open in browser)
├── report.json # full Pydantic dump (machine-readable)
└── report.sarif # SARIF 2.1.0 — upload to GitHub Code Scanning
```
`out/` 默认包含在 `.gitignore` 中,因此扫描产物永远不会被提交。
### 单行命令:针对公共 WordPress 站点的实时演示
```
cd /Users/martin/claude/wp-shield && source .venv/bin/activate && \
wp-shield scan https://wpvulnerability.com/ --mode mixed --rate-limit 3 --open
```
此操作将运行礼貌的混合模式扫描,打印实时 Rich 表格,将所有
四种报告格式写入 `out/_wpvulnerability.com/`,并
在您的默认浏览器中打开 HTML 报告。
## 检测模式
`--mode passive` — 仅分析 HTML(零“嘈杂”请求)
`--mode mixed` _(默认)_ — 被动模式 + 针对性的 readme.txt / style.css 探测
`--mode aggressive` — 完整的插件/主题字典枚举(约 1–10 分钟,可能会触发 WAF)
## 配置
可以通过 `~/.config/wp-shield/config.yaml` 覆盖默认设置:
```
http:
timeout: 15
max_concurrency: 10
user_agent: "wp-shield/0.1 (+https://github.com/pepperonas/wp-shield)"
respect_robots_txt: true
rate_limit_per_second: 5
scan:
default_mode: mixed
enumerate_users: true
follow_redirects: true
```
## 法律与道德
`wp-shield` **仅供授权的安全测试**使用。在您未拥有或未获得明确书面测试许可的站点上运行此工具在您的司法管辖区可能属于违法行为(例如德国的 StGB §202a/b、美国的《计算机欺诈和滥用法》、英国的《计算机滥用法》等)。
作者不对滥用行为负责。使用本软件即表示您同意:
1. 您将仅扫描您拥有或获得明确授权进行测试的系统
2. 您对运行扫描产生的任何后果承担全部责任
3. 您将遵守速率限制、`robots.txt` 以及目标系统的稳定性
暴力破解模块(计划在 v0.4 中推出)被**刻意限制**在本地 `~/.config/wp-shield/owned-domains.txt` 白名单之后,以防止意外滥用。
## 架构
- **技术栈**:Python 3.11+、`httpx` (async)、`BeautifulSoup` + `lxml`、`typer` + `rich` (CLI)、`pydantic` (models)、`sqlite3` (vuln cache)、`jinja2` (reports/UI)
- **漏洞数据源**:
- **默认**:[WPVulnerability.net](https://www.wpvulnerability.net/) — 免费,无需 API key,按组件查找。我们使用内置字典中的前 N 个插件/主题 slug 对缓存进行预热。
- **可选**:[Wordfence Intelligence v3](https://www.wordfence.com/products/wordfence-intelligence/) — 由于 2025 年的 v3 迁移,现在需要免费的 Bearer token(其 v1/v2 端点现已返回 HTTP 410 Gone)。
请参阅 `docs/ARCHITECTURE.md`(计划中)。
## 许可证
GPL-3.0-or-later — 与原始的 WPScan 和 WPVulnerability 项目使用相同的许可证。
## 致谢
受到以下项目的启发:
- [WPScan](https://github.com/wpscanteam/wpscan) (Ruby, GPL-3.0) — 参考实现
- [WPVulnerability](https://www.wpvulnerability.com/) — 开放漏洞数据库
- [Wordfence](https://www.wordfence.com/) — 提供免费且可用于商业目的的情报数据源
标签:CVE, Python, Splunk, WordPress, 安全规则引擎, 实时处理, 密码管理, 异步, 数字签名, 无后门, 运行时操纵, 逆向工具