knullxx/websec-scanner
GitHub: knullxx/websec-scanner
一款模块化的 Python Web 应用安全扫描器,集成爬虫、漏洞检测、指纹识别与多格式报告功能。
Stars: 0 | Forks: 0
# 一个为教育目的和授权渗透测试构建的专业级 Web 应用程序安全扫描器。功能包括 BFS 爬虫、6 个漏洞插件(XSS、SQLi、CORS、开放重定向、安全标头、敏感文件暴露)、技术指纹识别、FastAPI REST 后端、实时 Web 仪表板以及多格式报告(HTML、JSON、Markdown)。零编译依赖——支持 Python 3.9 至 3.14+。
## 架构概览
```
websec-scanner/
├── core/
│ ├── crawler/ # Website crawling engine
│ │ ├── __init__.py
│ │ ├── crawler.py # BFS crawler with form & param extraction
│ │ └── normalizer.py # URL normalization
│ ├── engine/ # HTTP request engine
│ │ ├── __init__.py
│ │ └── requester.py # Configurable HTTP client
│ └── fingerprint/ # Technology detection
│ ├── __init__.py
│ └── fingerprinter.py
├── scanner/
│ ├── __init__.py
│ ├── orchestrator.py # Scan job coordinator
│ └── plugins/ # Vulnerability modules
│ ├── base.py
│ ├── xss_scanner.py
│ ├── sqli_scanner.py
│ ├── cors_scanner.py
│ ├── headers_scanner.py
│ ├── redirect_scanner.py
│ └── sensitive_files.py
├── database/
│ ├── __init__.py
│ ├── models.py # SQLAlchemy models
│ └── schema.sql # Raw SQL schema
├── api/
│ ├── __init__.py
│ └── app.py # FastAPI application
├── reports/
│ ├── __init__.py
│ └── reporter.py # Report generation (JSON/MD/HTML)
├── dashboard/
│ └── index.html # Single-file web dashboard
├── config/
│ └── settings.py
├── requirements.txt
└── main.py # CLI entry point
```
## 快速开始
### 1. 安装依赖
```
pip install -r requirements.txt
```
### 2. 运行扫描 (CLI)
```
python main.py scan --target https://example.com --depth 3 --output report.html
```
### 3. 启动 API 服务器
```
python main.py server
# 打开 http://localhost:8000/docs 查看 Swagger UI
# 打开 dashboard/index.html 查看 web dashboard
```
### 4. 使用所有模块进行扫描示例
```
python main.py scan \
--target https://testphp.vulnweb.com \
--depth 2 \
--plugins xss,sqli,cors,headers,redirect \
--rate-limit 10 \
--output results/report.html
```
## 扫描阶段
1. **发现** — 爬取目标,提取 URL、表单、参数
2. **指纹识别** — 检测技术、服务器、框架
3. **漏洞测试** — 针对端点运行每个插件模块
4. **分析** — 对发现进行评分、去重和排名
5. **报告** — 生成结构化输出
## 插件开发
通过扩展 `BasePlugin` 创建一个新的漏洞模块:
```
from scanner.plugins.base import BasePlugin, Finding, Severity
class MyPlugin(BasePlugin):
name = "my_check"
description = "Checks for X vulnerability"
def run(self, endpoint, requester):
# Test logic here
findings = []
# ...
findings.append(Finding(
endpoint=endpoint.url,
title="X Vulnerability Found",
severity=Severity.HIGH,
description="...",
remediation="...",
payload="...",
evidence="..."
))
return findings
```
## 授权测试目标
- https://testphp.vulnweb.com (Acunetix demo)
- https://demo.testfire.net (Altoro Mutual demo)
- http://www.webscantest.com
- 您自己的本地应用程序 (DVWA, WebGoat, Juice Shop)
## 法律免责声明
本工具仅供教育目的提供。作者不对任何滥用行为承担
责任。在扫描任何您不拥有的系统之前,请务必获得书面许可。
标签:AV绕过, BeEF, CISA项目, CORS漏洞, FastAPI, Open Redirect, Python, SQLAlchemy, Web安全, XSS检测, 加密, 安全报告生成, 开源安全工具, 敏感文件泄露, 无后门, 漏洞扫描器, 爬虫, 网络安全, 网络测绘, 蓝队分析, 调试插件, 逆向工具, 逆向工程平台, 隐私保护