OneClickIT-ai/ritac-security-scanner
GitHub: OneClickIT-ai/ritac-security-scanner
一款专为授权安全测试和教学设计的综合性 Web 漏洞扫描器,解决自动化检测 Web 安全隐患与合规审计的需求。
Stars: 1 | Forks: 0
# RITAC 安全扫描器
[](https://pypi.org/project/ritac-security-scanner/)
[](https://www.python.org/downloads/)
[](https://www.gnu.org/licenses/gpl-3.0)
一个包含 **100+ 检测模块**、并发扫描和专业报告功能的综合性 Web 漏洞评估工具。专为授权安全测试和教学设计。
## 安装
```
# 从 PyPI
pip install ritac-security-scanner
# 使用 JS 渲染(Selenium + ChromeDriver)
pip install ritac-security-scanner[js]
# 使用 XLSX 导出
pip install ritac-security-scanner[xlsx]
# 全部
pip install ritac-security-scanner[all]
# 从源代码
git clone https://github.com/ritacsolutionsllc/ritac-security-scanner.git
cd ritac-security-scanner
pip install -e ".[all]"
```
### Docker
```
docker build -t ritac-scanner .
docker run ritac-scanner https://example.com --depth 2 --format json
```
## 快速开始
```
# 基础扫描(HTML 报告)
ritac-scan example.com
# 深度扫描(XLSX 输出)
ritac-scan https://example.com --depth 3 --format xlsx
# SPA 扫描(JS 渲染)
ritac-scan https://spa-app.com --js --js-timeout 20
# 通过代理的并发扫描
ritac-scan example.com --concurrent --workers 8 --proxy http://127.0.0.1:8080
# 查看扫描历史
ritac-scan example.com --history
```
## 扫描内容(100+ 模块)
### 注入与输入验证
| 模块 | 检测内容 |
|------|----------|
| `sql_errors` | 基于错误探测的 SQL 注入(MySQL、Oracle、MSSQL、PostgreSQL、SQLite) |
| `command_injection` | 操作系统命令注入(`;id`、`|id`、`` `id` ``、`$(id)`) |
| `ssti_detection` | 服务端模板注入(Jinja2、Twig、FreeMarker、ERB) |
| `xpath_injection` | 带错误检测的 XPath 注入 |
| `nosql_injection` | MongoDB 操作符注入、JSON 主体注入 |
| `ldap_injection` | LDAP 过滤器注入、通配符扩展 |
| `xss_reflection` | 反射型 XSS(安全探测字符串) |
| `xss_stored` | DOM XSS 汇点(innerHTML、eval、document.write)+ 来源 |
| `log_injection` | CRLF 注入、日志伪造 |
| `http_parameter_pollution` | HPP 重复参数、权限参数污染 |
### 认证与会话
| 模块 | 检测内容 |
|------|----------|
| `session_security` | 缺少 HttpOnly/Secure/SameSite、会话在 URL、弱会话 ID |
| `csrf_check` | 缺少 CSRF 令牌、SameSite Cookie 问题 |
| `jwt_misconfig` | alg:none、kid 注入、jku/x5u 混淆、缺少 exp |
| `jwt_analyzer` | JWT 在内容/头部暴露、敏感声明 |
| `oauth_check` | 隐式流程、缺少 state/PKCE、可疑 redirect_uri |
| `weak_password_reset` | 邮箱枚举、缺少验证码、HTTP 密码重置表单 |
| `user_enumeration` | 登录错误差异性、注册“已被占用” |
| `account_lockout` | 登录表单缺少暴力破解防护 |
| `auth_bypass` | 默认凭证、认证绕过技术 |
### 服务器与基础设施
| 模块 | 检测内容 |
|------|----------|
| `tls_check` | TLS 版本、弱密码套件、证书过期、SAN 验证 |
| `security_misconfig` | 目录列表、敏感文件(.env、.git、database.yml) |
| `exposed_debug` | phpinfo、Werkzeug 控制台、Spring Actuator、Rails 信息 |
| `error_disclosure` | 堆栈跟踪(Python/Java/Node/.NET/PHP)、路径泄露 |
| `cve_scanner` | Apache、nginx、jQuery、WordPress、Spring、OpenSSL 的已知 CVE |
| `http_smuggling` | 代理链、分块 TE 探测、服务器版本风险 |
| `dns_rebinding` | 私有 IP 解析、内部 IP 泄漏、CORS + HTTP 向量 |
| `subdomain_takeover` | NXDOMAIN + 指向 14 个云服务的 CNAME |
| `waf_detector` | WAF 存在性检测 |
### 头部与策略
| 模块 | 检测内容 |
|------|----------|
| `csp_bypass` | unsafe-inline/eval、CDN 绕过来源、缺少 strict-dynamic |
| `cors_policy` | 通配符 + 凭据、空源、危险方法 |
| `clickjacking_advanced` | 无头部 JS 框架破坏、CSS 防御、拖放 |
| `hsts_preload` | 缺少 HSTS、短 max-age、缺少 includeSubDomains |
| `permissions_policy` | 功能策略分析 |
| `http_cache_control` | 敏感内容带 max-age、公共缓存 |
### 数据泄露
| 模块 | 检测内容 |
|------|----------|
| `api_key_exposure` | 30+ 模式:Google、OpenAI、AWS、Stripe、GitHub PAT、RSA 密钥 |
| `data_exposure` | 社保号、信用卡、IBAN、CVV、HIPAA/PHI、JSON 密钥 |
| `email_harvester` | 邮箱提取、敏感角色分类 |
| `cloud_storage` | S3 存储桶(4 种 URL 格式)、GCS、Azure Blob |
| `data_files` | 暴露的 CSV、XLSX、SQL 转储、数据库文件、备份 |
| `insecure_deserialization` | PHP 序列化对象、Java 魔法字节、Python pickle |
### 业务逻辑与应用
| 模块 | 检测内容 |
|------|----------|
| `business_logic` | 隐藏价格、优惠券滥用、工作流步骤跳过 |
| `race_condition` | 财务表单、异步 JS 模式、双重消费表面 |
| `idor_detection` | 数字 ID 参数、基于路径的对象引用 |
| `open_redirect` | 25 个重定向相关参数与 evil.com + javascript: |
| `file_inclusion` | LFI(../../etc/passwd、php://filter)、RFI |
| `path_traversal_advanced` | 16 种编码绕过变体(URL、双写、Unicode、空字节) |
| `mass_assignment` | is_admin/role/balance 在 JSON、隐藏表单输入 |
| `prototype_pollution` | `__proto__`、Object.assign 汇点、脆弱库版本 |
| `corporate_forms` | 公司、联系人、地址、财务、账单字段检测 |
| `merchant_detection` | MCC 代码、终端 ID、收购方 ID、商户名称 |
### 客户端
| 模块 | 检测内容 |
|------|----------|
| `postmessage_security` | 缺少来源检查、通配符目标、带有 event.data 的 eval |
| `service_worker_security` | Service Worker 作用域、importScripts、带凭证的 fetch |
| `webassembly_detect` | WASM 实例化、SharedArrayBuffer(幽灵漏洞) |
| `font_fingerprint` | Canvas、WebGL、音频指纹、FingerprintJS |
| `timing_attacks` | Token 参数时序差异 |
| `regex_dos` | 嵌套量词、从用户输入动态生成的正则表达式 |
**以及 40+ 更多模块**,包括 WordPress 扫描、GraphQL 内省、服务器端缓存中毒、HTTP 动词篡改、XML/XXE 安全性、SSRF 检测等。
## 架构
```
ritac-scan
|
v
scanner.py (orchestrator)
|
+-- 1. Target Analysis (analyzer.py)
+-- 2. robots.txt Collection
+-- 3. Security Headers Check
+-- 4. Category-Focused Scans (focused.py)
+-- 5. Infrastructure Checks: SSL/TLS/DNS/WAF (concurrent)
+-- 6. Base-URL Probes: admin panels, debug, misconfigs (concurrent)
+-- 7. Crawl Site (crawler.py, sequential or concurrent)
+-- 8. Per-Page Analysis (registry.py dispatches 100+ modules):
| +-- URL-only probes (28 modules, concurrent)
| +-- Page content analyzers (32 modules)
| +-- Response header analyzers (16 modules)
| +-- Full-context analyzers (6 modules)
| +-- Special-signature modules (19 modules)
+-- 9. Finding Deduplication (dedup.py)
+-- 10. Report Generation (reporter.py)
```
## CLI 选项
```
ritac-scan [options]
Output:
-o, --output DIR Output directory (default: ./ritac_output)
-f, --format FMT html, json, csv, xlsx (default: html)
Scan Settings:
--depth N Max crawl depth (default: 2)
--delay SECS Delay between requests (default: 1.0)
--timeout SECS Request timeout (default: 10)
-c, --config FILE YAML configuration file
Performance:
--concurrent Enable concurrent crawling
--workers N Number of concurrent workers (default: 5)
JavaScript Rendering:
--js Enable Selenium JS rendering for SPAs
--js-timeout SECS JS rendering timeout (default: 15)
Network:
--proxy URL HTTP/SOCKS proxy URL
--cookies FILE Path to cookies JSON file
--user-agent STRING Custom User-Agent
Detection Toggles:
--no-robots Skip robots.txt collection
--no-login-detect Skip login form detection
Database:
--no-db Disable SQLite storage
--history Show scan history and exit
Other:
-v, --verbose Verbose logging
--version Show version
```
## 报告格式
| 格式 | 描述 |
|------|---------|
| **HTML** | 交互式仪表板,包含严重性筛选器、统计卡片、可展开上下文、“在 N 个页面发现”徽章 |
| **JSON** | 机器可读格式,包含发生次数和受影响 URL,适合 SIEM/CI 集成 |
| **CSV** | 每行一个发现结果,包含发生次数,可导入 Excel/Sheets |
| **XLSX** | 专业的 Excel 报告,包含样式化表头、严重性着色、自动筛选器和汇总表 |
## Python API
```
from ritac_scanner.models import ScanConfig
from ritac_scanner.scanner import RITACScanner
from ritac_scanner.reporter import save_report
config = ScanConfig(
target_url="https://example.com",
max_depth=2,
concurrent=True,
enable_js=True, # Optional: JS rendering for SPAs
)
scanner = RITACScanner(config)
result = scanner.run()
scanner.print_summary()
# 导出为任意格式
save_report(result, "./output", "html")
save_report(result, "./output", "xlsx")
```
## 许可证
本项目根据 GNU 通用公共许可证 v3.0 授权 - 详细信息请参见 [LICENSE](LICENSE) 文件。
## 作者
**RITAC / Imperium Solutions**
*专为安全专业人士和学生设计。请始终负责任地进行扫描。*
标签:API哈希动态解析, API密钥检测, ChromeDriver, Docker, GPLv3, NoSQL注入, PyPI, Python, Python 3.9+, Selenium, SEO, SSTI, Web漏洞扫描, XLSX导出, XPath注入, 命令注入, 安全教育, 安全测试, 安全防御评估, 并发扫描, 开源安全工具, 授权测试, 攻击性安全, 无后门, 请求拦截, 输入验证, 逆向工具, 逆向工程平台