B0bTheSkull/webaudit

GitHub: B0bTheSkull/webaudit

一款 Python 编写的 Web 应用安全扫描器,通过检查安全头部、SSL 证书、Cookie 属性、敏感文件暴露、XSS 反射和开放重定向等常见风险,帮助开发者快速发现 Web 应用基础安全问题并生成可视化报告。

Stars: 0 | Forks: 0

# WebAudit ![Python](https://img.shields.io/badge/python-3.8%2B-blue?style=flat-square&logo=python) ![License](https://img.shields.io/badge/license-MIT-green?style=flat-square) ![Ethical Use](https://img.shields.io/badge/authorized%20use-only-red?style=flat-square) ## 检查内容 | 类别 | 测试内容 | |----------|--------------| | **安全头部** | CSP, HSTS, X-Frame-Options, X-Content-Type-Options, Referrer-Policy, Permissions-Policy | | **SSL/TLS** | 证书有效性、过期时间(标记在 30 天内过期的证书)、TLS 版本 | | **Cookie 安全性** | 所有 cookie 的 Secure、HttpOnly、SameSite 标志 | | **暴露的文件** | `.env`, `.git/HEAD`, `wp-config.php`, 备份文件, `phpinfo.php`, robots.txt | | **XSS 反射** | 向 GET 参数注入无害测试字符串,检查其是否未编码地反射出来 | | **开放重定向** | 测试常见的重定向参数(`?redirect=`, `?url=`, `?next=` 等) | ## 安装 ``` git clone https://github.com/B0bTheSkull/webaudit.git cd webaudit pip install -r requirements.txt ``` ## 用法 ``` # 带有 terminal 输出的基本扫描 python webaudit.py --url https://example.com # 生成完整的 HTML 报告 python webaudit.py --url https://example.com --output report.html # HTML + JSON 输出 python webaudit.py --url https://example.com --output report.html --json results.json # 跳过 SSL 验证(适用于 self-signed certs) python webaudit.py --url https://internal.example.com --no-verify # 自定义 timeout python webaudit.py --url https://slow-site.example.com --timeout 20 ``` ## 终端输出示例 ``` ╔══════════════════════════════════════════╗ ║ WebAudit v1.0 — Web Security Scanner ║ ║ Use only on systems you own/authorized ║ ╚══════════════════════════════════════════╝ [*] Target: https://example.com [*] Starting scan... [*] Checking: Security Headers... └─ 3 issue(s) found [FAIL] [HIGH] Missing header: Content-Security-Policy → Define a restrictive CSP policy for your application [FAIL] [HIGH] Missing header: Strict-Transport-Security → Add: Strict-Transport-Security: max-age=31536000; includeSubDomains [WARN] [MEDIUM] Missing header: Permissions-Policy [*] Checking: SSL/TLS... └─ 2 check(s) passed [*] Checking: Cookie Security... └─ 1 issue(s) found [WARN] [MEDIUM] Cookie 'session' has security issues: Missing HttpOnly flag [*] Checking: Exposed Files... └─ 1 issue(s) found [FAIL] [HIGH] Sensitive file accessible: /.env (HTTP 200) ──────────────────────────────────────────────────────────── Scan complete — 24 checks run FAIL: 3 WARN: 4 PASS: 17 [*] HTML report saved: report.html ``` ## HTML 报告 HTML 报告采用暗色主题,并且是独立的(无外部依赖)。它包括: - 基于检查结果的**安全评分**(0–100) - **颜色编码的检查结果**(红色=失败,黄色=警告,绿色=通过) - 针对每个问题的**修复建议** - **按检查类别分组**,方便导航 ## JSON 输出 ``` { "url": "https://example.com", "total_findings": 24, "findings": [ { "check": "security_headers", "header": "Content-Security-Policy", "status": "FAIL", "severity": "HIGH", "detail": "Missing header: Content-Security-Policy", "recommendation": "Define a restrictive CSP policy for your application" } ] } ``` ## 路线图 - [ ] 目录列出检测 - [ ] 子域名枚举集成 - [ ] 速率限制 / WAF 检测 - [ ] 身份验证绕过检查 - [ ] CORS 错误配置测试 ## 许可证 MIT — 请参阅 [LICENSE](LICENSE)。请负责任地使用。
标签:GraphQL安全矩阵, Python, Web安全, 安全扫描器, 对称加密, 数据泄露, 无后门, 自动化审计, 蓝队分析, 逆向工具, 配置审计