ianoit/MWSV
GitHub: ianoit/MWSV
一款模块化的综合 Web 漏洞扫描器,支持 16 种以上现代 Web 漏洞的自动化检测、插件扩展与 PDF 报告生成。
Stars: 0 | Forks: 0
# 模块化 Web 扫描器漏洞
一款具备模块化架构的综合 Web 漏洞扫描器,旨在简化开发与扩展过程。支持 16 种以上的现代 Web 漏洞类型,具备灵活的插件选择能力和全局速率限制功能。
## 🏗️ **架构**
此扫描器采用**模块化插件架构**,其中:
- **主扫描器** (`main_scanner.py`) 会自动检测并运行所有漏洞插件
- **每种漏洞类型**在 `vuln_plugins/` 文件夹中都有对应的插件文件
- **添加新漏洞**只需在插件文件夹中创建新的 Python 文件
- **现在您可以使用 `-p/--plugin` 参数选择要运行的特定插件**
- **通过 `--delay/-d` 参数支持全局速率限制,以防止目标网站崩溃**
## 📁 **项目结构**
```
main_scanner.py # Aplikasi scanner utama
vuln_plugins/ # Folder berisi semua plugin kerentanan (16+ plugin)
├── xss.py # Cross-Site Scripting (XSS)
├── sqli.py # SQL Injection
├── lfi_rfi.py # Local/Remote File Inclusion
├── csrf.py # Cross-Site Request Forgery
├── ssrf.py # Server-Side Request Forgery
├── xxe.py # XML External Entity
├── directory_traversal.py # Directory Traversal
├── open_redirect.py # Open Redirect
├── nosqli.py # NoSQL Injection
├── auth_bypass.py # Authentication Bypass
├── command_injection.py # Command Injection
├── security_headers.py # Security Headers Audit
├── sensitive_data_exposure.py # Sensitive Data Exposure
├── subdomain_enumeration.py # Subdomain Enumeration
├── idor.py # Insecure Direct Object Reference
├── file_upload.py # Insecure File Upload
└── ... (plugin lain dapat ditambah)
requirements_unified.txt # Dependencies Python
README.md # Dokumentasi ini
```
## 🔍 **可用漏洞插件(16 个插件)**
### **注入与代码执行漏洞:**
1. **跨站脚本攻击 (XSS)** - 通过表单输入检测反射型 XSS
2. **SQL 注入** - 利用基于错误的检测方法发现 SQL 注入
3. **NoSQL 注入** - 检测 NoSQL 注入漏洞(MongoDB 等)
4. **命令注入** - 检测操作系统命令注入(Linux/Windows)
5. **XML 外部实体 (XXE)** - 通过 XML 输入检测 XXE
### **文件与路径漏洞:**
6. **本地文件包含 (LFI)** - 检测 LFI 漏洞
7. **远程文件包含 (RFI)** - 检测 RFI 漏洞
8. **目录遍历** - 检测路径遍历漏洞
9. **不安全的文件上传** - 检测文件上传漏洞
### **身份验证与授权漏洞:**
10. **身份验证绕过** - 检测登录绕过及默认凭据
11. **不安全的直接对象引用 (IDOR)** - 检测水平越权
### **服务端漏洞:**
12. **跨站请求伪造 (CSRF)** - 检测未受 CSRF 保护的表单
13. **服务器端请求伪造 (SSRF)** - 通过 URL 参数检测 SSRF
14. **开放重定向** - 检测未经验证的重定向
### **信息泄露漏洞:**
15. **安全标头审计** - 审计缺失或薄弱的安全标头
16. **敏感数据暴露** - 检测响应中的敏感数据
17. **子域名枚举** - 发现子域名及 DNS 记录
## 🚀 **安装**
1. **克隆或下载项目:**
git clone
cd security
2. **安装依赖:**
pip install -r requirements_unified.txt
3. **运行扫描器:**
python main_scanner.py https://example.com
## 📖 **使用说明**
### **基本用法(所有插件):**
```
python main_scanner.py https://example.com
```
### **仅运行特定插件:**
```
# 仅使用 XSS plugin
python main_scanner.py https://example.com -p xss
# 仅使用 XSS 和 SQLi plugin
python main_scanner.py https://example.com -p xss,sqli
# injection plugin 组合
python main_scanner.py https://example.com -p xss,sqli,nosqli,command_injection
# authentication plugin 组合
python main_scanner.py https://example.com -p auth_bypass,idor
# information disclosure plugin 组合
python main_scanner.py https://example.com -p security_headers,sensitive_data_exposure,subdomain_enumeration
```
### **速率限制(请求间延迟)**
为防止目标网站崩溃,请使用 `--delay`(或 `-d`)参数设置请求之间的延迟(以秒为单位)。
- **默认值:** 0.2 秒(200ms)
- **使用示例:**
```
# 使用默认 delay 扫描(0.2 秒)
python main_scanner.py https://example.com
# request 之间间隔 1 秒 delay 进行扫描
python main_scanner.py https://example.com --delay 1
# 使用 0.5 秒 delay 扫描特定 plugin
python main_scanner.py https://example.com -p xss,sqli --delay 0.5
```
**最佳实践:**
- 对于生产环境或资源有限的网站,请使用较大的延迟(例如 1 秒)。
- 如果网站开始响应缓慢/超时,请增加延迟时间。
- 请勿对他人的网站使用过小的延迟。
### **结合 PDF 报告:**
```
# 扫描所有 plugin + 生成 PDF
python main_scanner.py https://example.com -r
# 扫描特定 plugin + 生成 PDF
python main_scanner.py https://example.com -p xss,sqli,csrf -r
# 使用自定义 timeout 扫描 + 生成 PDF
python main_scanner.py https://example.com --timeout 60 -p xss,sqli -r
```
### **可用参数:**
- `target` - 要扫描的目标 URL(必填)
- `--timeout` - 请求超时时间,以秒为单位(默认值:30)
- `-r, --report` - 根据扫描结果生成 PDF 报告
- `-p, --plugin` - 仅运行特定的插件(以逗号分隔)
- `-d, --delay` - 对目标发起请求间的延迟(秒)(默认值:0.2)
### **输出示例:**
```
[INFO] Loading plugins from: vuln_plugins
[INFO] Running plugin: xss.py
[PLUGIN] Scanning for XSS vulnerabilities...
[INFO] Running plugin: sqli.py
[PLUGIN] Scanning for SQL Injection vulnerabilities...
[INFO] Running plugin: auth_bypass.py
[PLUGIN] Scanning for Authentication Bypass vulnerabilities...
[INFO] Running plugin: security_headers.py
[PLUGIN] Scanning for Security Headers vulnerabilities...
[SUMMARY] Kerentanan yang ditemukan:
- [High] Cross-Site Scripting (XSS): XSS vulnerability detected in parameter search
- [Critical] SQL Injection: SQL injection vulnerability detected in parameter id
- [Medium] Missing Security Header: Missing HSTS header
- [Info] Subdomain Discovery: Subdomain found: admin.example.com
[SUCCESS] Report PDF berhasil dibuat: vulnerability_scan_report_20241215_143025.pdf
[INFO] Report PDF telah dibuat untuk analisis lebih lanjut.
```
## 📄 **PDF 报告功能**
此扫描器支持生成 PDF 格式的报告,内容包含:
- **扫描信息**(目标、时间、持续时间、漏洞总数)
- **漏洞摘要**(按严重程度分类)
- **漏洞详情**(包含证据的完整描述)
- **安全建议**(修复建议)
- **专业排版**(A4 尺寸、彩色表格、时间戳)
### **使用方法:**
```
python main_scanner.py https://example.com -r
```
### **报告文件位置:**
PDF 文件将保存在 `reports/` 文件夹中,命名格式为:`vulnerability_scan_report_YYYYMMDD_HHMMSS.pdf`
## 🛠️ **开发指南:添加新漏洞插件**
### **步骤 1:创建新插件文件**
```
touch vuln_plugins/nama_kerentanan.py
```
### **步骤 2:实现插件**
```
def scan(scanner):
"""Scan untuk kerentanan [Nama Kerentanan]"""
print("[PLUGIN] Scanning for [Nama Kerentanan] vulnerabilities...")
try:
# Logika deteksi kerentanan Anda di sini
# Contoh: Test untuk kerentanan tertentu
# Jika kerentanan ditemukan:
scanner.log_vulnerability(
'Nama Kerentanan',
'Severity', # Critical, High, Medium, Low, Info
'Deskripsi kerentanan',
'Bukti kerentanan',
'CWE-xxx'
)
except Exception as e:
print(f"[PLUGIN][Nama Kerentanan] Error: {e}")
```
### **步骤 3:测试插件**
```
python main_scanner.py https://example.com -p nama_kerentanan
```
### **可用的 Scanner 方法:**
- `scanner.target_url` - 要扫描的目标 URL
- `scanner.session` - requests session 对象(已自动实现速率限制)
- `scanner.timeout` - 请求超时时间
- `scanner.log_vulnerability(type, severity, description, evidence, cwe)` - 记录漏洞
- `scanner.urllib` - 用于 URL 操作的 urllib 模块
- `scanner.re` - 用于正则表达式操作的 re 模块
- `scanner.urljoin` - 用于拼接 URL 的 urljoin 函数
## 🔧 **插件开发最佳实践**
### **1. 错误处理**
```
try:
# Logika scanning Anda
pass
except Exception as e:
print(f"[PLUGIN][YourPlugin] Error: {e}")
```
### **2. 速率限制**
```
# 无需手动实现,在 session 中自动完成
```
### **3. 安全的 Payload**
```
# 良好:安全的测试 Payload
payloads = ['test', '{{7*7}}', 'admin\'--']
# 不良:具有破坏性的 Payload
payloads = ['DROP TABLE users', 'rm -rf /']
```
### **4. 明确的证据**
```
scanner.log_vulnerability(
'XSS',
'High',
'XSS vulnerability detected',
f'Payload: {payload}, Response contains: {response.text[:100]}',
'CWE-79'
)
```
## 🚨 **安全注意事项**
⚠️ **重要警告:**
- **法律合规**:仅扫描您拥有或获得明确授权的网站
- **速率限制**:尊重目标服务器并设置适当的延迟
- **误报**:建议对关键发现进行手动验证
- **安全测试**:在您的插件中使用无破坏性的 payload
- **错误处理**:始终妥善处理异常
## 📦 **依赖项**
- **requests** - 用于 Web 请求的 HTTP 库
- **beautifulsoup4** - HTML 解析
- **urllib3** - HTTP 客户端库
- **dnspython** - DNS 解析(用于子域名枚举)
- **python-nmap** - 端口扫描(如有需要)
- **reportlab** - 生成 PDF 报告
- **lxml** - XML 解析(用于 XXE 检测)
## 📄 **许可证与免责声明**
本项目仅供教育与授权的安全测试目的使用。用户在扫描任何系统之前,有责任确保已获得适当的授权。
**⚠️ 免责声明:**
本工具按“原样”提供,仅供教育目的。作者不对本工具的任何滥用或由此造成的损害承担责任。在进行安全评估之前,请务必确保您已获得适当的授权。
## 🎯 **路线图**
未来版本计划实现的功能:
- 针对 GraphQL 漏洞的插件
- 针对 JWT 漏洞的插件
- 针对 API 安全测试的插件
- 针对 WebSocket 漏洞的插件
- 针对速率限制绕过的插件
- 针对业务逻辑缺陷的插件
- 针对模板注入的插件
- 针对 HTTP 请求走私的插件
标签:CISA项目, DOE合作, Python, Web安全, 加密, 插件化架构, 无后门, 漏洞扫描器, 蓝队分析, 逆向工具