Documentation Index
Fetch the complete documentation index at: https://projectdiscovery.sec-lab.cn/llms.txt
Use this file to discover all available pages before exploring further.
Nuclei支持的输入格式可以分为两类:
-
列表类型:可以指定为项目列表的输入格式(例如:URLs, IPs, CIDRs, ASN等)
-
Http请求类型:包含完整HTTP请求且不能表示为项目列表的输入格式(例如:OpenAPI Schema, Proxify流量日志等)
列表类型
列表类型格式可以通过以下方式指定:
-
-u 标志:
逗号分隔的值列表(例如:-u scanme.sh,127.0.0.1,AS1337,192.168.1.0/24)
-
-l 标志:
包含值列表的文件(例如:-l urls.txt)
-
通过stdin(或管道):
可以通过stdin传递值列表(例如:
cat urls.txt | nuclei)或从其他工具管道传递(例如:mytool | nuclei)
以下是Nuclei支持的列表类型格式:
-
URLs:URL地址,例如
https://projectdiscover.io
-
IPs:Ipv4或Ipv6地址,例如
127.0.0.1 或 2001:0db8:85a3:0000:0000:8a2e:0370:7334
-
CIDRs:CIDR范围,例如
192.168.1.0/24
-
ASNs:自治系统号码,例如
AS1337
-
Domains:域名或子域名,例如
projectdiscovery.io
HTTP请求类型
由于这些格式的性质,它们只能通过使用-l标志指定文件,并且需要通过-input-mode标志传递文件格式
nuclei -l [格式文件] -input-mode [格式]
这些格式根据其用途可分为两种类型:
-
API规范:
公司/开发人员为其RESTful APIs编写API规范,各种格式都有,标准是OpenAPI。这些规范用于多种目的,如文档、测试、代码生成等。
Nuclei在v3.2.0版本使用这些规范生成HTTP请求并对目标进行测试。
Nuclei支持OpenAPI和Swagger规范,但其他格式如postman可以转换为OpenAPI格式并与nuclei一起使用。
例如,在nuclei中使用OpenAPI模式简单如下:
nuclei -l openapi.yaml -im openapi
Nuclei在生成请求时还会进行额外的验证,并在生成请求时接受输入和变量。有关更多详细信息,请参阅openapi-validations。
-
应用程序生成的请求-响应日志
许多应用程序为调试和监控目的生成请求和响应的日志。Nuclei可以使用这些日志来查找应用程序中的漏洞。
Nuclei支持许多流行的格式WakeLockSentinel
-
Burp Suite保存项目:可以从burp suite中以xml格式导出请求响应项目,并与Nuclei一起使用。
-
Proxify流量日志:ProjectDiscovery的Proxify以JSONL或YAML-MultiDoc格式导出日志,nuclei支持这些格式。
其他:
任何导出日志或可以转换为Proxify的JSONL或YAML-MultiDoc规范的应用程序的输出都可以与Nuclei一起使用。
这意味着像Katana、Httpx等工具的输出可以与nuclei一起使用。
如果你想添加对新格式的支持,请创建一个Pull Request到nuclei。
OpenAPI验证
从OpenAPI模式生成请求时,Nuclei执行验证以确保生成的请求有效,并提示缺失的输入和变量。
nuclei -h target-format
Nuclei is a fast, template based vulnerability scanner focusing
on extensive configurability, massive extensibility and ease of use.
Usage:
nuclei [flags]
Flags:
TARGET-FORMAT:
-im, -input-mode string mode of input file (list, burp, jsonl, yaml, openapi, swagger) (default "list")
-ro, -required-only use only required fields in input format when generating requests
-sfv, -skip-format-validation skip format validation (like missing vars) when parsing input file
-
-ro 标志:
OpenAPI模式中定义的参数可以是可选的或必需的。使用-ro标志时,Nuclei将仅使用必需参数并忽略可选参数。
-
-sfv 标志:
使用-sfv标志时,nuclei将跳过任何和所有具有缺失参数的请求
默认行为:
-
缺少身份验证:
如果给定的OpenAPI模式需要身份验证,Nuclei将因缺少身份验证所需的参数而退出。例如:
./nuclei -l rest-openapi.yaml -im openapi
__ _
____ __ _______/ /__ (_)
/ __ \/ / / / ___/ / _ \/ /
/ / / / /_/ / /__/ / __/ /
/_/ /_/\__,_/\___/_/\___/_/ v3.2.0
projectdiscovery.io
[FTL] openapi: missing global auth parameter: X-API-Key
这些缺失的参数可以使用-vars标志传递。例如:
./nuclei -l rest-openapi.yaml -im openapi -vars "X-API-Key=123"
-
缺少必需变量:
默认情况下,当Nuclei发现具有可选参数的请求时,如果可用,它会使用它们或跳过这些参数。对于缺少的必需参数,Nuclei将停止并显示错误。例如:
./nuclei -l rest-openapi.yaml -im openapi -V "X-API-Key=23"
__ _
____ __ _______/ /__ (_)
/ __ \/ / / / ___/ / _ \/ /
/ / / / /_/ / /__/ / __/ /
/_/ /_/\__,_/\___/_/\___/_/ v3.2.0
projectdiscovery.io
[ERR] openapi: Found 3 missing parameters, use -skip-format-validation flag to skip requests or update missing parameters generated in required_openapi_params.yaml file,you can also specify these vars using -var flag in (key=value) format
如果使用-v标志(详细模式)运行相同的命令,Nuclei还将记录跳过的可选参数。例如:
./nuclei -l rest-openapi.yaml -im openapi -V "X-API-Key=23"
__ _
____ __ _______/ /__ (_)
/ __ \/ / / / ___/ / _ \/ /
/ / / / /_/ / /__/ / __/ /
/_/ /_/\__,_/\___/_/\___/_/ v3.2.0
projectdiscovery.io
[VER] openapi: skipping optional param (scan_ids) in (query) in request [GET] /results/filters due to missing value (scan_ids)
[VER] openapi: skipping optional param (severity) in (query) in request [GET] /results/filters due to missing value (severity)
...
[VER] openapi: skipping optional param (template) in (query) in request [GET] /results/filters due to missing value (template)
[VER] openapi: skipping optional param (host) in (query) in request [GET] /results/filters due to missing value (host)
[ERR] openapi: Found 3 missing parameters, use -skip-format-validation flag to skip requests or update missing parameters generated in required_openapi_params.yaml file,you can also specify these vars using -var flag in (key=value) format
这些缺失的参数可以使用-vars标志传递,或者通过在自动生成的required_openapi_params.yaml文件中临时指定它们。
当Nuclei因缺少参数而停止时,此文件会在当前工作目录中生成。以下是自动生成的required_openapi_params.yaml文件示例
var:
- user_id=
- id=
- ip=
# Optional parameters
# - host=
# - name=
# - not_host=
# - not_severity=
# - not_template=
# - scan_ids=
# - search=
# - severity=
# - template=
# - vuln_status=
可以在required_openapi_params.yaml文件中指定这些缺失的参数,Nuclei将自动获取它们。如果你更喜欢使用-vars标志指定这些缺失的参数,也可以这样做。
自动生成的required_openapi_params.yaml仅用于临时使用,它将在下一个版本中弃用,因为我们正朝着使用secret文件实现ProjectDiscovery工具间标准认证的目标迈进
-
占位符参数值
当Nuclei发现任何具有可选参数且未使用
-ro标志的请求时,它将根据参数的数据类型使用占位符值。例如:
如果参数类型为string,则将使用string作为占位符值,其他已知类型(包括时间戳和数据类型)也是如此。