NishantSehgal629/web-vulnerability-scanner

GitHub: NishantSehgal629/web-vulnerability-scanner

一款基于Python的轻量级Web漏洞扫描器,能自动化检测XSS、开放重定向、缺失安全头和暴露目录,并输出带严重性评级的双格式报告。

Stars: 0 | Forks: 0

# 🔍 Web 漏洞扫描器 一个基于 Python 的自动化 Web 漏洞扫描器,用于探测目标的 **XSS**、**开放重定向**、**缺失的安全响应头**以及**暴露的目录/文件**。生成结构化的 **HTML** 和 **JSON** 报告,包含严重性评级和修复建议。 ![Python](https://img.shields.io/badge/Python-3.8+-3776AB?logo=python&logoColor=white) ![Status](https://img.shields.io/badge/use-authorized--targets--only-red) ## 功能 - **XSS 检测** — 使用多个 payload 测试 GET 参数和 HTML 表单字段 - **开放重定向检测** — 探测 15 个以上的常见重定向参数 - **安全响应头检查** — 验证 HSTS、CSP、X-Frame-Options 等 - **暴露目录/文件扫描** — 探测 40 个以上的常见敏感路径(.env、.git、备份文件等) - **BFS 爬虫** — 递归爬取目标,支持可配置的爬取深度 - **多线程** — 支持可配置线程数的并发扫描 - **双重报告** — 同时生成 HTML(可视化)和 JSON(机器可读)报告 - **严重性评级** — 每个发现均被评为 High / Medium / Low,并附带修复建议 ## 安装 ``` cd web-vulnerability-scanner pip install -r requirements.txt ``` ## 用法 ``` # Basic 扫描 python scanner.py -u https://example.com # 自定义 depth 和 threads python scanner.py -u https://example.com --depth 3 --threads 10 # 仅 HTML 报告 python scanner.py -u https://example.com --format html --output my_report # 跳过特定检查 python scanner.py -u https://example.com --no-dirs --no-redirects # Verbose 输出 python scanner.py -u https://example.com -v ``` ## 选项 | 标志 | 默认值 | 描述 | |------------------|----------|------------------------------------------| | `-u`, `--url` | 必填 | 目标 URL | | `--depth` | 2 | 爬取深度 | | `--threads` | 5 | 并发线程数 | | `--timeout` | 10 | 请求超时(秒) | | `--format` | both | `html`、`json` 或 `both` | | `--output` | report | 输出文件名前缀 | | `--no-xss` | off | 跳过 XSS 检查 | | `--no-headers` | off | 跳过安全响应头检查 | | `--no-redirects` | off | 跳过开放重定向检查 | | `--no-dirs` | off | 跳过暴露目录检查 | | `-v`, `--verbose`| off | 打印每个爬取的 URL | ## 报告输出 扫描完成后,将生成两个文件: - `report.html` — 带有颜色编码严重性表格的可视化报告 - `report.json` — 用于流水线集成的结构化 JSON ### JSON 发现示例 ``` { "type": "Missing Security Header", "url": "https://example.com", "severity": "high", "description": "Content-Security-Policy: CSP header missing...", "remediation": "Define a Content-Security-Policy header...", "evidence": "Header 'Content-Security-Policy' not found in response." } ``` ## 项目结构 ``` web-vulnerability-scanner/ ├── scanner.py # CLI entry point ├── requirements.txt ├── modules/ │ ├── scanner.py # Crawler + scan orchestrator │ ├── reporter.py # HTML & JSON report generator │ └── checks/ │ ├── headers.py # Security header checks │ ├── xss.py # XSS payload injection │ ├── open_redirect.py # Open redirect probing │ └── exposed_dirs.py # Sensitive path wordlist └── reports/ # Default output directory ``` ## 扩展扫描器 通过在 `modules/checks/` 中创建一个返回 finding 字典列表的模块来添加新的检查: ``` def check_something(url, response, session, timeout): findings = [] # your logic here findings.append({ "type": "My Check", "url": url, "severity": "medium", # high / medium / low "description": "What was found.", "remediation": "How to fix it.", "evidence": "What triggered the finding.", }) return findings ``` 然后在 `modules/scanner.py` 中注册它。
标签:AES-256, BFS爬虫, Homebrew安装, HTML报告, JSON报告, Python, Splunk, Web安全, XSS检测, 多模态安全, 多线程爬虫, 安全响应头, 密码管理, 开放重定向, 插件系统, 敏感文件扫描, 无后门, 漏洞评估, 知识库安全, 网络安全, 自动化扫描器, 蓝队分析, 路径遍历, 逆向工具, 隐私保护, 靶场工具