nskge/OkrScann
GitHub: nskge/OkrScann
OkrScann 是一款模块化 Web 漏洞扫描器,帮助安全研究者在授权测试中高效发现并报告多种类型的 Web 安全缺陷。
Stars: 0 | Forks: 0
# OkrScann
```
____ _ ____
/ __ \| | _____/ ___| ___ __ _ _ __ _ __
| | | | |/ / __\___ \ / __/ _` | '_ \| '_ \
| |__| | <| | ___) | (_| (_| | | | | | | |
\____/|_|\_\_| |____/ \___\__,_|_| |_|_| |_|
```
专为渗透测试人员和 Bug Bounty 猎人设计的**模块化 Web 漏洞扫描器**。
快速、准确、报告就绪。 — **v2.10.3**
## 模块
| 模块 | 检测内容 |
|--------|-----------------|
| **SQLi** | 基于错误、布尔盲注、时间盲注 (MySQL / MSSQL / Oracle / PostgreSQL / SQLite) |
| **XSS** | 带上下文检测的反射型 XSS (HTML / 属性 / JavaScript) |
| **LFI** | 路径遍历、PHP filter wrappers、编码绕过、空字节 |
| **CMDi** | OS 命令注入 — 基于输出 + 基于时间 (Unix & Windows) |
| **SSTI** | 模板注入 (Jinja2, Twig, Freemarker, Mako, ERB, Smarty, Velocity) |
| **CRLF** | Header 注入、Set-Cookie 注入、响应拆分 |
| **Redirect** | 通过 Location、meta-refresh、JavaScript 的开放重定向 |
| **Headers** | 缺失的安全 Headers、服务器信息泄露、CORS 配置错误 (被动通配符 + 主动反射源探测) |
| **JWT** | alg:none 绕过、弱 HS256 密钥暴力破解、敏感 payload 字段 |
| **SSRF** | 云元数据 (AWS/GCP/Azure)、localhost、内部服务 (Redis/ES/k8s) — 并行探测 |
| **XXE** | 原始 XML POST、XML 参数注入、XML 提示参数 — 6 种 payload 变体 |
| **403 Bypass** | Header 欺骗 (X-Original-URL, X-Forwarded-For, …)、路径操纵 (16 种变体)、谓词篡改 |
| **GraphQL** | Introspection 泄露、GraphiQL/Playground IDE、批量查询、字段建议 — 探测 12 个常见 endpoint 路径 |
| **CVE 检测** | 涵盖 14 个服务的 34 个 CVE (Apache, Nginx, PHP, IIS, Tomcat, OpenSSL, jQuery, WordPress, Drupal, Struts, Spring, WebLogic, Confluence, Joomla),包含 CVSS、Metasploit 模块、NVD 链接 |
## 功能
- **Recon 阶段** — 每次扫描前进行 DNS、IP、延迟、服务器/技术指纹、CVE 检测
- **静态目标检测** — 检测 CDN/SPA 目标 (缓存 Headers + 响应哈希) 并自动跳过注入模块以消除误报
- **感知 JS 的爬虫** — 通过 Playwright 驱动无头 Chromium;点击模态框/按钮 (Register, Login, Cadastrar…),拦截 XHR/Fetch,查找没有 `name` 属性的输入框 (`--js-crawl`)
- **子域名接管** — CNAME 链解析 → 未声明服务指纹检测 (12 个服务)
- **端口扫描器** — 并发 TCP 探测 31 个常用端口并抓取 banner (`--port-scan`)
- **路径发现** — 并发探测 130 个常见路径 (`--discover-paths`)
- **子域名枚举** — 通过 DNS 解析 80 个常见前缀 (`--discover-subs`)
- **WAF 绕过** — 跨越 3 个递增级别的 6 种 payload 转换 (`--waf-evasion 1|2|3`)
- **自适应速率限制器** — 遇到 429/503 时指数退避,遇到 200 自动恢复 (`--rate-limit`)
- **Bug Bounty 模式** — 范围验证、X-Bug-Bounty Header、UA 程序标签 (`--bb-note`, `--scope`)
- **Ctrl+C 恢复** — 优雅中断返回目前已收集的所有发现
- **并发扫描** — 模块并行运行 (可通过 `--threads` 配置)
- **报告导出** — TXT 和 JSON 格式,包含 curl + msfconsole 复现步骤
- **256 个单元测试**
## 安装
```
git clone https://github.com/nskge/OkrScann.git
cd OkrScann/vuln_scanner
pip install -r requirements.txt
# JS-aware crawl(可选)
pip install playwright && python -m playwright install chromium
```
**要求:** Python 3.10+
```
python main.py --version # OkrScann v2.10.0
```
## 用法
```
# 对所有 modules 进行全面扫描
python main.py -u "http://target/page?id=1"
# 自动检测并测试 HTML forms
python main.py -u "http://target/search.php" --crawl
# 针对特定 param 的特定 module
python main.py -u "http://target/page?id=1" --scan-type sqli -p id
# POST form
python main.py -u "http://target/login" -m POST -d "user=admin&pass=x" --scan-type xss
# Recon 扩展:port scan + path discovery
python main.py -u "http://target/?id=1" --port-scan --discover-paths --discover-subs
# WAF evasion level 2
python main.py -u "http://target/?q=1" --waf-evasion 2
# 自适应 rate limiter(请求间隔至少 0.3s)
python main.py -u "http://target/?id=1" --rate-limit --rate-delay 0.3
# 带有 scope check 的 Bug bounty 模式
python main.py -u "http://api.target.com/?url=x" \
--scan-type ssrf \
--bb-note researcher@example.com \
--bb-program h1/target-slug \
--scope "*.target.com"
# 对受保护的 endpoint 进行 403 bypass
python main.py -u "http://target/admin?x=1" --scan-type bypass403
# JS-aware crawl — 发现隐藏在 modals/SPA routes 背后的 inputs
python main.py -u "http://target/" --js-crawl
# GraphQL endpoint 探测
python main.py -u "http://target/" --scan-type graphql
# 通过 Burp Suite 路由
python main.py -u "http://target/?q=test" --proxy http://127.0.0.1:8080
# 导出 JSON 报告
python main.py -u "http://target/?id=1" -o report.json --format json
```
### 选项
```
Target:
-u, --url URL Target URL (required)
-m, --method GET|POST HTTP method (default: GET)
-d, --data POST body e.g. 'user=admin&pass=test'
-p, --param NAME Test only this parameter
Scan options:
--scan-type TYPE sqli|xss|lfi|redirect|cmdi|crlf|ssti|headers|
jwt|ssrf|xxe|bypass403|graphql|all (default: all)
--crawl Auto-detect HTML forms
--js-crawl JS-aware crawl via headless Chromium (finds SPA inputs)
--payloads FILE Custom payload file (one per line)
--delay SECS Time-based detection threshold (default: 5.0)
--threads N Concurrent module threads (default: 4)
--waf-evasion LEVEL 0=off 1=url+null 2=+double+case 3=+html+sql (default: 0)
Recon extras:
--port-scan Fast TCP port scan during recon
--discover-paths Probe 130 common URL paths
--discover-subs Enumerate 80 common subdomains
Rate limiting:
--rate-limit Enable adaptive rate limiter (auto back-off on 429/503)
--rate-delay SECS Minimum delay between requests (default: 0.0)
Bug bounty:
--bb-note EMAIL Add X-Bug-Bounty header identifying you as the researcher
--bb-program SLUG Append BugBounty/slug to User-Agent
--scope PATTERNS Comma-separated glob patterns e.g. '*.example.com'
Aborts scan if target is out of scope
HTTP options:
--headers HEADER ... Extra headers e.g. 'Authorization: Bearer tok'
--cookies COOKIES Cookie string e.g. 'session=abc; role=admin'
--proxy URL HTTP proxy e.g. http://127.0.0.1:8080
--timeout N Request timeout in seconds (default: 10)
--user-agent UA Override User-Agent
--follow-redirects Follow HTTP redirects
Output:
-o, --output FILE Save report to file
--format txt|json Report format (default: txt)
-v, --verbose Debug logging
-q, --quiet Findings only (no banner/recon)
--no-color Disable ANSI colors
```
## 测试
```
python -m pytest tests/ -v # 256 tests
```
## 架构
```
scanner/
├── __init__.py version
├── core.py Scanner orchestrator (recon + parallel module dispatch)
├── http_client.py HTTPClient with rate limiter integration
├── rate_limiter.py AdaptiveRateLimiter (exponential back-off)
├── waf_evasion.py Payload transforms (6 strategies, 3 levels)
├── port_scanner.py Concurrent TCP port scanner
├── discovery.py Subdomain enumeration + URL path discovery
├── cve_db.py CVE database + version matching
├── banner.py ASCII banner
├── parser.py URL/form parsing helpers
├── reporter.py TXT/JSON report writer
├── logger.py Logging setup
└── modules/
├── base.py BaseModule ABC + Finding dataclass
├── sqli.py
├── xss.py
├── lfi.py
├── cmdi.py
├── ssti.py
├── crlf.py
├── open_redirect.py
├── headers.py
├── jwt_analyzer.py
├── ssrf.py
├── xxe.py
├── bypass403.py
└── graphql.py
js_crawler.py Playwright-based JS crawl for SPA/modal input discovery
```
### 添加模块
1. 创建 `scanner/modules/mymodule.py` — 继承 `BaseModule` 子类,实现 `scan_parameter()`
2. 在 `scanner/core.py` 的 `_MODULE_MAP` 中注册
3. 添加到 `main.py` 的 `--scan-type` 选项中
## 免责声明
**OkrScann 仅用于合法、授权的安全测试。**
1. **仅限授权使用。** 仅测试您拥有或获得明确书面许可的系统。
2. **不承担责任。** 按“原样”提供,无任何担保。对于因使用或滥用造成的损害或法律后果,作者不承担任何责任。
3. **您的责任。** 在测试任何目标之前,请确保遵守所有适用法律。
4. **不保证准确性。** 报告前请手动验证所有发现。
未经授权的访问属于犯罪行为 (CFAA, Computer Misuse Act, Art. 154-A Brazilian Penal Code)。
## 许可证
[MIT 许可证](LICENSE)
标签:CISA项目, Web安全, 加密, 安全规则引擎, 漏洞扫描器, 特征检测, 蓝队分析, 逆向工具