raza360ahmed/WebPentest
GitHub: raza360ahmed/WebPentest
一款用 Python 编写的模块化 Web 应用程序渗透测试工具,支持 SQL 注入、XSS、目录扫描和安全头检测,并自动生成专业报告。
Stars: 0 | Forks: 0
# 🕷️ WebPentest — Web 应用程序渗透测试工具



## 📌 工具功能
WebPentest 是一款模块化的 Web 应用程序安全扫描器。它能够测试 OWASP Top 10 中列出的最常见且影响重大的 Web 漏洞,生成专业的渗透测试报告,并且完全使用 Python 构建。
## ⚡ 功能特性
| 模块 | 描述 |
|--------|-------------|
| **指纹识别** | 检测服务器、语言、框架、SSL/TLS 信息、表单、HTML 注释 |
| **SQL 注入** | 基于错误、基于布尔和基于时间的盲注 SQLi 检测 |
| **XSS** | 针对 URL 参数的反射型 XSS,包含 10 种绕过 payload |
| **安全标头** | 检测缺失的 CSP、HSTS、X-Frame-Options、X-XSS-Protection |
| **目录扫描** | 暴力破解隐藏文件和目录(admin、.git、.env、备份文件) |
| **HTML 报告** | 专业的深色主题渗透测试报告,带有严重程度颜色编码 |
## 🚀 快速开始
```
git clone https://github.com/raza360ahmed/WebPentest.git
cd WebPentest
pip install -r requirements.txt
# 针对故意存在漏洞的测试目标进行 Full scan (合法且安全)
python main.py http://testphp.vulnweb.com --scan all
# 仅对带参数的特定 URL 进行 SQLi
python main.py http://testphp.vulnweb.com --url "http://testphp.vulnweb.com/artists.php?artist=1" --scan sqli
# 仅进行 Directory bruteforce
python main.py http://testphp.vulnweb.com --scan dirs --threads 30
# 运行 tests
python -m pytest tests/ -v
```
## 📖 使用说明
```
python main.py TARGET [OPTIONS]
positional:
target Base URL (e.g., http://testphp.vulnweb.com)
options:
--url -u Specific URL with parameters for SQLi/XSS testing
--scan -s Modules: fingerprint sqli xss headers dirs all
--threads -t Dir scan threads (default: 20)
--timeout Request timeout seconds (default: 10)
--wordlist -w Custom wordlist file for dir scanning
--output -o Report directory (default: reports/)
--delay Delay between requests in seconds
```
## 🎯 安全测试目标
这些是用于合法练习的故意存在漏洞的系统:
| 目标 | 描述 |
|--------|-------------|
| `http://testphp.vulnweb.com` | Acunetix 演示站点 — SQLi、XSS、文件暴露 |
| `http://demo.testfire.net` | IBM 演示银行 — 登录绕过、SQLi |
| `http://localhost/dvwa` | DVWA — 使用 Docker 在本地运行 |
## 📁 项目结构
```
WebPentest/
├── main.py # CLI entry point
├── requirements.txt
├── README.md
├── .gitignore
│
├── src/
│ ├── fingerprint.py # Target recon & tech detection
│ ├── sqli.py # SQL injection scanner
│ ├── xss.py # XSS + security headers
│ ├── dirscanner.py # Directory/file bruteforcer
│ └── reporter.py # JSON + CSV + HTML reports
│
├── tests/
│ └── test_webpentest.py # 15 unit tests
│
├── wordlists/ # Add custom wordlists here
└── reports/ # Generated reports (auto-created)
```
## 📊 报告输出
HTML 报告包含:
- **整体风险等级**(CRITICAL / HIGH / MEDIUM / LOW)
- 按数量划分的**严重程度分布**
- **目标指纹**(服务器、技术栈、SSL 信息)
- **各项发现**,包含 URL、参数、payload、证据和修复建议
## 🔬 可检测的漏洞
### SQL 注入 (CRITICAL)
通过向 URL 参数注入标准 payload,并分析响应中是否包含数据库错误字符串和时间异常,来检测基于错误的、基于布尔的和基于时间的盲注 SQLi。
### 跨站脚本攻击 (HIGH)
通过注入涵盖不同 HTML 上下文(script 标签、事件处理器、SVG、image onerror)的 10 种 payload,并检查它们是否未转义地出现在响应中,来测试反射型 XSS。
### 缺失的安全标头 (MEDIUM-HIGH)
检查 Content-Security-Policy、Strict-Transport-Security、X-Frame-Options、X-XSS-Protection 和 X-Content-Type-Options。
### 隐藏目录 (VARIABLE)
暴力破解常见路径,包括 admin 面板、备份文件、`.git`、`.env`、配置文件和 API endpoint。
## ⚠️ 法律免责声明
本工具仅供**授权的渗透测试和教育用途**使用。
未经授权对您不拥有的系统进行使用是非法行为。
## 👤 作者
**Ahmed Raza**
数字取证与网络安全学士 — Hamdard University
[GitHub](https://github.com/raza360ahmed) · [LinkedIn](https://linkedin.com/in/ahmed-raza-612683293)
## 📄 许可证
MIT License
标签:CISA项目, DOE合作, Python, Web安全, 主机安全, 安全报告, 安全规则引擎, 文件查看, 文档结构分析, 无后门, 蓝队分析, 逆向工具