gatiella/webpwn

GitHub: gatiella/webpwn

WebPwn 是一款模块化的 Python Web 应用漏洞扫描器,通过内置爬虫和十余种检测模块自动化发现常见 Web 安全漏洞并生成报告。

Stars: 0 | Forks: 0

# ⚡ WebPwn — Web 应用漏洞扫描器 ## 📁 目录结构 ``` webpwn/ ├── main.py # Entry point — run this ├── requirements.txt # Python dependencies ├── core/ │ ├── scanner.py # Orchestrates all modules │ ├── crawler.py # URL discovery / crawling │ └── requester.py # HTTP session management ├── modules/ │ ├── headers.py # Security header analysis │ ├── cors.py # CORS misconfiguration scanner │ ├── csrf.py # CSRF token detection & bypass │ ├── sqli.py # SQL injection (error + time-based) │ ├── xss.py # Reflected XSS + SSTI │ ├── ssrf.py # Server-Side Request Forgery │ ├── openredirect.py # Open redirect detection │ ├── jwt.py # JWT vulnerability analysis │ ├── dirfuzz.py # Directory & file discovery │ ├── subdomains.py # Subdomain enumeration │ ├── idor.py # Insecure Direct Object Reference │ ├── xxe.py # XML External Entity injection │ └── lfi.py # Local File Inclusion ├── utils/ │ ├── logger.py # Colored terminal output │ ├── banner.py # ASCII banner │ └── report.py # HTML + JSON report generator └── output/ # Reports saved here (auto-created) ``` ## 🛠 安装说明 ### 前置条件 - Ubuntu 20.04+(或任何基于 Debian 的 Linux) - Python 3.8+ - pip3 ### 步骤 1 — 克隆 / 解压 ``` # 如果您下载了 zip: unzip webpwn.zip cd webpwn ``` ### 步骤 2 — 创建虚拟环境(推荐) ``` python3 -m venv venv source venv/bin/activate ``` ### 步骤 3 — 安装依赖 ``` pip3 install -r requirements.txt ``` ### 步骤 4 — 赋予可执行权限(可选) ``` chmod +x main.py ``` ## 🚀 用法 ### 基础扫描(所有模块,包含爬虫) ``` python3 main.py https://target.com ``` ### 详细模式(查看每个发现的证据) ``` python3 main.py https://target.com -v ``` ### 跳过特定模块 ``` python3 main.py https://target.com --skip subdomains dirfuzz ``` ### 仅运行特定模块 ``` python3 main.py https://target.com --only cors headers jwt ``` ### 不爬取 — 仅扫描单个 URL ``` python3 main.py https://target.com/api/v1/user?id=5 --no-crawl ``` ### 授权扫描(使用 cookies) ``` python3 main.py https://target.com --cookies "session=abc123; auth=xyz" ``` ### 自定义 headers(例如 API token) ``` python3 main.py https://target.com --headers '{"Authorization": "Bearer eyJ..."}' ``` ### 通过 Burp Suite proxy 路由 ``` python3 main.py https://target.com --proxy http://127.0.0.1:8080 ``` ### 将输出保存到自定义文件夹 ``` python3 main.py https://target.com -o /home/user/reports ``` ### 增加线程以加快扫描速度 ``` python3 main.py https://target.com -t 20 ``` ### 完整示例 — 真实的 Bug Bounty 工作流 ``` python3 main.py https://target.com \ --cookies "session=abc123" \ --headers '{"X-Api-Key": "secret"}' \ --proxy http://127.0.0.1:8080 \ --skip subdomains \ -t 15 \ -v \ -o reports/ ``` ## 📋 全部参数 | 参数 | 默认值 | 描述 | |------|---------|-------------| | `url` | 必填 | 目标 URL | | `-o`, `--output` | `output/` | 报告输出目录 | | `-t`, `--threads` | `10` | 并发线程数 | | `--timeout` | `10` | HTTP 请求超时时间(秒) | | `--no-crawl` | 关闭 | 跳过爬取,仅扫描单个 URL | | `--skip` | 无 | 跳过特定模块 | | `--only` | 无 | 仅运行特定模块 | | `--json` | 关闭 | 输出 JSON 摘要到 stdout | | `-v`, `--verbose` | 关闭 | 显示每个发现的证据 | | `--user-agent` | WebPwn | 自定义 User-Agent 字符串 | | `--cookies` | 无 | Cookie 字符串 | | `--headers` | 无 | JSON 格式的额外 headers | | `--proxy` | 无 | Proxy URL(Burp, mitmproxy) | ## 🔍 模块说明 | 模块 | 测试内容 | |--------|--------------| | `headers` | 缺失 HSTS、CSP、X-Frame-Options,信息泄露 | | `cors` | Origin 反射、null origin、协议降级、带凭据 | | `csrf` | 无 token 的表单、服务端 token 验证绕过 | | `sqli` | 基于错误和基于时间的盲注 SQL 注入 | | `xss` | 反射型 XSS、SSTI(模板注入) | | `ssrf` | 云元数据 endpoint、通过 URL 参数访问内部 IP | | `openredirect` | 重定向参数绕过(null、双斜杠、协议) | | `jwt` | alg:none、弱密钥、缺失过期时间、敏感 claims | | `dirfuzz` | 70+ 常见路径、备份文件、管理面板、调试 endpoint | | `subdomains` | DNS 暴力破解 + 从发现的子域中进行智能排列组合 | | `idor` | 参数和 URL 路径中的数字及 UUID ID 篡改 | | `xxe` | XML 实体注入、PHP wrappers、通过 XML 触发 SSRF | | `lfi` | 路径遍历、PHP filters、null byte 绕过、proc/self | ## 📊 输出 报告会自动保存到 `output/` 文件夹(或你指定的 `-o` 路径): - **HTML 报告** — 精美的暗色主题报告,带有严重性徽章和可筛选表格 - **JSON 报告** — 机器可读,非常适合通过管道传递给其他工具 示例文件名: ``` output/webpwn_target.com_20250520_143022.html output/webpwn_target.com_20250520_143022.json ``` ## 🧪 在故意设计的漏洞应用上进行测试 请先在合法的目标上练习: ``` # DVWA (Docker) docker run -d -p 80:80 vulnerables/web-dvwa python3 main.py http://localhost # Juice Shop (OWASP) docker run -d -p 3000:3000 bkimminich/juice-shop python3 main.py http://localhost:3000 # WebGoat docker run -d -p 8080:8080 webgoat/goat-and-wolf python3 main.py http://localhost:8080/WebGoat ``` ## ⚙️ 扩展 WebPwn(添加你自己的模块) 1. 创建 `modules/mymodule.py` 2. 实现一个 `run(urls, config, requester, logger)` 函数 3. 返回一个包含发现的 dict 列表: ``` def run(urls, config, requester, logger): findings = [] for url in urls: resp = requester.get(url) if resp and "something_bad" in resp["text"]: findings.append({ "module": "mymodule", "severity": "High", # Critical/High/Medium/Low/Info "url": url, "title": "My Finding Title", "description": "What it means and why it matters.", "evidence": "The specific string or value that triggered this.", }) return findings ``` 4. 在 `core/scanner.py` 中将你的模块名称添加到 `ALL_MODULES` 5. 使用 `--only mymodule` 运行以进行测试 ## ⚠️ 法律免责声明 此工具**仅供授权的安全测试和教育目的**使用。 - 仅在你拥有或**获得明确书面授权**的测试系统上使用 WebPwn。 - 未经授权的扫描在大多数司法管辖区都是非法的。 - 作者不对滥用行为承担任何责任。 ## 🛣️ 路线图(接下来要构建的) - [ ] 速率限制检测 + 429 状态处理 - [ ] GraphQL endpoint 发现与内省扫描器 - [ ] WebSocket 模糊测试模块 - [ ] 带有内置 OOB 回调服务器的盲打 SSRF - [ ] WAF 指纹识别 + 绕过模式 - [ ] 支持 Nuclei 风格的自定义模板 - [ ] 并行模块执行(目前为顺序执行) - [ ] 用于实时发现告警的 Slack/Discord webhook - [ ] 差异模式:对比两次扫描结果 *从零构建。没有 Metasploit。绝非脚本小子。* ⚡
标签:CISA项目, DOE合作, Homebrew安装, Python, Web安全, 加密, 多模态安全, 无后门, 漏洞扫描器, 蓝队分析, 请求拦截, 逆向工具