timmeck/sentinel

GitHub: timmeck/sentinel

一款自托管的 AI 驱动 Web 安全扫描器,内置 49 项检测覆盖标头、SSL、SQL 注入、XSS 等漏洞,可生成带严重性评级和修复建议的报告。

Stars: 0 | Forks: 0

# Sentinel — AI 安全扫描器 [![CI](https://static.pigsec.cn/wp-content/uploads/repos/2026/03/0134625ac6183825.svg)](https://github.com/timmeck/sentinel/actions/workflows/ci.yml) [![Python 3.11+](https://img.shields.io/badge/python-3.11+-blue.svg)](https://www.python.org/downloads/) [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](LICENSE) ``` ███████╗███████╗███╗ ██╗████████╗██╗███╗ ██╗███████╗██╗ ██╔════╝██╔════╝████╗ ██║╚══██╔══╝██║████╗ ██║██╔════╝██║ ███████╗█████╗ ██╔██╗ ██║ ██║ ██║██╔██╗ ██║█████╗ ██║ ╚════██║██╔══╝ ██║╚██╗██║ ██║ ██║██║╚██╗██║██╔══╝ ██║ ███████║███████╗██║ ╚████║ ██║ ██║██║ ╚████║███████╗███████╗ ╚══════╝╚══════╝╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═══╝╚══════╝╚══════╝ AI Security Scanner ``` 自带 AI 驱动分析的自托管安全扫描器。扫描 Web 应用程序的漏洞 —— 标头、SSL、端口、Cookie、SQL 注入、XSS、CORS、目录遍历、速率限制、DNS 等。生成包含严重性评级和修复建议的可操作报告。全部本地运行,基于 Ollama。 **纯 Python + SQLite。49 个测试。无需 API 密钥。** ![Sentinel 仪表盘](https://static.pigsec.cn/wp-content/uploads/repos/2026/03/66086fe78b183827.png) ## 功能 | 功能 | 描述 | |---|---| | **16 项安全检查** | 标头、SSL、端口、Cookie、路径、技术栈、HTTPS 重定向、SQLi、XSS、开放重定向、目录遍历、速率限制、CORS、DNS/子域名、API、爬虫 | | **漏洞测试** | 主动探测 SQLi、XSS、开放重定向、目录遍历 | | **AI 报告** | LLM 生成的分析及修复建议 | | **扫描配置** | quick (5 项检查)、standard (10 项)、full (16 项)、api-only | | **严重性评分** | 0-100 分,包含 critical/high/medium/low/info 评级 | | **扫描差异** | 比较扫描结果以跟踪安全随时间的变化 | | **计划扫描** | 类 Cron 间隔,用于持续监控 | | **报告导出** | JSON、CSV、Markdown 导出 | | **Web 爬虫** | 发现链接页面并对其进行扫描 | | **子域名枚举** | 对常见子域名进行 DNS 查询 | | **双重 LLM** | Ollama (免费) 或 Anthropic Claude | | **Web 仪表盘** | 实时扫描进度、发现浏览器、目标管理 | | **CLI** | 命令行下的扫描、列表、查看、差异比较、导出 | | **Auth** | 可选的 API 密钥保护 | | **Docker** | 一键部署 | | **CI** | 针对 Python 3.11-3.13 的 GitHub Actions | ## 快速开始 ``` git clone https://github.com/timmeck/sentinel.git cd sentinel pip install -r requirements.txt # 确保 Ollama 正在运行 ollama pull qwen3:14b # 扫描目标(仅限您自己的站点!) python run.py scan https://your-site.com # 快速扫描(仅 headers + SSL + cookies) python run.py scan https://your-site.com --profile quick # 完整扫描(所有 16 项检查) python run.py scan https://your-site.com --profile full # 列出过往扫描 python run.py scans # 显示扫描详情 python run.py show 1 # 对比两次扫描 python run.py diff 1 2 # 导出报告 python run.py export 1 --format markdown # 启动 dashboard python run.py serve # -> http://localhost:8500 ``` ## 安全检查 | 检查项 | 类型 | 作用 | |---|---|---| | **Headers** | Passive | 检查安全标头 (CSP, HSTS, X-Frame-Options 等) | | **SSL/TLS** | Passive | 证书有效性、过期时间、协议版本 | | **Ports** | Active | 扫描常见端口 (80, 443, 8080, 3306, 5432 等) | | **Cookies** | Passive | 检查 Secure、HttpOnly、SameSite 标记 | | **Paths** | Active | 探测暴露的路径 (/admin, /.env, /.git 等) | | **Technology** | Passive | 检测服务器软件、框架、版本 | | **HTTPS Redirect** | Passive | 验证 HTTP -> HTTPS 重定向 | | **SQL Injection** | Active | 使用 SQLi payload 探测查询参数 | | **XSS** | Active | 使用 XSS payload 探测输入点 | | **Open Redirect** | Active | 测试未验证的重定向 | | **Directory Traversal** | Active | 测试路径遍历漏洞 | | **Rate Limiting** | Active | 检查是否配置了速率限制 | | **CORS** | Active | 测试 CORS 配置错误 | | **DNS/Subdomains** | Active | 通过 DNS 枚举子域名 | | **API** | Active | 检查暴露的 API endpoint | | **Crawler** | Active | 发现并映射链接页面 | ## 架构 ``` src/ ├── config.py # Configuration ├── db/ │ └── database.py # SQLite (targets, scans, findings) ├── scanner/ │ ├── engine.py # Scan orchestrator with profiles │ ├── checks.py # Core checks (headers, SSL, ports, cookies, paths, tech, HTTPS) │ ├── vulns.py # Vulnerability checks (SQLi, XSS, redirect, traversal, rate limit, CORS) │ ├── dns_checks.py # DNS and subdomain enumeration │ ├── api_checks.py # API endpoint discovery │ ├── crawler.py # Web crawler │ ├── diff.py # Scan comparison │ ├── export.py # Report export (JSON, CSV, Markdown) │ └── scheduler.py # Scheduled scans ├── ai/ │ └── llm.py # Ollama + Anthropic with retry ├── web/ │ ├── api.py # FastAPI + SSE │ └── auth.py # Auth middleware └── utils/ └── logger.py ``` ## API Endpoint | 方法 | Endpoint | 描述 | |---|---|---| | GET | `/api/status` | 系统状态 | | POST | `/api/scan` | 开始扫描 | | GET | `/api/scans` | 列出扫描 | | GET | `/api/scans/{id}` | 扫描详情 + 发现 | | DELETE | `/api/scans/{id}` | 删除扫描 | | GET | `/api/targets` | 列出目标 | | GET | `/api/findings` | 浏览发现 | | GET | `/api/diff/{id1}/{id2}` | 比较两次扫描 | | POST | `/api/export/{id}` | 导出报告 | | GET | `/api/activity` | 活动日志 | | GET | `/api/events/stream` | SSE 实时事件 | | GET | `/` | Web 仪表盘 | ## 重要提示 **仅扫描您拥有或获得明确授权测试的目标。** 在大多数司法管辖区,未经授权的扫描是非法的。Sentinel 专为以下用途设计: - 扫描您自己的网站和 API - 授权的渗透测试项目 - 测试环境中的安全研究 - CTF 竞赛 ## 配置 ``` OLLAMA_URL=http://localhost:11434 OLLAMA_MODEL=qwen3:14b SENTINEL_PORT=8500 # SENTINEL_API_KEY=secret SCAN_TIMEOUT=30 ``` ## 测试 ``` pip install pytest pytest-asyncio pytest tests/ -v # 49 项通过 ``` ## Docker ``` docker compose up -d ``` ## 支持 [![Star 本仓库](https://img.shields.io/github/stars/timmeck/sentinel?style=social)](https://github.com/timmeck/sentinel) [![PayPal](https://img.shields.io/badge/Donate-PayPal-blue)](https://paypal.me/tmeck86) 由 [Tim Mecklenburg](https://github.com/timmeck) 构建
标签:AI安全扫描器, AI风险缓解, C++17, CISA项目, CORS配置检查, DInvoke, DNS安全, HTTP头分析, LLM评估, Ollama, Python, Red Teaming, SQLite, SQL注入检测, SSL/TLS分析, XSS检测, XXE攻击, 人工智能, 代码生成, 反取证, 安全合规, 安全评估, 密码管理, 开源安全工具, 恶意样本开发, 插件系统, 数据统计, 无后门, 本地部署, 渗透测试工具, 漏洞报告生成, 用户模式Hook绕过, 目录遍历检测, 端口扫描, 网络代理, 网络安全, 自托管, 语义搜索, 请求拦截, 逆向工具, 逆向工程平台, 速率限制检测, 隐私保护