Vikrant892/web-vuln-scanner
GitHub: Vikrant892/web-vuln-scanner
一个面向教学和基础安全评估的 OWASP Web 漏洞扫描器,覆盖 XSS、SQLi、安全头、SSL 和目录枚举,可生成分级 HTML 报告。
Stars: 0 | Forks: 0
# web-vuln-scanner
这是我为 OWASP 测试课程作业构建的工具——它虽然不是 Burp Suite,但对于基础的 Web 应用安全评估来说已经足够了。它能扫描最常见的 Web 漏洞,并生成一份 HTML 报告,方便你提交作业或与团队分享。
## 法律免责声明
**本工具仅供教育目的和经授权的渗透测试使用。**
根据《计算机欺诈和滥用法》(CFAA) 以及全球类似的法律法规,未经授权访问计算机系统是违法行为。在扫描任何你不拥有的目标之前,请务必获得书面许可。我对本工具的任何滥用行为不承担责任。
说真的,别拿这个做傻事。请先获取授权。
## 功能
- **Web 爬取** - BFS 爬虫,用于发现目标上的页面、链接和表单
- **XSS 检测** - 测试 URL 参数和表单输入是否存在反射型跨站脚本攻击 (XSS)
- **SQL 注入** - 针对 MySQL、PostgreSQL、SQLite、MSSQL 和 Oracle 的基于错误和基于时间的盲注 SQLi 检测
- **安全标头** - 检查 OWASP 推荐的标头(HSTS, CSP, X-Frame-Options 等)并给出 A-F 的评级
- **SSL/TLS 分析** - 证书有效性、到期时间、协议版本以及弱密码检测
- **目录暴破** - 使用常见字典发现隐藏路径(管理面板、配置文件、备份、.git、.env)
- **HTML 报告** - 生成按严重程度分组的深色主题 HTML 报告
## 安装
```
git clone https://github.com/Vikrant892/web-vuln-scanner.git
cd web-vuln-scanner
pip install -r requirements.txt
```
## 用法
```
# 完整扫描(所有模块)
python main.py -u https://target.com -s all
# 仅扫描 xss
python main.py -u https://target.com -s xss
# 仅扫描 sql injection
python main.py -u https://target.com -s sqli
# 仅检查 security headers(快速检查)
python main.py -u https://target.com -s headers
# ssl/tls 检查
python main.py -u https://target.com -s ssl
# 使用 20 个线程进行 directory bruteforce
python main.py -u https://target.com -s dirs -t 20
# 仅抓取(仅映射网站)
python main.py -u https://target.com -s crawl -d 5
# 完整扫描,仅文本输出(无 html 报告)
python main.py -u https://target.com -s all -o text
```
### CLI 选项
```
-u, --url Target URL (required)
-s, --scan Scan type: all, xss, sqli, headers, ssl, dirs, crawl
-o, --output Output format: html, text
-d, --depth Crawl depth (default: 3)
-t, --threads Threads for dir bruteforce (default: 10)
--max-pages Max pages to crawl (default: 100)
--no-crawl Skip crawling, test target URL directly
-v, --verbose Verbose output
```
## 示例输出
```
╦ ╦╔═╗╔╗ ╦ ╦╦ ╦╦ ╔╗╔ ╔═╗╔═╗╔═╗╔╗╔
║║║║╣ ╠╩╗ ╚╗╔╝║ ║║ ║║║ ╚═╗║ ╠═╣║║║
╚╩╝╚═╝╚═╝ ╚╝ ╚═╝╩═╝╝╚╝ ╚═╝╚═╝╩ ╩╝╚╝
OWASP Web Vulnerability Scanner v1.0
[*] Target: https://testsite.local
[*] Scan type: all
──────────────────────────────────────────────────────────
PHASE 1: Crawling
──────────────────────────────────────────────────────────
[*] Starting BFS crawl on https://testsite.local
[+] Crawled: https://testsite.local (depth=0, links=12)
[+] Crawled: https://testsite.local/login (depth=1, links=3)
[+] Crawled: https://testsite.local/search?q= (depth=1, links=5)
──────────────────────────────────────────────────────────
PHASE 4: Security Headers Check
──────────────────────────────────────────────────────────
Header Status Severity
Strict-Transport-Security MISSING HIGH
Content-Security-Policy MISSING HIGH
X-Frame-Options PRESENT -
X-Content-Type-Options PRESENT -
Security Headers Grade: D
============================================================
SCAN SUMMARY
============================================================
Target: https://testsite.local
Total: 8 findings
Critical: 1
High: 3
Medium: 2
Low: 2
============================================================
[+] Report saved to: reports/scan_report_20250315_143022.html
[+] Scan completed in 45.3s
```
## 项目结构
```
web-vuln-scanner/
├── main.py # CLI entry point (argparse)
├── requirements.txt
├── scanner/
│ ├── crawler.py # BFS web crawler
│ ├── xss_scanner.py # Reflected XSS detection
│ ├── sqli_scanner.py # SQL injection (error + blind)
│ ├── header_check.py # Security headers grading
│ ├── ssl_check.py # SSL/TLS certificate checks
│ ├── dir_bruteforce.py # Directory enumeration
│ └── reporter.py # HTML report generator
├── payloads/
│ ├── xss_payloads.txt # XSS test strings
│ └── sqli_payloads.txt # SQLi test strings
├── wordlists/
│ └── common_dirs.txt # Directory wordlist
└── templates/
└── report.html # Jinja2 report template
```
## 局限性
我想坦率地说明这个工具不能做什么:
- **无存储型 XSS 检测** - 仅检查反射型 XSS。存储型和基于 DOM 的 XSS 需要完全不同的方法
- **不支持身份验证** - 无法扫描登录页面背后的内容(需要处理 cookie/session)
- **基础爬取** - BFS 爬虫比较简单,会遗漏 JavaScript 渲染的内容和复杂的 SPA
- **基于时间的 SQLi 存在误报** - 响应缓慢的服务器可能会在基于 SLEEP 的检测中触发误报
- **无 WAF 绕过** - 如果目标前面部署了 WAF,大多数 payload 将被拦截
- **仅限单一目标** - 不支持扫描多个主机或 CIDR 范围
- **有限的密码套件检查** - 仅检查协商的密码,而不检查服务器上所有支持的密码
要进行正规的渗透测试,请使用 Burp Suite、OWASP ZAP 或 sqlmap。这只是一个学习工具。
## 依赖项
- `requests` - HTTP 库
- `beautifulsoup4` - 用于爬虫的 HTML 解析库
- `Jinja2` - HTML 报告模板
- `colorama` - 跨平台的彩色终端输出
- Python 3.8+
## 许可证
MIT - 随你怎么用,只要别用它去黑那些你没有授权测试的东西就行。
标签:CISA项目, HTML报告生成, Python安全工具, SQL注入检测, SSL/TLS分析, Web安全, Web漏洞扫描器, Web爬虫, XSS检测, 安全合规, 安全头部分析, 安全教育, 密码管理, 开源安全工具, 数据泄露, 目录枚举, 目录爆破, 移动安全, 网络代理, 网络安全, 蓝队分析, 逆向工具, 逆向工程平台, 隐私保护