ritacsolutionsllc/ritac-security-scanner
GitHub: ritacsolutionsllc/ritac-security-scanner
一款集成100多个检测模块的综合性Web漏洞扫描器,支持并发扫描、JS渲染和专业报告导出,适用于授权安全测试与教学场景。
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)
一款综合性的 Web 漏洞评估工具,具备 **100 多个检测模块**、并发扫描和专业报告功能。专为授权安全测试和教育而构建。
## 安装
```
# 从 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
# 包含 JS 渲染的 SPA 扫描
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` | OS 命令注入(`;id`、`|id`、`` `id` ``、`$(id)`) |
| `ssti_detection` | 服务端模板注入(Jinja2、Twig、FreeMarker、ERB) |
| `xpath_injection` | 带有错误检测的 XPath 注入 |
| `nosql_injection` | MongoDB 运算符注入、JSON body 注入 |
| `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 token、SameSite cookie 问题 |
| `jwt_misconfig` | alg:none、kid 注入、jku/x5u 混淆、缺失 exp |
| `jwt_analyzer` | 内容/Headers 中的 JWT 泄露、敏感声明 |
| `oauth_check` | 隐式流程、缺失 state/PKCE、可疑 redirect_uri |
| `weak_password_reset` | 邮箱枚举、缺失 CAPTCHA、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 + CNAME 至 14 个云服务 |
| `waf_detector` | WAF 存在检测 |
### Headers 与策略
| 模块 | 检测内容 |
|--------|----------------|
| `csp_bypass` | unsafe-inline/eval、CDN 绕过来源、缺失 strict-dynamic |
| `cors_policy` | 通配符+凭据、null 源、危险方法 |
| `clickjacking_advanced` | 无 Headers 的 JS frame-busting、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` | SSN、信用卡、IBAN、CVV、HIPAA/PHI、JSON 密钥 |
| `email_harvester` | 电子邮件提取、敏感角色分类 |
| `cloud_storage` | S3 存储桶(4 种 URL 格式)、GCS、Azure Blob |
| `data_files` | 暴露的 CSV、XLSX、SQL 转储、数据库文件、备份 |
| `insecure_deserialization` | PHP 序列化对象、Java magic bytes、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` | JSON 中的 is_admin/role/balance、隐藏表单输入 |
| `prototype_pollution` | `__proto__`、Object.assign 接收端、易受攻击的库版本 |
| `corporate_forms` | 公司、联系人、地址、财务、账单字段检测 |
| `merchant_detection` | MCC 码、终端 ID、收单行 ID、商户名称 |
### 客户端
| 模块 | 检测内容 |
|--------|----------------|
| `postmessage_security` | 缺失 origin 检查、通配符目标、带 event.data 的 eval |
| `service_worker_security` | SW 范围、importScripts、带凭据的 fetch |
| `webassembly_detect` | WASM 实例化、SharedArrayBuffer (Spectre) |
| `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** | 具有严重性过滤器、统计卡片、可展开上下文、“Found on N pages” 徽章的交互式仪表板 |
| **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 General Public License v3.0 授权 - 详情请参阅 [LICENSE](LICENSE) 文件。
## 作者
**RITAC / Imperium Solutions**
*专为安全专业人员和学生而构建。请始终负责任地进行扫描。*
标签:ChromeDriver, CISA项目, DAST, Docker, DOE合作, NoSQL注入, Python, RITAC Security Scanner, Selenium, SQL注入检测, SSTI检测, Web安全, Web应用扫描器, XPath注入, 合规检测, 命令注入检测, 安全教育, 安全测试, 安全防御评估, 并发扫描, 开源安全工具, 恶意软件分析, 攻击性安全, 无后门, 网络安全, 蓝队分析, 请求拦截, 逆向工具, 逆向工程平台, 隐私保护