hashtags2023/WebSecMonitor

GitHub: hashtags2023/WebSecMonitor

一款轻量级 Python Web 漏洞扫描器,能够检测 SQL 注入、XSS、开放重定向、安全头缺失和敏感路径泄露,并输出分级 HTML/JSON 报告。

Stars: 1 | Forks: 0

# 🔍 WebSecMonitor ![Python](https://img.shields.io/badge/Python-3.8+-3776AB?style=flat&logo=python&logoColor=white) ![License](https://img.shields.io/badge/License-MIT-green?style=flat) ![Status](https://img.shields.io/badge/Status-Active-brightgreen?style=flat) ![Security](https://img.shields.io/badge/Category-Cybersecurity-red?style=flat) ## 📸 演示 ![扫描器运行中](https://raw.githubusercontent.com/hashtags2023/WebSecMonitor/main/screenshots/scan_banner.png) ![完整扫描输出](https://raw.githubusercontent.com/hashtags2023/WebSecMonitor/main/screenshots/scan_output.png) ![扫描摘要](https://raw.githubusercontent.com/hashtags2023/WebSecMonitor/main/screenshots/scan_summary.png) ``` ___ ___ ________ ________ ________ _______ ________ |\ \ |\ \|\ __ \|\ ____\|\ __ \|\ ___ \ |\ ____\ \ \ \ \ \ \ \ \|\ \ \ \___|\ \ \|\ \ \ __/|\ \ \___| \ \ \ __\ \ \ \ _ _\ \_____ \ \ _ _\ \ \_|/_\ \ \ \ \ \|\__\_\ \ \ \\ \\|____|\ \ \ \\ \\ \ \_|\ \ \ \____ \ \____________\ \__\\ _\ ____\_\ \ \__\\ _\\ \_______\ \_______\ \|____________|\|__|\|__||\_________\|__|\|__|\|_______|\|_______| WebSecMonitor v1.0 | Web Vulnerability Scanner | by hashtags2023 [*] Target : http://testphp.vulnweb.com [*] Scan started : 2025-01-15 14:32:08 [*] Mode : Standard [+] Checking Security Headers... 🟠 [HIGH] Missing: Strict-Transport-Security 🟠 [HIGH] Missing: Content-Security-Policy 🔴 [CRITICAL] Site is using HTTP (not HTTPS) [+] Testing for SQL Injection... 🔴 [CRITICAL] Possible SQLi in param 'id' | Payload: ' OR 1=1 -- [+] Testing for Cross-Site Scripting (XSS)... 🟠 [HIGH] Reflected XSS in param 'search' | Payload: [SCAN COMPLETE] 🔴 Critical : 3 🟠 High : 5 🟡 Medium : 4 🔵 Info : 6 ``` ## 🛡️ 扫描目标 | 模块 | 检测到的漏洞 | |--------|--------------------------| | **Header Checker** | 缺失 HSTS、CSP、X-Frame-Options、X-Content-Type-Options、Referrer-Policy;信息泄露 headers | | **SQL Injection** | 通过 URL 参数中的常见 payload 检测基于错误的 SQLi | | **XSS Scanner** | 通过未转义的参数反射检测反射型 XSS | | **Open Redirect** | 通过常见重定向参数检测未经验证的重定向 | | **Directory Enum** | 暴露的管理后台、`.env` 文件、`.git` 仓库、备份、配置文件、日志 | ## 🚀 快速开始 ### 前置条件 - Python 3.8+ - pip ### 安装说明 ``` # Clone 仓库 git clone https://github.com/hashtags2023/WebSecMonitor.git cd WebSecMonitor # Install 依赖 pip install -r requirements.txt ``` ### 运行说明 ``` # Basic scan python -m scanner.main http://target.com # Verbose mode python -m scanner.main http://target.com -v # 保存 HTML 报告 python -m scanner.main http://target.com -o report.html # 保存 JSON 报告 python -m scanner.main http://target.com -o report.json ``` ## 📊 报告输出 WebSecMonitor 会生成 **HTML** 和 **JSON** 两种格式的报告。 **HTML 报告** — 采用暗黑主题,按严重程度进行颜色编码,并提供修复指南: - 🔴 严重 - 🟠 高危 - 🟡 中危 - 🔵 信息 **JSON 报告** — 机器可读的输出,便于集成到 CI/CD pipelines 或 SIEMs 中。 ## 🗂️ 项目结构 ``` WebSecMonitor/ ├── scanner/ │ ├── main.py # Entry point & scan orchestrator │ ├── header_checker.py # Security header analysis │ ├── sqli_scanner.py # SQL injection testing │ ├── xss_scanner.py # Cross-site scripting detection │ ├── open_redirect.py # Open redirect testing │ └── dir_enum.py # Directory & path enumeration ├── utils/ │ ├── banner.py # ASCII art banner │ └── report.py # HTML & JSON report generator ├── reports/ # Scan output directory ├── requirements.txt └── README.md ``` ## 🧠 涵盖的安全概念 - **OWASP Top 10** — 涵盖注入、XSS、安全配置错误和敏感数据泄露 - **HTTP Security Headers** — 理解浏览器安全机制(CSP、HSTS、CORS) - **Reconnaissance** — 自动化路径发现和信息收集 - **Threat Modeling** — 严重性分类(严重/高危/中危/信息) - **Reporting** — 包含可操作修复建议的结构化输出 ## ⚠️ 法律免责声明 为了安全实践,请针对刻意设置了漏洞的系统进行测试: - [http://testphp.vulnweb.com](http://testphp.vulnweb.com) (Acunetix 测试网站) - [DVWA](https://github.com/digininja/DVWA) - [OWASP WebGoat](https://github.com/WebGoat/WebGoat) ## 🗺️ 路线图 - [ ] 基于表单的 POST 参数注入测试 - [ ] 子域名枚举 - [ ] CORS 配置错误检测 - [ ] SSL/TLS 证书分析 - [ ] Rate limiting 与暴力破解检测 - [ ] CVE 查询集成 - [ ] 针对于 CI/CD pipelines 的 Slack/邮件告警 ## 👩‍💻 作者 **Lori (hashtags2023)** B.S. Computer Science — CSU Sacramento Cybersecurity & AI Enthusiast [![LinkedIn](https://img.shields.io/badge/-LinkedIn-0077B5?style=flat&logo=linkedin&logoColor=white)](https://linkedin.com/in/yourlinkedin) [![GitHub](https://img.shields.io/badge/-GitHub-181717?style=flat&logo=github&logoColor=white)](https://github.com/hashtags2023) ## 📄 许可证 MIT License — 详情请参阅 [LICENSE](LICENSE)。
标签:CISA项目, DOE合作, Python, Web安全, 加密, 无后门, 漏洞扫描器, 蓝队分析, 逆向工具