Python 编写的 Web 安全扫描工具,支持 信息收集、资产发现、漏洞检测、爬虫、子域名发现 五大模块。
pip install -r requirements.txt# 单目标扫描
python scanner.py -t http://example.com
# 多目标扫描(文件格式:每行一个URL)
python scanner.py -t targets.txt -o report.html
# 指定配置文件
python scanner.py -t http://example.com --config config.yaml
# 使用代理
python scanner.py -t http://example.com --proxy http://127.0.0.1:7890
# 使用登录Cookie
python scanner.py -t http://example.com --cookie "PHPSESSID=abc123; token=xyz"
# 指定模块
python scanner.py -t http://example.com -m info,asset,vuln,crawl
# 多格式报告
python scanner.py -t http://example.com --format all
# 跳过指定POC
python scanner.py -t http://example.com --skip-poc WeakPass,HTTPHeaders
# 启用 OOB 反连平台(盲打漏洞检测:盲SSRF/XXE/命令注入/Log4j)
python scanner.py -t http://example.com --oob
# OOB 指定外部回调地址(用于公网目标回调到本机)
python scanner.py -t http://example.com --oob --oob-external-host 1.2.3.4
# 使用认证配置文件(自动登录 + Session 维护)
python scanner.py -t http://example.com --auth-config auth.json
# 加载 Nuclei 模板(享受 7000+ 社区模板)
python scanner.py -t http://example.com --nuclei-templates nuclei-templates --nuclei-max 500| 参数 | 说明 | 默认值 |
|---|---|---|
-t |
目标 URL 或包含 URL 列表的文件路径 | 必填 |
-o |
报告输出路径 | scan_report.html |
-c |
并发数 | 50 |
--timeout |
请求超时时间(秒) | 10 |
-m |
启用的模块,逗号分隔 | info,asset,vuln |
--config |
配置文件路径 | config.yaml |
--proxy |
HTTP 代理,多个用逗号分隔 | 无 |
--cookie |
登录 Cookie | 无 |
--format |
报告格式:html / json / csv / all |
html |
--no-report |
仅控制台输出,不生成文件 | False |
--oob |
启用 OOB 反连平台(盲打漏洞验证) | False |
--oob-host |
OOB 服务监听地址 | 0.0.0.0 |
--oob-http-port |
OOB HTTP 回调端口 | 8080 |
--oob-dns-port |
OOB DNS 回调端口 | 5353 |
--oob-domain |
OOB DNS 回调域名后缀 | oob.local |
--oob-external-host |
OOB 外部可访问地址(生成回调URL用) | 自动检测 |
--auth-config |
认证配置文件路径(JSON) | 无 |
--nuclei-templates |
Nuclei 模板目录路径 | 无 |
--nuclei-max |
最大加载 Nuclei 模板数量 | 0(不加载) |
所有参数均可通过 config.yaml 管理,CLI 参数优先级更高:
concurrency: 50
timeout: 10
crawl_depth: 3
crawl_max_urls: 500
proxies:
- http://127.0.0.1:7890
- http://user:pass@127.0.0.1:8080
retry: 2
retry_delay: 1.0
modules:
info: true
asset: true
vuln: true
crawl: true
subdomain: false
report:
output: scan_report.html
format: html
include_evidence: true
skip_pocs:
- WeakPass
- HTTPHeaders- 技术指纹识别:检测 Web 服务器、中间件、后端语言、框架(Apache/Nginx/Tomcat/PHP/Spring/Django/Laravel/ThinkPHP 等)
- WAF 检测:识别 Cloudflare、阿里云 WAF、腾讯云 WAF、安全狗、D盾、ModSecurity、玄武盾、安恒明鉴、长亭雷池等
- CMS/框架识别:WordPress、Drupal、Joomla、Discuz、DedeCMS、致远OA、泛微OA/ecology/e-office/e-bridge、通达OA、用友NC/U8Cloud/畅捷通T+、金蝶云星空/EAS、蓝凌OA、万户OA、红帆iOffice、华天动力OA、帆软FineReport、正方教务、拓尔思TRS、大汉JCMS、东方通TongWeb/TongLINK/Q、宝兰德BES、中创InforBus、达梦DM8、人大金仓KingbaseES、神通OpenBASE、深信服SSL VPN、天融信VPN、H3C iMC、亿赛通CDG、奇安信天擎EDR 等
- favicon 指纹:通过 MurmurHash3 计算 favicon.ico 哈希值,匹配 Shodan/FOFA/Yakit 指纹库(300+ 系统)
- 关键词指纹:基于 body + header 双重匹配,覆盖国产 OA/ERP/防火墙/安全设备
- HTTP 头信息泄露:检测 Server、X-Powered-By 等敏感头暴露
- 目录爆破:基于字典的常见管理目录发现(admin/login/api/manager 等)
- API 端点发现:Swagger UI、OpenAPI、API Docs 等接口文档暴露检测
- 备份文件检测:.bak/.zip/.tar.gz/.sql 等备份文件扫描
- 敏感文件检测:.git/config、.env、.svn/entries、WEB-INF/web.xml、.htaccess 等
- 高危系统入口:admin、console、manager、OA、ERP 等管理后台发现
- 深度优先递归:自动从首页发现所有链接,支持配置最大深度(默认3层)
- 链接提取:解析
<a>、<link>、<form>、<script src>、<img src>等所有 URL 来源 - 表单参数提取:提取所有
<input>、<textarea>、<select>字段(含隐藏字段) - JS 内联 URL 解析:从
<script>和外部 JS 文件中提取 API 路径 - 同域限制:自动过滤外部域名,只爬目标站内资源
- 含参 URL 定向扫描:对爬虫发现的含参 URL 单独跑漏洞 POC
- Certificate Transparency 查询:从 crt.sh 被动获取子域名(最有效)
- 字典爆破 + DNS 解析:80+ 常见前缀(api/admin/vpn/uat 等),DNS 验证后 HTTP 探测
- DNS 记录枚举:查询 MX/TXT/CNAME 记录提取子域名
- 自动去重:合并所有来源结果,输出完整子域名列表
| POC 名称 | 说明 |
|---|---|
| SQLi | SQL注入 — 错误回显注入 + 布尔盲注 |
| XSS / XSSDOM / XSSStored | 反射型/DOM型/存储型 XSS |
| LFI / FileInclusion | 本地文件包含 — 路径穿越检测 |
| CMDi / CMDIAdvanced | 命令注入 — 多系统 payload + 盲注/OOB |
| SSRF / SSRFAdvanced | 服务端请求伪造 — 27种 payload + 增强版 |
| XXE / XXEInjection | XML外部实体 — DTD payload + HTTP/DNS/FTP OOB |
| Deserialization | 反序列化 — Shiro/Fastjson/Log4j 通用检测 |
| SSTI | 模板注入 — 14种模板引擎 payload |
| WeakPass | 弱口令 — 常见后台路径 + 常用弱口令 |
| SensitiveLeak | 敏感信息泄露 — 云密钥/JWT/数据库连接串/私钥 |
| OpenRedirect | 开放重定向 — Location origin 比较 |
| CORSMisconfig / CORSSecurity | CORS配置错误 — Origin反射/NULL信任/增强版 |
| HTTPHeaders | 安全头缺失 — 7 个安全头检测 |
| AuthBypass | 身份认证绕过 — JWT none 算法 + 默认凭证 |
| IDOR | 越权访问 — ID参数遍历 + 整数注入检测 |
| RateLimitBypass / OTPBruteForce | 速率限制/验证码爆破 |
| NoSQLInjection | NoSQL注入 — MongoDB 语法注入 |
| CRLFInjection | CRLF注入 — HTTP 响应头注入 |
| CookieSecurity | Cookie 缺失 HttpOnly/Secure/SameSite |
| DirectoryListing | 目录浏览开启检测 |
| DangerousMethods | HTTP TRACE/OPTIONS 方法检测 |
| HostHeaderInjection | Host 头注入/缓存投毒 |
| SessionFixation | 会话固定攻击检测 |
| CachePoisoning | Web 缓存投毒检测 |
| DNSRebinding | DNS 重绑定防护检测 |
| SSLTLSSecurity | SSL/TLS 配置/证书/协议检测 |
| WebCacheDeception | Web 缓存欺骗攻击检测 |
| HTTPMethodTampering | HTTP 方法篡改/访问控制绕过 |
| WebSocketSecurity | WebSocket 未加密/认证缺失 |
| GraphQLIntrospection / GraphQLSecurity | GraphQL 内省/查询注入/拒绝服务 |
| JWTVuln / JWTNoneAlgorithm | JWT 安全 — 无签名验证/弱密钥/空算法 |
| APISecurity | API 安全检测 |
| CSRFBypass | CSRF 防护绕过检测 |
| OAuthMisconfig / OAuthCSRF | OAuth 错误配置/CSRF |
| SAMLMisconfig | SAML 错误配置检测 |
| PrototypePollution | JavaScript 原型污染检测 |
| PasswordPolicy | 密码策略检测 |
| FileUploadRCE | 文件上传 RCE 检测 |
| BackupDiscovery / BackupFileExposure | 备份文件/敏感路径发现 |
| CloudMetadataSSRF | 云元数据 SSRF (AWS/GCP/Azure) |
| POC 名称 | 说明 |
|---|---|
| Struts2RCE | Apache Struts2 系列 RCE |
| Log4j2RCE | CVE-2021-44228 Log4j2 JNDI注入 |
| FastjsonRCE | Fastjson 反序列化 RCE |
| ShiroDeserialization | Apache Shiro 反序列化 RCE |
| JacksonDeserialization | Jackson/Jodd 反序列化 |
| CommonRCE | 通用框架RCE (Spring/Tomcat/ActiveMQ/Nacos/WebLogic/Jenkins) |
| SpringActuator | Spring Actuator 端点暴露 |
| Spring4Shell | Spring4Shell CVE-2022-22965 |
| SwaggerExposure | Swagger/OpenAPI 文档暴露 |
| ThinkPHPRCE | ThinkPHP 多版本 RCE |
| WebLogicRCE | CVE-2020-14882 认证绕过+RCE |
| ConfluenceRCE | CVE-2022-26134 OGNL注入 RCE |
| Ghostcat | CVE-2020-1938 Tomcat AJP 文件读取 |
| POC 名称 | 说明 |
|---|---|
| DockerAPI | Docker Remote API 未授权 (多端口) |
| KubernetesAPI | K8s API Server 未授权 (多端口) |
| JenkinsConsole | Jenkins Script Console 未授权 RCE |
| ElasticsearchUnauth | Elasticsearch 未授权访问 |
| RedisUnauth | Redis 未授权访问 (TCP协议直连) |
| NacosUnauth | Alibaba Nacos 未授权 (多端口) |
| MinIOUnauth | MinIO 对象存储未授权 |
| SolrUnauth | Apache Solr 未授权+RCE |
| ActiveMQRCE | ActiveMQ CVE-2023-46604 + Jolokia |
| WebDAVUpload | WebDAV PUT 上传 + 验证 + 清理 |
| EnvFileExposure | .env 环境文件泄露 (40+ 路径) |
| GitExposure | .git 仓库暴露 |
| PHPPharDeserialization | PHP Phar 反序列化 |
| POC 名称 | 说明 |
|---|---|
| HikvisionIntercomRCE | 海康威视 对讲系统 RCE |
| HikvisioniSecureFileread | 海康威视 iSecure Center 文件读取 |
| RuijieEGRCE | 锐捷 EG 网关 RCE |
| POC 名称 | 目标 | 说明 |
|---|---|---|
| SeeyonOA | 致远OA | CVE-2021-33904 任意文件读取 + 文件上传 |
| TongdaOA | 通达OA | ispirit 文件上传 + UEditor 上传 |
| WeaverEcology10RCE | 泛微 e-cology | CVE-202X 反序列化 RCE |
| WeaverResourceServletFileread | 泛微 e-cology | ResourceServlet 任意文件读取 |
| WeaverEOffice | 泛微 e-office | CVE-2023-1387 反序列化 RCE |
| WeaverEBridge | 泛微 e-bridge | 任意文件读取 + 集成平台 API |
| HongfanOA | 红帆 iOffice | 医疗OA (70%三甲医院) — 未授权/文件上传 |
| HuatianOA | 华天动力 OA | 政府OA — 文件上传/反序列化 |
| WanhuOA | 万户OA | 文件上传 + WEB-INF 配置泄露 |
| LandrayOA | 蓝凌OA | 任意文件读取 + SSRF + 反序列化 |
| POC 名称 | 目标 | 说明 |
|---|---|---|
| YonyouNC | 用友 NC | UAP WebService 反序列化 + WSDL |
| YonyouU8Cloud | 用友 U8 Cloud | FileReceive 反序列化 RCE |
| YonyouChanjet | 用友畅捷通 T+ | 反序列化 RCE (中小企业占有率第一) |
| YonyouGRPU8SQLi | 用友 GRP-U8 | SQL注入 |
| KingdeeCloud | 金蝶云星空 | kdsvc 反序列化 + CommonFileServer |
| KingdeeEAS | 金蝶 EAS | 反序列化/命令执行 (大型集团ERP) |
| InspurIgap | 浪潮 iGap | 央企ERP (70%国资委下属企业) — 未授权 |
| POC 名称 | 目标 | 说明 |
|---|---|---|
| TongWeb | 东方通 TongWeb | 控制台未授权 + 数据源密码读取 |
| TongLinkQ | 东方通 TongLINK/Q | 消息中间件控制台未授权 + JMX |
| BESAppServer | 宝兰德 BES | 控制台未授权 + JNDI + WAR部署 |
| InforBus | 中创 InforBus | 控制台未授权 + ESB 接口暴露 |
| DamengDB | 达梦数据库 DM8 | Manager 控制台未授权 + 用户/实例列表 |
| KingbaseES | 人大金仓 KingbaseES | Manager 未授权 + SQL 查询接口 |
| OpenBASE | 神通数据库 | Oscar Manager 未授权 + 数据表浏览 |
| POC 名称 | 目标 | 说明 |
|---|---|---|
| TRSMAS | 拓尔思 TRS MAS/WCM | 政府CMS第一 (部委90%) — RCE/文件上传 |
| DahanJCMS | 大汉网络 JCMS | 政府CMS第二 — FCKeditor文件上传 |
| FineReport | 帆软 FineReport | BI报表 (市场第一) — 任意文件读取 |
| Zhengfang | 正方教务系统 | 高校教务 (70%覆盖) — SQL注入/文件上传 |
| POC 名称 | 目标 | 说明 |
|---|---|---|
| SangforVPN | 深信服 SSL VPN | 任意文件读取 + 命令注入 |
| TianrongxinVPN | 天融信 SSL VPN | 任意文件读取 + 命令注入 |
| H3CiMC | H3C iMC 网管平台 | 未授权 API + 设备列表 + RCE |
| YisaitongCDG | 亿赛通 CDG | DLP 文档安全 (军工) — 文件读取/SQL注入 |
| QianxinEDR | 奇安信 天擎 EDR | 终端管理 API 未授权 + 策略泄露 |
OOB 盲打支持:Log4j2RCE、SSRF、XXE、CMDi 四个 POC 在启用
--oob时支持 OOB 反连验证,可检测无回显的盲打漏洞。
webscanner/
├── core/ # 核心引擎
│ ├── engine.py # 扫描调度器(两阶段并行流水线)
│ ├── config.py # 全局配置(风险等级/颜色等)
│ ├── config_loader.py # YAML 配置加载器
│ └── target.py # 目标解析(URL/IP/CIDR)
├── modules/ # 扫描模块
│ ├── info_gather.py # 信息收集
│ ├── asset_discovery.py # 资产发现
│ ├── crawler.py # 爬虫(递归链接+参数提取)
│ ├── subdomain_discovery.py # 子域名发现
│ ├── vuln_scan.py # 漏洞扫描调度(POC注册表)
│ │ └── poc/ # POC 检测插件(115个)
│ ├── oob/ # OOB 反连平台(HTTP/DNS回调)
│ │ ├── server.py # HTTP/DNS 服务
│ │ ├── client.py # Token 管理 + 轮询
│ │ └── token_store.py # 内存存储 + TTL
│ ├── auth_manager.py # 登录态管理(自动登录/Session维护/心跳)
│ ├── insertion_points/ # 多插入点自动发现(统一注入抽象层)
│ │ ├── models.py # InsertionPoint 数据模型
│ │ ├── extractor.py # 从URL/请求/响应中提取插入点
│ │ └── tester.py # POC便捷API(discover/test/fuzz)
│ └── nuclei_compat/ # Nuclei 模板兼容(7000+ 社区模板)
│ ├── parser.py # YAML 模板解析器
│ ├── variables.py # {{BaseURL}}/{{Hostname}} 变量替换
│ ├── matcher_engine.py # status/word/regex/dsl/size 匹配引擎
│ ├── extractor_engine.py # regex/json/xpath/kval 提取引擎
│ ├── executor.py # 请求构造+执行+匹配
│ └── poc_adapter.py # 动态包装为 BasePOC 子类
├── data/ # 指纹数据
│ └── fingerprints.json # favicon hash + keyword 指纹库
├── reports/ # 报告生成
│ ├── html_report.py # HTML 报告
│ ├── json_report.py # JSON 报告
│ ├── csv_report.py # CSV 报告
│ └── sarif_report.py # SARIF 标准格式
├── utils/
│ ├── http.py # 异步HTTP(重试/代理/Cookie/缓存)
│ └── logger.py # 日志与结果收集
├── scanner.py # 程序入口
├── config.yaml # 配置文件
└── requirements.txt # 依赖
- 重试机制:请求失败自动重试(可配置次数和间隔)
- 代理支持:支持多个代理轮换,格式
http://host:port或http://user:pass@host:port - Cookie/Session:自动收集 Set-Cookie,支持手动传入登录态
- SSL 绕过:默认跳过证书验证(适用于内网 HTTPS)
- 多方法支持:GET/POST/PUT/DELETE/HEAD/OPTIONS
- 响应缓存:LRU 缓存(200条/60秒),被动检测自动命中
- WAF 避让:自适应延迟 + 代理轮换,自动降速绕过 WAF
对标 Burp Collaborator / Xray 反连平台,解决无回显漏洞的验证难题。
POC 生成唯一 token
↓
构造 payload(如 JNDI / SSRF URL / 命令执行)
↓
发送 payload 到目标
↓
目标解析 payload → 发起外部请求 → 回调到 OOB 服务
↓
OOB 服务记录 {token: callback_data}
↓
POC 轮询查询 → 命中 = 确认漏洞存在
| 协议 | 用途 | 典型漏洞 |
|---|---|---|
| HTTP | GET/POST 回调 | 盲 SSRF、命令注入(curl/wget) |
| DNS | A/AAAA 查询 | Log4j JNDI、盲 XXE(DTD引用) |
# 基础用法:启用 OOB
python scanner.py -t http://target.com --oob
# 扫描器在内网,目标在公网(需指定外部可访问地址)
python scanner.py -t http://target.com --oob --oob-external-host 1.2.3.4
# 自定义端口(避免与现有服务冲突)
python scanner.py -t http://target.com --oob --oob-http-port 18080 --oob-dns-port 15353| POC | 检测模式 | OOB 验证方式 |
|---|---|---|
| Log4j2 RCE | JNDI 注入 → DNS 查询 | ${jndi:ldap://{token}.oob.local/a} |
| SSRF | 出站请求 → HTTP 回调 | 发送 OOB URL 作为参数 |
| XXE | DTD 外部引用 → HTTP 回调 | <!ENTITY xxe SYSTEM "{oob_url}"> |
| CMDi | 命令执行 → HTTP/DNS 回调 | curl {oob_url} / nslookup {token}.oob.local |
当
--oob未启用时,上述 POC 自动回退到原有检测逻辑(有回显模式 / interact.sh)。
扫描期间可通过 HTTP 访问 OOB 服务查看状态:
# 查看统计
curl http://localhost:8080/api/stats
# 查询指定 token 的回调记录
curl "http://localhost:8080/api/poll?token=ws_xxx_xxx"对标 AWVS / Acunetix 的认证扫描能力,解决需要登录才能访问的页面的漏洞检测问题。
- 多种认证方式:表单登录、JSON API 登录、Basic / Bearer Token
- Session 维护:扫描中定期心跳检测,自动检测 session 是否失效
- 自动重新登录:session 失效时自动重新登录,无需人工干预
- 零侵入:POC 无需改造,
AsyncHTTP自动在每个请求前附加认证信息
创建认证配置文件 auth.json:
{
"login_url": "http://target/login",
"auth_type": "form",
"method": "POST",
"data": {"username": "admin", "password": "admin123"},
"success_indicator": {
"status": 302,
"header_contains": {"location": "/home"}
},
"logout_indicator": {
"status": 302,
"body_contains": "请登录"
},
"session_check_url": "http://target/dashboard",
"session_check_interval": 300,
"auto_relogin": true
}然后运行扫描:
python scanner.py -t http://target.com --auth-config auth.json表单登录(最常见):
{
"auth_type": "form",
"login_url": "http://target/login",
"data": {"username": "admin", "password": "pass"},
"success_indicator": {"status": 302, "header_contains": {"location": "/dashboard"}}
}JSON API 登录:
{
"auth_type": "json",
"login_url": "http://target/api/auth",
"data": {"email": "admin@target.com", "password": "pass"},
"success_indicator": {"status": 200, "body_contains": "token"}
}Bearer Token:
{
"auth_type": "bearer",
"token": "eyJhbGciOiJIUzI1NiIs...",
"session_check_url": "http://target/api/profile",
"success_indicator": {"status": 200, "body_not_contains": "unauthorized"}
}Basic 认证:
{
"auth_type": "basic",
"username": "admin",
"password": "secret",
"session_check_url": "http://target/admin",
"success_indicator": {"status": 200}
}| 字段 | 类型 | 说明 |
|---|---|---|
login_url |
string | 登录接口地址 |
auth_type |
string | form / json / basic / bearer / cookie |
method |
string | HTTP 方法:POST / GET / PUT |
data |
object | 登录表单/JSON 数据 |
username / password |
string | 用户名密码(会自动填入 data 中) |
token |
string | Bearer Token |
headers |
object | 自定义请求头 |
success_indicator |
object | 登录成功判定条件 |
logout_indicator |
object | 登出/失效判定条件 |
session_check_url |
string | 心跳检测 URL(访问此 URL 确认 session 有效) |
session_check_interval |
int | 心跳间隔(秒),默认 300 |
auto_relogin |
bool | session 失效时是否自动重新登录,默认 true |
status: HTTP 状态码匹配body_contains: 响应体包含指定字符串(支持字符串或数组)body_not_contains: 响应体不包含指定字符串header_contains: 响应头包含指定字符串(如{"set-cookie": "session"})
对标 Burp Active Scan 的多插入点扫描能力,建立统一的"可注入位置"抽象层,让 POC 只关心 payload 和判断逻辑,不关心参数在哪、怎么编码。
- 自动发现插入点:从 URL query、POST body、JSON 字段、XML 节点、Cookie、Header、Path 动态段、Fragment 等 10 个位置自动提取
- 统一注入接口:
point.inject(payload)自动处理 URL 编码 / JSON 序列化 / XML 转义 / Header 换行清理 - VulnScan 统一预提取:每个目标只探测一次页面,所有 POC 共享发现的插入点,避免重复请求
- 向后兼容:POC 可逐步迁移,未迁移的 POC 自动回退到原有硬编码参数逻辑
| 位置 | 说明 | 典型场景 |
|---|---|---|
query |
URL 查询参数 | ?id=1 |
post_data |
表单数据 | application/x-www-form-urlencoded |
json |
JSON 请求体字段 | {"query": "test"} |
xml |
XML 节点值 | <name>admin</name> |
header |
HTTP 请求头 | User-Agent、X-Forwarded-For |
cookie |
Cookie 值 | session=xxx |
multipart |
文件上传字段 | multipart/form-data |
path |
URL 路径动态段 | /user/123/profile |
fragment |
URL 片段 | #section |
body_raw |
原始请求体 | 自定义格式 |
推荐方式(插入点驱动):
from modules.poc.base import BasePOC
from utils.logger import ScanResult
from core.config import SEVERITY_HIGH
class SQLiPOC(BasePOC):
name = "SQL注入"
severity = SEVERITY_HIGH
async def check(self):
# 1. 获取所有插入点(VulnScan 统一预提取,或实时发现)
points = await self.discover_insertion_points()
# 2. 在每个插入点测试 payloads
for point in points:
# 跳过不适合的位置
if point.location in ("path", "fragment", "header", "cookie"):
continue
# 获取基线响应
base_url, base_kwargs = point.inject("1")
base_resp = await self.http.request(
point.method, base_url, use_cache=False, **base_kwargs,
)
if not base_resp:
continue
base_text = base_resp["text"]
# 测试注入 payload
new_url, kwargs = point.inject("' AND '1'='1")
resp = await self.http.request(
point.method, new_url, use_cache=False, **kwargs,
)
if resp and "sql syntax" in resp["text"]:
self.logger.add_result(ScanResult(
module="漏洞扫描", name=self.name,
severity=self.severity, target=new_url,
detail=f"参数 {point.name} ({point.location}) 存在SQL注入",
evidence="...", solution="...",
))
return True
return None便捷批量测试(使用 InsertionPointTester):
from modules.insertion_points import InsertionPointTester
async def check(self):
tester = InsertionPointTester(self.http, self.target, self.logger)
points = await tester.discover()
# 只测试 query 和 post_data 位置
points = tester.filter_points(points, locations=["query", "post_data"])
for point in points:
for payload in ["<script>alert(1)</script>", "<img src=x onerror=alert(1)>"]:
resp = await tester.test(point, payload)
if resp and payload in resp["text"]:
# 发现 XSS
return True通用 Fuzz 接口:
async def check(self):
tester = InsertionPointTester(self.http, self.target, self.logger)
points = await tester.discover()
def gen_payloads(point):
return [";id", "|id", "&&id"]
def matcher(point, payload, resp):
return resp and "uid=" in resp.get("text", "")
hits = await tester.fuzz(points, gen_payloads, matcher, concurrency=5)
if hits:
# hits[0] = (point, payload, resp)
return True| POC | 支持的插入点位置 |
|---|---|
| CMDi | query, post_data, json, xml, header, cookie |
| SQLi | query, post_data, json, xml |
| XSS | query, post_data, json, xml, header, cookie |
其余 111 个 POC 保持原有逻辑不变,自动回退兼容。
WebScanner 支持直接加载和执行 Nuclei YAML 模板,复用项目安全社区 7000+ 模板的红利。
- YAML 解析:完整解析 Nuclei 模板的
id、info、http、matchers、extractors结构 - 变量替换:支持
{{BaseURL}}、{{RootURL}}、{{Hostname}}、{{Host}}、{{Port}}、{{Scheme}}、{{Path}}、{{File}}、{{Dir}}等全部内置变量 - 匹配引擎:支持
status、word、regex、dsl、size、binary六种 matchers - 提取引擎:支持
regex、json、xpath、kval四种 extractors - 动态 POC 包装:每个模板运行时动态生成 BasePOC 子类,无缝接入 VulnScan 调度
- 指纹标签过滤:Nuclei 模板的 tags 自动映射为 POC tags,享受现有指纹过滤能力
| 类型 | 说明 | 示例 |
|---|---|---|
status |
HTTP 状态码匹配 | status: [200, 301] |
word |
关键词包含检测 | words: ["admin", "login"] |
regex |
正则表达式匹配 | regex: ["version ([\d.]+)"] |
dsl |
DSL 表达式(简化版) | dsl: ["contains(body, 'xxx')"] |
size |
响应体长度匹配 | size: [100, 200] |
binary |
二进制内容匹配 | binary: ["504b0304"] |
| 类型 | 说明 | 示例 |
|---|---|---|
regex |
正则提取 | regex: ["version ([\d.]+)"], group: 1 |
json |
JSON 字段提取 | json: ["data.version"] |
xpath |
XPath 提取(依赖 lxml) | xpath: ["//title"] |
kval |
Header/Cookie 键值提取 | kval: ["session"] |
下载 Nuclei 模板(项目安全官方仓库):
git clone https://github.com/projectdiscovery/nuclei-templates.git扫描时加载模板:
# 加载 500 个模板(限制数量避免启动过慢)
python scanner.py -t http://target.com --nuclei-templates nuclei-templates --nuclei-max 500
# 只加载特定目录的模板
python scanner.py -t http://target.com --nuclei-templates nuclei-templates/http/cves --nuclei-max 200
# 与指纹过滤结合(只跑相关技术栈的模板)
python scanner.py -t http://target.com --nuclei-templates nuclei-templates --nuclei-max 500 -m info,vuln跳过/指定 Nuclei 模板:
# 跳过指定模板
python scanner.py -t http://target.com --nuclei-templates nuclei-templates --nuclei-max 500 --skip-poc CVE-2024-XXXX,tech-detect
# 只跑指定模板
python scanner.py -t http://target.com --nuclei-templates nuclei-templates --only-poc CVE-2024-XXXX- VulnScan:
_build_pocs()中自动发现并加载 Nuclei 模板,与原生 POC 统一调度 - ScannerEngine:新增
nuclei_templates_dir和nuclei_max_templates参数 - CLI:新增
--nuclei-templates和--nuclei-max参数 - 日志:命中结果以
漏洞扫描(Nuclei)模块记录,包含模板ID、matcher名称、提取数据
指纹数据存储在 data/fingerprints.json,新增指纹只需编辑 JSON,无需修改代码:
{
"favicon_hash": {
"thinkphp": [-532394952, 123456789]
},
"keyword": {
"body": {
"致远OA": ["seeyon", "致远互联"],
"泛微OA": ["wui", "ecology"]
},
"header": {
"Apache": ["Apache"],
"Nginx": ["nginx"]
}
}
}新增 POC 只需两步:
1. 创建 POC 文件 modules/poc/my_poc.py:
from modules.poc.base import BasePOC
from utils.logger import ScanResult
from core.config import SEVERITY_HIGH
class MyPOCPOC(BasePOC):
name = "我的漏洞检测"
severity = SEVERITY_HIGH
category = "业务安全"
async def check(self):
# 推荐:使用插入点自动发现
points = await self.discover_insertion_points()
if points:
return await self._check_with_points(points)
# 回退:传统硬编码参数
return await self._check_legacy()
async def _check_with_points(self, points):
for point in points:
new_url, kwargs = point.inject("payload")
resp = await self.http.request(
point.method, new_url, use_cache=False, **kwargs,
)
if resp and "vulnerable" in resp.get("text", ""):
self.logger.add_result(ScanResult(
module="漏洞扫描", name=self.name,
severity=self.severity, target=new_url,
detail="发现漏洞",
evidence="响应内容...",
solution="修复建议...",
))
return True
return None
async def _check_legacy(self):
url = f"{self.target.url}/api/endpoint"
resp = await self.http.get(url)
if resp and "vulnerable" in resp.get("text", ""):
self.logger.add_result(ScanResult(
module="漏洞扫描", name=self.name,
severity=self.severity, target=url,
detail="发现漏洞",
evidence="响应内容...",
solution="修复建议...",
))
return True
return None2. 无需手动注册 —— 将文件放入 modules/poc/ 即可自动发现(VulnScan._auto_discover_pocs() 会自动导入)。
POC 类必须继承 BasePOC 并实现 async def check(self) 方法。
扫描目标: 1 个
加载模块: info, asset, vuln, crawl
--------------------------------------------------
[目标] http://example.com
[子域名] 目标: example.com
[子域名] 共发现 3 个子域名
[爬虫] 启动,最大深度=3,最大URL数=500
[爬虫] 目录 42 个,文件 18 个,API 7 个
[爬虫] 完成,发现 156 个URL
[信息收集] 技术指纹识别 → Apache, PHP
[信息收集] CMS识别 → WordPress
[漏洞扫描] 加载 115 个POC
[漏洞扫描] 加载 115 个POC → https://example.com/api/user?id=1
--------------------------------------------------
扫描完成. 结果: 严重0 高危1 中危2 低危3 信息8
[+] 报告已保存: C:\...\scan_report.html
本工具仅用于 已获得授权 的安全测试。任何未授权的扫描行为由使用者自行承担法律责任。