专注 APT 攻击与防御—工具介绍—Sqlmap

sqlmap参数详解:

由于Sqlmap 是常用工具之一,所以本篇的篇幅较长,详解一次所有参数。

1、Options(选项)

复制代码
Usage: python sqlmap.py [options]

Options(选项):

-h, --help Show basic help message and exit
## 展示帮助文档 参数

-hh Show advanced help message and exit
## 展示详细帮助文档参数

--version Show program's version number and exit
## 显示程序的版本号

-v VERBOSE Verbosity level: 0-6 (default 1)
## 详细级别:0-6(默认为1)

2、Target(目标)

复制代码
Target(目标):

At least one of these options has to be provided to define the target(s)

-d DIRECT Connection string for direct database connection
## 指定具体数据库

-u URL, --url=URL Target URL (e.g. "http://www.site.com/vuln.php?id=1")
## 目标URL

-l LOGFILE Parse target(s) from Burp or WebScarab proxy log file
## 解析目标(s)从Burp或WebScarab代理日志文件

-x SITEMAPURL Parse target(s) from remote sitemap(.xml) file
## 解析目标(s)从远程站点地图文件(.xml)

-m BULKFILE Scan multiple targets given in a textual file
## 扫描文本文件中给出的多个目标

-r REQUESTFILE Load HTTP request from a file
## 从本地文件加载HTTP请求 ,多用于post注入。

-g GOOGLEDORK Process Google dork results as target URLs
## 处理Google的结果作为目标URL。

-c CONFIGFILE Load options from a configuration INI file
## 从INI配置文件中加载选项。

3、Request(请求)

复制代码
Request(请求):

These options can be used to specify how to connect to the target URL
## 这些选项可以用来指定如何连接到目标URL。

--method=METHOD Force usage of given HTTP method (e.g. PUT)
## 强制使用给定的HTTP方法(e.g. PUT)

--data=DATA Data string to be sent through POST
## 通过POST发送的数据字符串

--param-del=PARA.. Character used for splitting parameter values
## 用于拆分参数值的字符

--cookie=COOKIE HTTP Cookie header value HTTP
## Cookie头的值

--cookie-del=COO.. Character used for splitting cookie values
## 用于分割Cookie值的字符

--load-cookies=L.. File containing cookies in Netscape/wget format
## 包含Netscape / wget格式的cookie的文件

--drop-set-cookie Ignore Set-Cookie header from response
## 从响应中忽略Set-Cookie头

--user-agent=AGENT HTTP User-Agent header value
## 指定 HTTP User - Agent头

--random-agent Use randomly selected HTTP User-Agent header value
## 使用随机选定的HTTP User - Agent头

--host=HOST HTTP Host header value
## HTTP主机头值

--referer=REFERER HTTP Referer header value
## 指定 HTTP Referer头

-H HEADER, --hea.. Extra header (e.g. "X-Forwarded-For: 127.0.0.1")
## 额外header

--headers=HEADERS Extra headers (e.g. "Accept-Language: fr\\nETag: 123")
## 额外header

--auth-type=AUTH.. HTTP authentication type (Basic, Digest, NTLM or PKI)HTTP
## 认证类型(Basic, Digest, NTLM or PKI)

--auth-cred=AUTH.. HTTP authentication credentials (name:password)
## HTTP认证凭证(name:password)

--auth-file=AUTH.. HTTP authentication PEM cert/private key file
## HTTP认证 PEM认证/私钥文件

--ignore-401 Ignore HTTP Error 401 (Unauthorized)
## 忽略HTTP错误401

--proxy=PROXY Use a proxy to connect to the target URL
## 使用代理连接到目标网址

--proxy-cred=PRO.. Proxy authentication credentials (name:password)
## 代理认证证书(name:password)

--proxy-file=PRO.. Load proxy list from a file
## 从文件中加载代理列表

--ignore-proxy Ignore system default proxy settings
## 忽略系统默认代理设置

--tor Use Tor anonymity network
## 使用Tor匿名网络

--tor-port=TORPORT Set Tor proxy port other than default
## 设置Tor代理端口而不是默认值

--tor-type=TORTYPE Set Tor proxy type (HTTP (default), SOCKS4 or SOCKS5)
## 设置Tor代理类型

--check-tor Check to see if Tor is used properly
## 检查Tor是否正确使用

--delay=DELAY Delay in seconds between each HTTP request
## 每个HTTP请求之间的延迟(秒)

--timeout=TIMEOUT Seconds to wait before timeout connection (default 30)
## 秒超时连接前等待(默认30)

--retries=RETRIES Retries when the connection timeouts (default 3)
## 连接超时时重试(默认值3)

--randomize=RPARAM Randomly change value for given parameter(s)
## 随机更改给定参数的值(s)

--safe-url=SAFEURL URL address to visit frequently during testing
## 在测试期间频繁访问的URL地址

--safe-post=SAFE.. POST data to send to a safe URL
## POST数据发送到安全URL

--safe-req=SAFER.. Load safe HTTP request from a file
## 从文件加载安全HTTP请求

--safe-freq=SAFE.. Test requests between two visits to a given safe URL
## 在两次访问给定安全网址之间测试请求

--skip-urlencode Skip URL encoding of payload data
## 跳过有效载荷数据的URL编码

--csrf-token=CSR.. Parameter used to hold anti-CSRF token
## 参数用于保存anti-CSRF令牌

--csrf-url=CSRFURL URL address to visit to extract anti-CSRF token
## 提取anti-CSRF URL地址访问令牌

--force-ssl Force usage of SSL/HTTPS
## 强制使用SSL /HTTPS

--hpp Use HTTP parameter pollution method
## 使用HTTP参数pollution的方法

--eval=EVALCODE Evaluate provided Python code before the request (e.g. 评估请求之前提供Python代码"import hashlib;id2=hashlib.md5(id).hexdigest()")

4、Optimization(优化)

复制代码
Optimization(优化):

These options can be used to optimize the performance of sqlmap
## 这些选项可用于优化sqlmap的性能

-o Turn on all optimization switches
## 开启所有优化开关

--predict-output Predict common queries output
## 预测常见的查询输出

--keep-alive Use persistent HTTP(s) connections
## 使用持久的HTTP(S)连接

--null-connection Retrieve page length without actual HTTP response body
## 从没有实际的HTTP响应体中检索页面长度

--threads=THREADS Max number of concurrent HTTP(s) requests (default 1)
## 最大的HTTP(S)请求并发量(默认为1)

5、Injection(注入)

复制代码
Injection(注入):

These options can be used to specify which parameters to test for, provide custom injection payloads and optional tampering scripts
## 这些选项可以用来指定测试哪些参数, 提供自定义的注入payloads和可选篡改脚本。

-p TESTPARAMETER Testable parameter(s)
## 可测试的参数(S)

--skip=SKIP Skip testing for given parameter(s)
## 跳过对给定参数的测试

--skip-static Skip testing parameters that not appear to be dynamic
## 跳过测试不显示为动态的参数

--param-exclude=.. Regexp to exclude parameters from testing (e.g. "ses")
## 使用正则表达式排除参数进行测试(e.g. "ses")

--dbms=DBMS Force back-end DBMS to this value
## 强制后端的DBMS为此值

--dbms-cred=DBMS.. DBMS authentication credentials (user:password)
## DBMS认证凭证(user:password)

--os=OS Force back-end DBMS operating system to this value
## 强制后端的DBMS操作系统为这个值

--invalid-bignum Use big numbers for invalidating values
## 使用大数字使值无效

--invalid-logical Use logical operations for invalidating values
## 使用逻辑操作使值无效

--invalid-string Use random strings for invalidating values
## 使用随机字符串使值无效

--no-cast Turn off payload casting mechanism
## 关闭有效载荷铸造机制

--no-escape Turn off string escaping mechanism
## 关闭字符串转义机制

--prefix=PREFIX Injection payload prefix string
## 注入payload字符串前缀

--suffix=SUFFIX Injection payload suffix string
## 注入payload字符串后缀

--tamper=TAMPER Use given script(s) for tampering injection data
## 使用给定的脚本(S)篡改注入数据

6、Detection(检测)

复制代码
Detection(检测):
These options can be used to customize the detection phase
## 这些选项可以用来指定在SQL盲注时如何解析和比较HTTP响应页面的内容。

--level=LEVEL Level of tests to perform (1-5, default 1)
## 执行测试的等级(1-5,默认为1)

--risk=RISK Risk of tests to perform (1-3, default 1)
## 执行测试的风险(0-3,默认为1)

--string=STRING String to match when query is evaluated to True
## 查询时有效时在页面匹配字符串

--not-string=NOT.. String to match when query is evaluated to False
## 当查询求值为无效时匹配的字符串

--regexp=REGEXP Regexp to match when query is evaluated to True
## 查询时有效时在页面匹配正则表达式

--code=CODE HTTP code to match when query is evaluated to True
## 当查询求值为True时匹配的HTTP代码

--text-only Compare pages based only on the textual content
## 仅基于在文本内容比较网页

--titles Compare pages based only on their titles
## 仅根据他们的标题进行比较

7、Techniques(技巧)

复制代码
Techniques(技巧):
These options can be used to tweak testing of specific SQL injection techniques
## 这些选项可用于调整具体的SQL注入测试。

--technique=TECH SQL injection techniques to use (default "BEUSTQ")
## SQL 注入技术测试(默认BEUST)

--time-sec=TIMESEC Seconds to delay the DBMS response (default 5)
## DBMS响应的延迟时间(默认为5秒)

--union-cols=UCOLS Range of columns to test for UNION query SQL injection
## 定列范围用于测试UNION查询注入

--union-char=UCHAR Character to use for bruteforcing number of columns
## 用于暴力猜解列数的字符

--union-from=UFROM Table to use in FROM part of UNION query SQL injection
## 要在UNION查询SQL注入的FROM部分使用的表

--dns-domain=DNS.. Domain name used for DNS exfiltration attack
## 域名用于DNS漏出攻击

--second-order=S.. Resulting page URL searched for second-order response
## 生成页面的URL搜索为second-order响应

8、Fingerprint(指纹)

复制代码
Fingerprint(指纹):

-f, --fingerprint Perform an extensive DBMS version fingerprint
## 执行检查广泛的DBMS版本指纹

文章来源:《专注 APT 攻击与防御 - Micro8 系列教程》 - 书栈网 · BookStack

相关推荐
数据库小组8 小时前
2026 年,MySQL 到 SelectDB 同步为何更关注实时、可观测与可校验?
数据库·mysql·数据库管理工具·数据同步·ninedata·selectdb·迁移工具
华科易迅8 小时前
MybatisPlus增删改查操作
android·java·数据库
Kethy__9 小时前
计算机中级-数据库系统工程师-计算机体系结构与存储系统
大数据·数据库·数据库系统工程师·计算机中级
SHoM SSER9 小时前
MySQL 数据库连接池爆满问题排查与解决
android·数据库·mysql
熬夜的咕噜猫9 小时前
MySQL备份与恢复
数据库·oracle
jnrjian10 小时前
recover database using backup controlfile until cancel 假recover,真一致
数据库·oracle
lifewange10 小时前
java连接Mysql数据库
java·数据库·mysql
大妮哟10 小时前
postgresql数据库日志量异常原因排查
数据库·postgresql·oracle
还是做不到嘛\.11 小时前
Dvwa靶场-SQL Injection (Blind)-基于sqlmap
数据库·sql·web安全
不写八个11 小时前
PHP教程004:php链接mysql数据库
数据库·mysql·php