ay212542/trishul-scanner

GitHub: ay212542/trishul-scanner

一款基于 Python 异步与插件化架构的模块化 Web 漏洞扫描器,旨在以低误报提升发现效率。

Stars: 0 | Forks: 0

# 🔱 TRISHUL Scanner
**高级开源 Web 漏洞扫描器** *模块化 • 异步 • 插件化 • 低误报* [![CI](https://github.com/YOUR_USERNAME/trishul-scanner/actions/workflows/ci.yml/badge.svg)](https://github.com/YOUR_USERNAME/trishul-scanner/actions/workflows/ci.yml) [![Python](https://img.shields.io/badge/Python-3.10%2B-3776AB?logo=python&logoColor=white)](https://www.python.org/) [![License](https://img.shields.io/badge/License-MIT-22c55e)](LICENSE) [![Version](https://img.shields.io/badge/Version-1.0.0-6366f1)](CHANGELOG.md) [![PRs Welcome](https://img.shields.io/badge/PRs-Welcome-brightgreen)](CONTRIBUTING.md) [![Ethical Use](https://img.shields.io/badge/Use-Authorized%20Only-ef4444)](DISCLAIMER.md)
## 📸 概述 TRISHUL 是一个模块化、异步的 Web 漏洞扫描器,专为开发者和安全工程师设计。 它专注于 **准确性**、**模块化** 和 **清晰输出**,执行被动且低影响的安全检查。 ``` ████████╗██████╗ ██╗███████╗██╗ ██╗██╗ ██╗██╗ ╚══██╔══╝██╔══██╗██║██╔════╝██║ ██║██║ ██║██║ ██║ ██████╔╝██║███████╗███████║██║ ██║██║ ██║ ██╔══██╗██║╚════██║██╔══██║██║ ██║██║ ██║ ██║ ██║██║███████║██║ ██║╚██████╔╝███████╗ ╚═╝ ╚═╝ ╚═╝╚═╝╚══════╝╚═╝ ╚═╝ ╚═════╝ ╚══════╝ Advanced Web Vulnerability Scanner v1.0.0 ``` ## ✨ 功能 | 模块 | 功能 | |--------|-------------| | 🕷 **Web 爬虫** | 异步 BFS,带深度控制、去重、二进制跳过 | | 🔌 **端口扫描器** | 60+ 端口,异步 TCP 连接,15 个风险端口标志 | | 🛡 **头部分析器** | CSP、HSTS、X-Frame-Options、X-Content-Type-Options 加上质量检查 | | 🔍 **模糊引擎** | 80+ 敏感路径,软化 404 基准过滤 | | 🔒 **SSL 分析器** | 到期倒计时、主机名不匹配、自签名检测 | | 💡 **技术检测器** | 从头部和 HTML 识别服务器、框架、CDN、CMS | | 🔌 **插件系统** | 动态插件加载 — 放置 `.py` 文件即可自动识别 | | 📊 **报告** | CLI(Rich)、JSON、暗色模式 HTML,支持折叠发现项 | ## 🚀 安装 ### 系统要求 - Python **3.10+** - pip ### 从源码安装 ``` git clone https://github.com/YOUR_USERNAME/trishul-scanner.git cd trishul-scanner # 安装依赖 pip install -r requirements.txt # 安装为 CLI 工具 pip install -e . ``` ### 验证安装 ``` trishul --help python tests/test_basic.py ``` ## 🎯 使用 ### 基础扫描 ``` trishul http://testphp.vulnweb.com ``` ### 生成 HTML 报告 ``` trishul http://testphp.vulnweb.com -f html -o report.html ``` ### JSON 导出 ``` trishul http://testphp.vulnweb.com -f json -o results.json ``` ### 仅使用特定模块 ``` trishul http://example.com -m "headers,ssl,tech" ``` ### 深度爬取并自定义速率限制 ``` trishul http://example.com -d 5 --rate-limit 5 --timeout 15 ``` ### 加载自定义插件 ``` trishul http://example.com --plugins-dir ./my_plugins ``` ## ⚙ CLI 参考 ``` Usage: trishul [OPTIONS] TARGET_URL TRISHUL Scanner — Scan TARGET_URL for web vulnerabilities. Options: -d, --depth INTEGER Crawler depth (1-10) [default: 3] -o, --output TEXT Output file path -f, --format [json|html|cli] Report format [default: cli] -m, --modules TEXT Modules: all | crawler,ports,headers, fuzz,ssl,tech,plugins [default: all] --rate-limit INTEGER Max requests per second [default: 10] --timeout INTEGER Request timeout in seconds [default: 10] --retries INTEGER Max retry attempts [default: 3] --plugins-dir TEXT Path to custom plugins directory --no-banner Suppress the ASCII banner -v, --verbose Verbose output --help Show this message and exit ``` ## 🧩 插件系统 所有插件位于 `trishul/plugins/`,运行时自动加载。 ### 内置插件 | 插件文件 | 检测方法 | 严重性 | |-------------|-----------------|----------| | `xss_detector.py` | 反射参数 + DOM 汇入分析 | HIGH | | `sqli_detector.py` | SQL 错误模式(MySQL/PG/MSSQL/Oracle) | HIGH/CRITICAL | | `open_redirect.py` | 重定向参数分析 + Location 头部 | MEDIUM/HIGH | ### 编写你自己的插件 ``` # trishul/plugins/my_check.py(或 --plugins-dir) from typing import Dict, List from trishul.core.models import Finding, Severity from trishul.plugins.base import BasePlugin class MyPlugin(BasePlugin): name = "My Custom Check" description = "Detects something interesting" author = "Your Name" version = "1.0.0" async def run( self, url: str, headers: Dict[str, str], body: bytes, status_code: int, ) -> List[Finding]: findings = [] body_text = body.decode("utf-8", errors="ignore") if "vulnerable_pattern" in body_text: findings.append(Finding( title="Descriptive Title", severity=Severity.HIGH, url=url, description="Explanation of the vulnerability", evidence="What was found", module="plugin:my_check", remediation="How to fix it", cwe="CWE-XXX", )) return findings ``` 然后运行: ``` trishul http://target.com --plugins-dir ./my_plugins ``` 请参阅 [CONTRIBUTING.md](CONTRIBUTING.md) 获取完整的插件指南。 ## 📁 项目结构 ``` trishul-scanner/ ├── trishul/ │ ├── cli.py # CLI entry point (Click + Rich) │ ├── core/ │ │ ├── engine.py # Scan orchestrator │ │ ├── http_client.py # Async HTTP + rate limiter + retry │ │ ├── models.py # Finding, ScanResult, ScanConfig │ │ └── response_analyzer.py # Soft-404 & false-positive reduction │ ├── modules/ │ │ ├── crawler.py # Async BFS web crawler │ │ ├── port_scanner.py # asyncio TCP port scanner │ │ ├── header_analyzer.py # Security header analysis │ │ ├── fuzz_engine.py # Sensitive path fuzzer │ │ ├── ssl_analyzer.py # SSL/TLS certificate analyzer │ │ └── tech_detector.py # Technology fingerprinting │ ├── plugins/ │ │ ├── base.py # BasePlugin ABC │ │ ├── loader.py # Dynamic plugin loader │ │ ├── xss_detector.py # XSS detection plugin │ │ ├── sqli_detector.py # SQLi detection plugin │ │ └── open_redirect.py # Open redirect plugin │ └── reporters/ │ ├── cli_reporter.py # Rich terminal output │ ├── json_reporter.py # JSON export │ └── html_reporter.py # HTML report (Jinja2) ├── templates/ │ └── report.html.j2 # Dark-mode HTML report template ├── tests/ │ └── test_basic.py # Basic test suite ├── .github/ │ ├── workflows/ci.yml # GitHub Actions CI (3 OS × 3 Python) │ ├── ISSUE_TEMPLATE/ # Bug, Feature, Plugin templates │ └── PULL_REQUEST_TEMPLATE.md ├── requirements.txt ├── setup.py ├── pyproject.toml ├── CHANGELOG.md ├── CONTRIBUTING.md ├── DISCLAIMER.md ├── LICENSE └── README.md ``` ## ⚡ 性能 | 功能 | 实现 | |---------|---------------| | 异步 HTTP | `aiohttp`,连接池(100 个连接) | | 速率限制 | 令牌桶 — 可配置 RPS | | 重试逻辑 | 指数退避(可配置尝试次数) | | 端口扫描器 | 200 并发异步 TCP 检查 | | 模糊引擎 | 信号量控制(20 并发路径检查) | ## 🔒 严重性级别 | 级别 | 颜色 | 描述 | |-------|-------|-------------| | 🔴 CRITICAL | 红色 | 需要立即行动 — 数据泄露或 RCE 风险 | | 🟠 HIGH | 橙色 | 严重安全漏洞 — 需尽快修复 | | 🟡 MEDIUM | 黄色 | 重要问题 — 建议尽快修复 | | 🔵 LOW | 蓝色 | 轻微问题 — 可选修复 | | ⚪ INFO | 灰色 | 信息性 — 建议审查 | ## 🛣 路线图 - [ ] 识别 `robots.txt` / `sitemap.xml` 的爬取 - [ ] Cookie 安全性检查(HttpOnly、Secure、SameSite) - [ ] CORS 错误配置检测 - [ ] 目录列表检测 - [ ] WAF 检测 - [ ] 子域名枚举 - [ ] CI/CD 退出码模式 - [ ] PyPI 包发布 ## 🧪 运行测试 ``` python tests/test_basic.py ``` 预期输出: ``` ================================================== TRISHUL Scanner — Test Suite ================================================== ✔ Finding creation test passed ✔ Findings sorting test passed ✔ Response analyzer soft-404 test passed ✔ ScanConfig defaults test passed ✔ Plugin loader test passed — loaded: ['XSS Detector', 'SQL Injection Detector', 'Open Redirect Detector'] ================================================== All tests passed! ✅ ================================================== ``` ## 🤝 贡献 欢迎贡献!请先阅读 [CONTRIBUTING.md](CONTRIBUTING.md)。 **快速开始:** ``` git checkout -b feature/my-feature # 进行更改 python tests/test_basic.py git commit -m "feat: add my feature" git push origin feature/my-feature # 打开拉取请求 ``` ## 📄 许可证 MIT 许可证 — 详见 [LICENSE](LICENSE)。 ## ⚠ 安全策略 如果发现 TRISHUL 本身存在安全漏洞,请 **不要公开提交问题**。 请私下邮件联系维护者或打开 [GitHub Security Advisory](https://github.com/YOUR_USERNAME/trishul-scanner/security/advisories/new)。
**TRISHUL** — 以神圣三叉戟 ⚔️ 命名 *力量。准确性。目的。* 用心为安全社区制作 | [报告漏洞](.github/ISSUE_TEMPLATE/bug_report.md) · [请求功能](.github/ISSUE_TEMPLATE/feature_request.md) · [提交插件](.github/ISSUE_TEMPLATE/plugin_submission.md)
标签:BeEF, Python开发, Web安全, Web应用程序安全, 云存储安全, 低误报, 威胁情报, 安全测试, 开发者工具, 异步IO, 异步编程, 插件架构, 攻击性安全, 模块化设计, 爬虫, 结构化查询, 网络扫描, 自动化修复, 自动化安全, 蓝队分析, 调试插件, 逆向工具, 高质量漏洞检测