shwetakanth09/vigil-security-scanner

GitHub: shwetakanth09/vigil-security-scanner

Vigil 是一款集成安全头检测、SSL/TLS 审计与端口扫描的 Web 安全扫描器,提供 REST API 和可视化仪表板。

Stars: 0 | Forks: 0

# Vigil - Web 安全扫描器 🔍 [![CI](https://static.pigsec.cn/wp-content/uploads/repos/cas/39/39faa54be350a1dab8afd3b2fb8c1c83e4d9cff84abfef2374d19a18053687c4.svg)](https://github.com/shwetakanth09/vigil-security-scanner/actions/workflows/ci.yml) [![Python 3.11+](https://img.shields.io/badge/python-3.11%2B-blue)](https://python.org) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE) Vigil 是一款 Web 安全扫描工具,用于检查网站的安全头、SSL/TLS 配置以及开放端口。它提供了 REST API 和 Web 仪表板以供交互式使用。 ## 功能 - **安全头** — 检查 HSTS、CSP、X-Frame-Options、X-Content-Type-Options 以及 12 种以上的其他安全头 - **SSL/TLS 扫描器** — 验证证书、过期日期、颁发者、协议版本和密码套件 - **端口扫描器** — 扫描 20 个常用端口(HTTP、SSH、MySQL 等)的开放服务 - **JWT 认证** — 基于令牌的 API 访问,支持可配置的过期时间 - **Web 仪表板** — 深色主题 UI,包含摘要卡片、详细表格和实时扫描状态 - **Docker 支持** — 通过 docker-compose 进行容器化部署 ## 快速开始 ### 前置条件 - Python 3.11+ - pip ### 安装说明 ``` # 克隆仓库 git clone https://github.com/shwetakanth09/vigil-security-scanner.git cd vigil-security-scanner # 安装依赖 pip install -r requirements.txt # 运行应用程序 python run.py ``` 在浏览器中打开 [http://127.0.0.1:5000](http://127.0.0.1:5000)。 ### 使用 Docker ``` docker compose up -d ``` ## API 文档 ### 认证 所有扫描端点都需要 JWT 令牌。通过以下方式获取: ``` # 使用默认凭据登录 curl -X POST http://127.0.0.1:5000/api/login \ -H "Content-Type: application/json" \ -d '{"username": "vigil", "password": "vigil"}' # 响应 {"token": "eyJhbGciOiJIUzI1NiIs..."} ``` ### 端点 | 方法 | 端点 | 描述 | |--------|----------|-------------| | POST | `/api/login` | 认证并获取 JWT 令牌 | | GET | `/api/verify` | 验证令牌有效性 | | POST | `/api/scan/headers` | 扫描安全头 | | POST | `/api/scan/ssl` | 扫描 SSL/TLS 配置 | | POST | `/api/scan/ports` | 扫描开放端口 | | POST | `/api/scan/full` | 运行所有扫描(综合扫描) | ### 使用示例 ``` TOKEN="your-jwt-token" # Security headers 扫描 curl -X POST http://127.0.0.1:5000/api/scan/headers \ -H "Authorization: Bearer $TOKEN" \ -H "Content-Type: application/json" \ -d '{"target": "https://example.com"}' # 全量扫描 curl -X POST http://127.0.0.1:5000/api/scan/full \ -H "Authorization: Bearer $TOKEN" \ -H "Content-Type: application/json" \ -d '{"target": "https://example.com"}' ``` ### 扫描响应 ``` { "target": "https://example.com", "timestamp": "2026-07-16T12:00:00Z", "score": 75, "headers": { "findings": [{"header": "Strict-Transport-Security", "present": true, "value": "max-age=31536000", "severity": "high"}], "score": 80 }, "ssl": { "valid": true, "issuer": "C=US, O=Let's Encrypt, CN=R3", "expiry_days": 45, "score": 90 }, "ports": { "open": [{"port": 443, "service": "HTTPS"}, {"port": 80, "service": "HTTP"}], "score": 100 } } ``` ## 项目结构 ``` vigil-security-scanner/ ├── src/ │ ├── api/ # Flask REST API (routes, auth, config) │ ├── scanner/ # Scanner engine (headers, SSL, ports, validators) │ └── dashboard/ # Web dashboard (templates, static) ├── tests/ # Unit tests ├── Dockerfile # Container build ├── docker-compose.yml # Container orchestration └── pyproject.toml # Project metadata & tool config ``` ## 开发 ``` # 运行测试 python -m pytest tests/ -v # 运行特定测试文件 python -m pytest tests/test_validators.py -v # Lint pip install flake8 flake8 src/ tests/ --max-line-length=100 --ignore=E402,W503 ``` ## 环境变量 | 变量 | 默认值 | 描述 | |----------|---------|-------------| | `VIGIL_SECRET_KEY` | `change-in-production` | Flask 密钥 | | `VIGIL_JWT_SECRET` | `change-in-production` | JWT 签名密钥 | | `VIGIL_JWT_EXPIRY` | `2` | 令牌过期时间(小时) | | `VIGIL_SCAN_TIMEOUT` | `15` | 扫描超时时间(秒) | | `VIGIL_LOG_LEVEL` | `INFO` | 日志记录级别 | ## 许可证 MIT
标签:Docker, Python, REST API, SSL/TLS检查, Web安全扫描器, 安全防御评估, 插件系统, 数据统计, 无后门, 端口扫描, 网络测绘, 请求拦截, 逆向工具