sqlmap使用指南(不定期更新)

sqlmap使用指南(不定期更新)

一、sqlmap简介
sqlmap支持
MySQL
Oracle
PostgreSQL
Microsoft SQL Server
Microsoft Access
IBM DB2
SQLite
Firebird
Sybase
SAP MaxDB
等数据库的各种安全漏洞检测。

sqlmap支持五种不同的注入模式:
1、基于布尔的盲注,即可以根据返回页面判断条件真假的注入;
2、基于时间的盲注,即不能根据页面返回内容判断任何信息,用条件语句查看时间延迟语句是否执行(即页面返回时间是否增加)来判断;
3、基于报错注入,即页面会返回错误信息,或者把注入的语句的结果直接返回在页面中;
4、联合查询注入,可以使用union的情况下的注入;
5、堆查询注入,可以同时执行多条语句的执行时的注入。
二、sqlmap下载安装及更新
Kali自带sqlmap直接使用

更新kali sqlmap
cd /usr/share
rm -rf sqlmap
git clone https://github.com/sqlmapproject/sqlmap

三、sqlmap参数详解
1、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)
#-v 0   只显示python错误和一些严重信息
#-v 1   显示基本信息(默认)
#-v 2   显示debug信息
#-v 3   显示注入过程的payload   #推荐
#-v 4   显示http请求包
#-v 5   显示http响应头
#-v 6   显示http响应页面
2、Target(目标)
At least one of these options has to be provided to define the target(s)
在这些选项中必须提供至少有一个确定目标
#目标url
-u URL, --url=URL   Target URL (e.g. "http://www.site.com/vuln.php?id=1")
#sqlmap -u "http://www.xxx.com/index.php?id=1"
#sqlmap --url="http://www.xxx.com/index.php?id=1"
#直接连接数据库的连接字符串
-d DIRECT           Connection string for direct database connection
#(1).当数据库管理系统是MySQL、Oracle、Microsoft SQL Server或PostgreSQL等时格式为:
#dbms://username:password@dbms_ip:dbms_port/databse_name
#sqlmap -d "mysql://root:root@192.168.128.159:3306/security"
#(2).当数据库管理系统是SQLite、Microsoft Access或Firebird等时格式为:
#dbms://databse_filepath
#从Burp或者WebScarab代理日志文件中分析目标
-l LOGFILE          Parse target(s) from Burp or WebScarab proxy log file
#burpsuite记录日志 Setting---All---Project---Logging---Proxy Requests---保存位置
#sqlmap -l proxy.log
#常与--scope=SCOPE联合使用
#sqlmap -l burp.log --scope="(www)?\.target\.(com|net|org)"
#将目标地址保存在文件中,一行为一个URL地址进行批量检测。
-m BULKFILE         Scan multiple targets given in a textual file
#sqlmap -m url.txt
#url.txt
#www.target1.com/vuln1.php?q=foobar
#www.target2.com/vuln2.asp?id=1
#www.target3.com/vuln3/id/1*
#从文件加载HTTP请求
-r REQUESTFILE      Load HTTP request from a file
#如果是非get、非post型注入,则须将参数设置为*,来指定注入,如Cookie:*
#如果是https需要配合--force-ssl或者在Host后面加:443
#sqlmap -r target.txt
# GET /user.php?id=1 HTTP/1.1
# Host: 192.168.56.101:8080
# User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:55.0) Gecko/20100101 Firefox/55.0
# Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
# Accept-Language: zh-SG,en-US;q=0.7,en;q=0.3
# Accept-Encoding: gzip, deflate
# DNT: 1
# Connection: close
# Upgrade-Insecure-Requests: 1
#从谷歌中加载结果目标URL,只测试前100个结果
-g GOOGLEDORK       Process Google dork results as target URLs
#sqlmap -g "inurl:\".php?id=1\""
#从配置ini文件中加载选项
-c CONFIGFILE       Load options from a configuration INI file
#sqlmap -c sqlmap.conf
#参照/usr/share/sqlmap/sqlmap.conf进行填写
3、Request(请求)
These options can be used to specify how to connect to the target URL
#这些选项可以用来指定如何连接到目标URL
#http user-agent头的值      
-A AGENT, --user-agent=USER-AGENT  HTTP User-Agent header value
#sqlmap -u "www.xxx.com" -A "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:55.0) Gecko/20100101 Firefox/55.0"
#sqlmap -u "www.xxx.com" --user-agent="Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:55.0) Gecko/20100101 Firefox/55.0"
#默认情况下sqlmap的HTTP请求头中User-Agent值是:sqlmap/1.0-dev-xxxxxxx(http://sqlmap.org)
#额外的http头
-H HEADER, --headers=HEADERS  Extra header (e.g. "X-Forwarded-For: 127.0.0.1")
#sqlmap -u "www.xxx.com" -H "X-Forwarded-For: 127.0.0.1"
#sqlmap -u "www.xxx.com" --headers="Accept-Language: fr\nETag: 123"
#强制使用给定的HTTP方法
--method=METHOD     Force usage of given HTTP method (e.g. PUT)
#sqlmap -u "www.xxx.com" --method=PUT
#请求方法包括GET POST DELETE HEAD OPTIONS PUT TRACE
#通过POST发送数据参数
--data=DATA         Data string to be sent through POST (e.g. "id=1")
#sqlmap -u "www.xxx.com" --data="uname=1&password" 
#指定用于分割参数的字符,默认即为&
--param-del=PARAM-DEL  Character used for splitting parameter values (e.g. &) 
#sqlmap -u "www.xxx.com" --data="id=0;name=1" --param-del=";"
#HTTP Cookieheader值
--cookie=COOKIE     HTTP Cookie header value (e.g. "PHPSESSID=a8d127e..")
#sqlmap.py -u "www.xxx.com" --cookie "JSESSIONID=E5D6C8C81;NAME=werner;"
#cookie默认的分隔符为“;”
#用来分隔cookie的字符串值
--cookie-del=COOKIE-DEL  Character used for splitting cookie values (e.g. ;)
#sqlmap -u "www.xxx.com" --data="id=0;name=1" --cookie-del=";"
#暂无资料
--live-cookies=LIVE-COOKIES  Live cookies file used for loading up-to-date values
#暂无资料
--load-cookies=LOAD-COOKIES  File containing cookies in Netscape/wget format
#忽略响应中的Set-Cookie
--drop-set-cookie   Ignore Set-Cookie header from response
#若HTTP响应头中有“Set-Cookie”,Sqlmap会自动设置“Set-Cookie”设置的cookie,并对这些cookie进行检测。若不想让Sqlmap这么做,添加参数“–drop-set-cookie”即可,这样,Sqlmap会忽略“Set-Cookie”
#模仿智能手机的user-agent头
--mobile            Imitate smartphone through HTTP User-Agent header
#sqlmap -u "www.xxx.com" --mobile
#使用random-agent作为HTTP User-Agent头值
--random-agent      Use randomly selected HTTP User-Agent header value
#sqlmap -u "www.xxx.com" --random-agent
#HTTP主机头
--host=HOST         HTTP Host header value
#sqlmap --host="xxx.com"
#HTTP Referer头
--referer=REFERER   HTTP Referer header value
#sqlmap --referer="xxx"
#HTTP的认证类型 (Basic, Digest, NTLM or PKI)
--auth-type=AUTH..  HTTP authentication type (Basic, Digest, Bearer, ...)
#sqlmap --auth-type="Basic"
#HTTP认证凭证(name:password)
--auth-cred=AUTH..  HTTP authentication credentials (name:password)
#sqlmap --auth-cred="name:password"
#HTTP认证PEM证书/私钥文件
--auth-file=AUTH..  HTTP authentication PEM cert/private key file
#若Web服务器要求客户端提供证书则可以使用此参数指定一个PEM格式的证书文件。
#sqlmap --auth-file="cert.pem"
#暂无资料
--abort-code=ABO..  Abort on (problematic) HTTP error code(s) (e.g. 401)
#使用该参数忽略错误
--ignore-code=IG..  Ignore (problematic) HTTP error code(s) (e.g. 401)
#sqlmap --ignore-code="401"
#忽略系统的默认代理设置
--ignore-proxy      Ignore system default proxy settings
#sqlmap --ignore-proxy
#忽略重定向的尝试
--ignore-redirects  Ignore redirection attempts
#sqlmap --ignore-redirects
#忽略连接超时
--ignore-timeouts   Ignore connection timeouts
#sqlmap --ignore-timeouts
#使用代理服务器连接到目标URL
--proxy=PROXY       Use a proxy to connect to the target URL
#使用参数“–proxy”来设置一个HTTP(S)代理,格式是“http(s)://url:port”。
#若代理需要认证,使用参数“–proxy-cred”来提供认证凭证,格式是“username:password”
#sqlmap --proxy="127.0.0.1:1234"
#代理认证凭证(name:password)
--proxy-cred=PRO..  Proxy authentication credentials (name:password)
#sqlmap --proxy="127.0.0.1:1234" --proxy-cred="name:password"
#从文件加载代理列表
--proxy-file=PRO..  Load proxy list from a file
#使用参数“–proxy-file”指定一个存储着代理列表的文件
#Sqlmap会依次使用文件中的代理,当某个代理有任何连接问题时就会被弃用而换下一个代理。
#sqlmap --proxy-file="proxy.txt"
#暂无资料
--proxy-freq=PRO..  Requests between change of proxy from a given list
#使用Tor匿名网络
--tor               Use Tor anonymity network
#sqlmap --tor
#设置Tor代理端口
--tor-port=TORPORT  Set Tor proxy port other than default
#sqlmap --tor --tor-port 9050
#设置Tor代理类型 (HTTP,SOCKS4 or SOCKS5 (默认))
--tor-type=TORTYPE  Set Tor proxy type (HTTP, SOCKS4 or SOCKS5 (default))
#sqlmap --tor --tor-port 9050 --tor-type=SOCKS5
#检查Tor的是否正确使用
--check-tor         Check to see if Tor is used properly
#要求高度的匿名性可以使用参数“–check-tor”,加上该参数后Sqlmap会确保所有流量都走Tor代理
#sqlmap --check-tor
#设定两个HTTP(S)请求间的延迟
--delay=DELAY       Delay in seconds between each HTTP request
#设定为0.5的时候是半秒,默认是没有延迟的
#sqlmap --delay=0.5
#设定一个HTTP(S)请求超过多久判定为超时
--timeout=TIMEOUT   Seconds to wait before timeout connection (default 30)
#10表示10秒,默认是30秒
#当HTTP(S)超时时,可以设定重新尝试连接次数,默认是3次。
--retries=RETRIES   Retries when the connection timeouts (default 3)
#sqlmap --retries=4
#暂无资料
--retry-on=RETRYON  Retry request on regexp matching content (e.g. "drop")
#设定某一个参数值在每一次请求中随机的变化,值的类型和长度依照于原始值
--randomize=RPARAM  Randomly change value for given parameter(s)
#提供一个安全不错误的连接,每隔一段时间都会去访问一下
#有时服务器检测到某个客户端错误请求过多会对其进行屏蔽,而Sqlmap的测试往往会产生大量错误请求,为避免被屏蔽,可以时不时的产生几个正常请求以迷惑服务器。
--safe-url=SAFEURL  URL address to visit frequently during testing
#sqlmap --safe-url="www.xxx.com"
#提供一个安全不错误的连接,每次测试请求之后都会再访问一遍安全连接。
--safe-post=SAFE..  POST data to send to a safe URL
#sqlmap --safe-url="www.xxx.com" --safe-post="uname=1&passwd=1"
#从文件中载入安全HTTP请求
--safe-req=SAFER..  Load safe HTTP request from a file
#每次测试请求之后都会访问一下的安全URL
--safe-freq=SAFE..  Regular requests between visits to a safe URL
#sqlmap --safe-freq="www.xxx.com"
#跳过URL的有效载荷数据编码
--skip-urlencode    Skip URL encoding of payload data
#Sqlmap默认会对URL进行URL编码,可以使用该参数关闭URL编码
#sqlmap --skip-urlencode
#指定包含token的隐藏字段名
--csrf-token=CSR..  Parameter used to hold anti-CSRF token
#现在有很多网站通过在表单中添加值为随机生成的token的隐藏字段来防止CSRF攻击,Sqlmap会自动识别出这种保护方式并绕过。但自动识别有可能失效,此时就要用到这两个参数
#sqlmap --csrf-token="csrfmiddlewaretoken"
#从URL中提取token值
--csrf-url=CSRFURL  URL address to visit for extraction of anti-CSRF token
#sqlmap --csrf-url="www.xxx.com"
#访问防止CSRF攻击网站时用到的HTTP方法
--csrf-method=CS..  HTTP method to use during anti-CSRF token page visit
#sqlmap --csrf-method=GET
#请求方法包括GET POST DELETE HEAD OPTIONS PUT TRACE
#访问防止CSRF攻击网站时用到的POST数据
--csrf-data=CSRF..  POST data to send during anti-CSRF token page visit
#sqlmap --csrf-data="uname=1&passwd=1"
#重新尝试获取反csrf令牌 (default 0)
--csrf-retries=C..  Retries for anti-CSRF token retrieval (default 0)
#强制使用SSL/HTTPS
--force-ssl         Force usage of SSL/HTTPS
#sqlmap --force-ssl
#使用HTTP分块传输编码 (POST) 请求
--chunked           Use HTTP chunked transfer encoded (POST) requests
#使用HTTP参数污染的方法
--hpp               Use HTTP parameter pollution method
#在请求前执行python
--eval=EVALCODE     Evaluate provided Python code before the request (e.g."import hashlib;id2=hashlib.md5(id).hexdigest()")
#sqlmap -u"http://www.target.com/vuln.php?id=1&hash=c4ca4238a0b923820dcc509a6f75849b"--eval="import hashlib;hash=hashlib.md5(id).hexdigest()"
4、Optimization(优化)
These options can be used to optimize the performance of sqlmap
#这些选项可用于优化sqlmap性能
#打开所有的优化开关
-o                  Turn on all optimization switches
#添加此参数相当于同时添加下列三个优化参数:
#–keep-alive
#–null-connection
#–threads=3 (如果没有设置一个更好的值)
#预测普通查询输出
--predict-output    Predict common queries output
#使用持久HTTP(S)连接
--keep-alive        Use persistent HTTP(s) connections
#该参数与“–proxy”矛盾
#检索页面长度,而不需要实际的HTTP响应体
--null-connection   Retrieve page length without actual HTTP response body
#特殊的HTTP请求类型可以直接获得HTTP响应的大小而不用获得HTTP响应体。显然这在布尔型盲注中可以节约很大的带宽。
#最大并发HTTP请求数 (默认为1)
--threads=THREADS   Max number of concurrent HTTP(s) requests (default 1)
5、Injection(注入)
These options can be used to specify which parameters to test for,provide custom injection payloads and optional tampering scripts
#这些选项可用于指定要测试的参数、提供自定义注入有效载荷和可选的篡改脚本。
#测试的参数
-p TESTPARAMETER    Testable parameter(s)
#sqlmap -p "id,user-agent"
#伪静态网页。动态网页会明目张胆地列出参数,如:index.php?id=1
#伪静态网页则可能这样写/user/1/
#则需要这么测试sqlmap -u "http://www.xxx/com/user/1*/"
#跳过给定参数的测试
--skip=SKIP         Skip testing for given parameter(s)
#sqlmap --skip="user-agent,referer"
#跳过测试不显示为动态的参数
--skip-static       Skip testing parameters that not appear to be dynamic
#使用正则表达式排除参数进行测试(e.g. "ses")
--param-exclude=..  Regexp to exclude parameters from testing (e.g. "ses")
#暂无资料
--param-filter=P..  Select testable parameter(s) by place (e.g. "POST")
#强制后端的DBMS为此值
--dbms=DBMS         Force back-end DBMS to provided value
#sqlmap --dbms="MySQL 5.0"
#sqlmap --dbms="Microsoft SQL Server 2005"
#sqlmap --dbms="postgresql"
#Sqlmap支持以下这些数据库管理系统:
# MySQL
# Oracle
# PostgreSQL
# Microsoft SQL Server
# Microsoft Access
# Firebird
# SQLite
# Sybase
# SAP MaxDB
# DB2
#在添加“–dbms”参数的同时还添加了“–fingerprint”,Sqlmap只会在指定的数据库管理系统内进行指纹识别。
#DBMS认证凭证(user:password)
--dbms-cred=DBMS..  DBMS authentication credentials (user:password)
#强制后端DBMS操作系统为提供的值
--os=OS             Force back-end DBMS operating system to provided value
#sqlmap --os=Linux
#sqlmap --os=Windows
#使用大的数字使值无效
--invalid-bignum    Use big numbers for invalidating values
#有时在注入测试时需要生成无效参数造成无回显
#Sqlmap就会取大数(如:id=99999999)作为无效参数。
#使用逻辑运算来使值无效
--invalid-logical   Use logical operations for invalidating values
#Sqlmap就会使用逻辑操作符(如:id=13 AND 18=19)作为无效参数。
#使用随机字符串使值无效
--invalid-string    Use random strings for invalidating values
#Sqlmap就会使用字符串(如:id=akewmc)作为无效参数。
#关闭有效载荷投放机制
--no-cast           Turn off payload casting mechanism
#在检索结果时Sqlmap会将所有输入转换为字符串类型,若遇到空值(NULL)则将其替换为空白字符。
# 这样做是为了防止如连接空值和字符串之类的任何错误发生并可以简化数据检索过程。
# 但是有报告显示在老版本的Mysql中这样做会导致数据检索出现问题,因此添加了“–no-cast”来告诉Sqlmap不要这样做。
#关闭字符串编码
--no-escape         Turn off string escaping mechanism
#有时Sqlmap会使用用单引号括起来的字符串值作为payload,如“SELECT ‘foobar’”,默认地这些值会被编码,如上例将被编码为:
# “SELECT CHAR(102)+CHAR(111)+CHAR(111)+CHAR(98)+CHAR(97)+CHAR(114))”。这样做既可以混淆视听让人一时难以洞察payload的内容又可以在后台服务器使用类似magic_quote mysql_real_escape_string这样的转义函数的情况下字符串不受影响。当然在某些情况下需要关闭字符串编码,如为了缩减payload长度,用户可以使用“–no-escape”来关闭字符串编码。
#注入有效载荷前缀字符串
--prefix=PREFIX     Injection payload prefix string
#注入有效载荷后缀字符串
--suffix=SUFFIX     Injection payload suffix string
#使用给定的脚本篡改注入数据
--tamper=TAMPER     Use given script(s) for tampering injection data
6、Detection(检测)
These options can be used to customize the detection phase
#这些选项可以用来指定在SQL盲注时如何解析和比较HTTP响应页面的内容
--level=LEVEL       Level of tests to perform (1-5, default 1)
#sqlmap -u "www.xxx.com" --level=5
#检测级别大于等于2时会检测cookie是否有注入
#检测级别大于等于3时会检测User-Agent和Referer是否有注入
#若不是很清楚注入点在哪里可以设置一个比较高的检测级别
#执行测试的风险(0-3,默认为1)
--risk=RISK         Risk of tests to perform (1-3, default 1)
#风险等级2添加了基于时间的注入测试
#风险等级3添加了OR测试
#若注入点是在UPDATE语句中,使用OR测试可能会修改整个表的数据
#查询评估为True时匹配的字符串
--string=STRING     String to match when query is evaluated to True
#默认情况下在布尔型注入中Sqlmap通过比较返回页面内容来判断True或False。
#但有时页面每次刷新都会不同
#sqlmap --string="flag"
#查询评估为False时要匹配的字符串
--not-string=NOT..  String to match when query is evaluated to False
#sqlmap --not-string="slag"
#正则表达式在查询评估为True时匹配
--regexp=REGEXP     Regexp to match when query is evaluated to True
#查询评估为True时要匹配的HTTP代码
--code=CODE         HTTP code to match when query is evaluated to True
#HTTP状态码
#https://www.runoob.com/http/http-status-codes.html
#sqlmap --code=200
#在启发式为true的情况下执行全面测试
--smart             Perform thorough tests only if positive heuristic(s)
#仅根据文本内容比较页面
--text-only         Compare pages based only on the textual content
#若是HTTP响应体中有许多诸如JavaScript之类的活动内容,专注于纯文本的检测
#sqlmap --text-only="flag"
#根据标题比较页面
--titles            Compare pages based only on their titles
#sqlmap --titles="welcome"
7、Techniques(技术)
These options can be used to tweak testing of specific SQL injection
techniques
#这些选项可用于调整特定SQL注入技术的测试
#使用的SQL注入技术 (default “BEUSTQ”)
--technique=TECH..  SQL injection techniques to use (default "BEUSTQ")
# B:Boolean-based blind(布尔型注入)
# E:Error-based(报错型注入)
# U:Union query-based(可联合查询注入)
# S:Stacked queries(可多语句查询注入)
# T:Time-based blind(基于时间延迟注入)
# Q:Inline queries(嵌套查询注入)
#基于时间延迟注入中延时设置
--time-sec=TIMESEC  Seconds to delay the DBMS response (default 5)
#sqlmap --time-sec=10
#联合查询注入中列数设置
--union-cols=UCOLS  Range of columns to test for UNION query SQL injection
#sqlmap --union-cols=12-16
#联合查询注入中字符设置
--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
#sqlmap --union-from="users"
#DNS泄露攻击
--dns-domain=DNS..  Domain name used for DNS exfiltration attack
#搜索结果页面URL以获取二阶响应
--second-url=SEC..  Resulting page URL searched for second-order response
#从文件加载二阶HTTP请求
--second-req=SEC..  Load second-order HTTP request from file
8、Fingerprint(指纹)
#执行广泛的DBMS版本指纹
-f, --fingerprint   Perform an extensive DBMS version fingerprint
9、Enumeration(枚举)
These options can be used to enumerate the back-end database management system information, structure and data contained in the tables
#这些选项可用于枚举表中包含的端到端数据库管理系统信息、结构和数据
#检索所有内容
-a, --all           Retrieve everything
#检索 DBMS banner
-b, --banner        Retrieve DBMS banner
#在banner信息中可以得到软件开发商,软件名称、版本、服务类型等信息,
#检索 DBMS 当前用户
--current-user      Retrieve DBMS current user
#检索 DBMS 当前数据库
--current-db        Retrieve DBMS current database
#检索 DBMS 服务器主机名
--hostname          Retrieve DBMS server hostname
#检测 DBMS 当前用户是否为 DBA
--is-dba            Detect if the DBMS current user is DBA
#枚举 DBMS 用户
--users             Enumerate DBMS users
#枚举 DBMS 用户密码哈希
--passwords         Enumerate DBMS users password hashes
#枚举 DBMS 用户权限
--privileges        Enumerate DBMS users privileges
#枚举 DBMS 用户角色
--roles             Enumerate DBMS users roles
#枚举 DBMS 数据库
--dbs               Enumerate DBMS databases
#枚举 DBMS 数据库表
--tables            Enumerate DBMS database tables
#枚举 DBMS 数据库表列
--columns           Enumerate DBMS database table columns
#枚举 DBMS 架构
--schema            Enumerate DBMS schema
#检索表的条目数
--count             Retrieve number of entries for table(s)
#转储 DBMS 数据库表条目
--dump              Dump DBMS database table entries
#转储所有DBMS数据库表表条目
--dump-all          Dump all DBMS databases tables entries
#搜索列、表 和/或 数据库名称
--search            Search column(s), table(s) and/or database name(s)
#在枚举期间检查 DBMS 注释
--comments          Check for DBMS comments during enumeration
#检索在 DBMS 上运行的 SQL 语句
--statements        Retrieve SQL statements being run on DBMS
#要枚举的 DBMS 数据库
-D DB               DBMS database to enumerate
#要枚举的 DBMS 数据库表
-T TBL              DBMS database table(s) to enumerate
#要枚举的 DBMS 数据库表列
-C COL              DBMS database table column(s) to enumerate
#要枚举的 DBMS 数据库标识符
-X EXCLUDE          DBMS database identifier(s) to not enumerate
#要枚举的 DBMS 用户
-U USER             DBMS user to enumerate
#枚举表时排除 DBMS 系统数据库
--exclude-sysdbs    Exclude DBMS system databases when enumerating tables
#数据透视列名称
--pivot-column=P..  Pivot column name
#表转储时使用 WHERE 条件
--where=DUMPWHERE   Use WHERE condition while table dumping
#要检索的第一个转储表条目
--start=LIMITSTART  First dump table entry to retrieve
#要检索的最后一个转储表条目
--stop=LIMITSTOP    Last dump table entry to retrieve
#要检索的第一个查询输出单词字符
--first=FIRSTCHAR   First query output word character to retrieve
#要检索的最后一个查询输出单词字符
--last=LASTCHAR     Last query output word character to retrieve
#要执行的 SQL 语句
--sql-query=SQLQ..  SQL statement to be executed
#交互式 SQL 
--sql-shell         Prompt for an interactive SQL shell
#从给定文件执行 SQL 语句
--sql-file=SQLFILE  Execute SQL statements from given file(s)
10、Brute force(暴力破解)
These options can be used to run brute force checks
#这些选项可用于运行暴力检查
#检查是否存在公共表
--common-tables     Check existence of common tables
#检查是否存在公共列
--common-columns    Check existence of common columns
#检查是否存在通用文件
--common-files      Check existence of common files
11、User-defined function injection(用户自定义函数注入)
These options can be used to create custom user-defined functions
#这些选项可用于创建用户自定义的函数
#注入用户自定义的函数
--udf-inject        Inject custom user-defined functions
#共享库的本地路径
--shared-lib=SHLIB  Local path of the shared library
12、File system access(文件系统访问)
These options can be used to access the back-end database management
system underlying file system
#这些选项可用于访问文件系统基础的端到端数据库管理系统
#从后端 DBMS 文件系统读取文件
--file-read=FILE..  Read a file from the back-end DBMS file system
#sqlmap -u http://xxx/index.php?id=1 –file-read=/etc/httpd/conf
#在端到端 DBMS 文件系统上写入本地文件
--file-write=FIL..  Write a local file on the back-end DBMS file system
#要写入的端到端 DBMS 绝对文件路径
--file-dest=FILE..  Back-end DBMS absolute filepath to write to
#sqlmap -u http://xxx/index.php?id=1 –file-write=eval.txt --file-dest=/var/www/html/upload/123.php
13、Operating system access(操作系统访问)
These options can be used to access the back-end database management
system underlying operating system
#这些选项可用于访问操作系统基础的端到端数据库管理系统
#执行操作系统命令
--os-cmd=OSCMD      Execute an operating system command
#尝试交互式shell
--os-shell          Prompt for an interactive operating system shell
#提示 OOB shell, Meterpreter or VNC
--os-pwn            Prompt for an OOB shell, Meterpreter or VNC
#一键提示 OOB shell, Meterpreter or VNC
--os-smbrelay       One click prompt for an OOB shell, Meterpreter or VNC
#存储过程缓冲区溢出利用
--os-bof            Stored procedure buffer overflow exploitation
#数据库进程用户权限升级
--priv-esc          Database process user privilege escalation
#安装 Metasploit 框架的本地路径
--msf-path=MSFPATH  Local path where Metasploit Framework is installed
#临时文件目录的远程绝对路径
--tmp-path=TMPPATH  Remote absolute path of temporary files directory
14、Windows registry access(Windows注册表访问)
These options can be used to access the back-end database management
system Windows registry
#这些选项可用于访问端到端数据库管理系统 Windows 注册表
#读取Windows注册表项值
--reg-read          Read a Windows registry key value
#写入Windows注册表项值数据
--reg-add           Write a Windows registry key value data
#删除 Windows 注册表项值
--reg-del           Delete a Windows registry key value
#Windows注册表项键值
--reg-key=REGKEY    Windows registry key
#Windows 注册表key值
--reg-value=REGVAL  Windows registry key value
#Windows注册表密钥值数据
--reg-data=REGDATA  Windows registry key value data
#Windows注册表键值类型
--reg-type=REGTYPE  Windows registry key value type
15、General(通用)
These options can be used to set some general working parameters
#这些选项可用于设置一些常规工作参数
#保存和恢复检索会话文件的所有数据
-s SESSIONFILE      Load session from a stored (.sqlite) file
#记录所有HTTP流量到一个文本文件中
-t TRAFFICFILE      Log all HTTP traffic into a textual file
#丢掉空数据
--abort-on-empty    Abort data retrieval on empty results
#设置预定义answers (e.g. “quit=N,follow=N”)
--answers=ANSWERS   Set predefined answers (e.g. "quit=N,follow=N")
#包含 Base64 编码数据的参数
--base64=BASE64P..  Parameter(s) containing Base64 encoded data
#使用 URL 和文件名安全 Base64 字母表
--base64-safe       Use URL and filename safe Base64 alphabet (RFC 4648)
#从不询问用户输入,使用所有默认配置。
--batch             Never ask for user input, use the default behavior
#具有二进制值的结果字段 (e.g. “digest”)
--binary-fields=..  Result fields having binary values (e.g. "digest")
#在评估目标之前检查互联网连接
--check-internet    Check Internet connection before assessing the target
#从 sqlmap 特定的 UDF 和表清理 DBMS
--cleanup           Clean up the DBMS from sqlmap specific UDF and tables
#从目标 URL 开始抓取网站
--crawl=CRAWLDEPTH  Crawl the website starting from the target URL
#regexp从爬网中排除页面 (e.g. “logout”)
--crawl-exclude=..  Regexp to exclude pages from crawling (e.g. "logout")
#CSV 输出中使用的分隔字符 (default “,”)
--csv-del=CSVDEL    Delimiting character used in CSV output (default ",")
#盲 SQL 注入字符集 (e.g. “0123456789abcdef”)
--charset=CHARSET   Blind SQL injection charset (e.g. "0123456789abcdef")
#转储数据的文件
--dump-file=DUMP..  Store dumped data to a custom file
#转储数据的格式 (CSV (default), HTML orSQLITE)
--dump-format=DU..  Format of dumped data (CSV (default), HTML or SQLITE)
#用于数据检索的字符编码 (e.g. GBK)
--encoding=ENCOD..  Character encoding used for data retrieval (e.g. GBK)
#显示每个输出的估计到达时间
--eta               Display for each output the estimated time of arrival
#刷新当前目标的会话文件
--flush-session     Flush session files for current target
#解析和测试目标URL表单
--forms             Parse and test forms on target URL
#忽略存储在会话文件中的查询结果
--fresh-queries     Ignore query results stored in session file
#使用来自指定页号的 Google dork 结果
--gpage=GOOGLEPAGE  Use Google dork results from specified page number
#将所有 HTTP 流量记录到 HAR 文件中
--har=HARFILE       Log all HTTP traffic into a HAR file
#使用DBMS Hex函数数据检索
--hex               Use hex conversion during data retrieval
#自定义输出目录路径
--output-dir=OUT..  Custom output directory path
#分析并显示来自响应的 DBMS 错误消息
--parse-errors      Parse and display DBMS error messages from responses
#使用给定的脚本预处理响应数据
--preprocess=PRE..  Use given script(s) for preprocessing (request)
#使用给定的脚本后处理响应数据
--postprocess=PO..  Use given script(s) for postprocessing (response)
#具有未知字符标记的Redump条目
--repair            Redump entries having unknown character marker (?)
#将选项保存到配置 INI 文件
--save=SAVECONFIG   Save options to a configuration INI file
--scope=SCOPE       Regexp for filtering targets                        从提供的代理日志中使用正则表达式过滤目标
#与-l参数相结合使用
#sqlmap -l burp.log --scope="(www)?\.target\.(com|net|org)"
# `(www)?`:这是一个可选的组,匹配零次或一次出现的字符串 "www"。问号 "?" 前面的括号表示这个组是可选的。
# `\.target\.`:匹配字面值为 ".target." 的字符串。反斜杠 "\" 用于转义点号,以便其被视为普通字符进行匹配。
# `(com|net|org)`:这是一个分组,匹配 "com"、"net" 或 "org" 中的任意一个。
--skip-heuristics   Skip heuristic detection of vulnerabilities
#跳过WAF IPS IDS启发式检测保护
--skip-waf          Skip heuristic detection of WAF/IPS protection
#用于临时表的前缀 (default: “sqlmap”)
--table-prefix=T..  Prefix used for temporary tables (default: "sqlmap")
#按有效负载 和/或 标题选择测试 (e.g. ROW)
--test-filter=TE..  Select tests by payloads and/or titles (e.g. ROW)
#按有效负载 和/或 标题选择测试 (e.g. ROW)
--test-skip=TEST..  Skip tests by payloads and/or titles (e.g. BENCHMARK)
#web站点的根目录
--web-root=WEBROOT  Web server document root directory (e.g. "/var/www")
16、Miscellaneous(杂项)
#这些选项不适合任何其他类别
These options do not fit into any other category
#使用短记忆法 (e.g."flu,bat,ban,tec=EU")
-z MNEMONICS        Use short mnemonics (e.g. "flu,bat,ban,tec=EU")
#找到SQL注入时运行主机OS命令
--alert=ALERT       Run host OS command(s) when SQL injection is found
#发现sql注入时,发出蜂鸣声
--beep              Beep on question and/or when vulnerability is found
#检查缺少(可选)sqlmap 依赖项
--dependencies      Check for missing (optional) sqlmap dependencies
#禁用控制台输出着色
--disable-coloring  Disable console output coloring
#显示可用篡改脚本的列表
--list-tampers      Display list of available tamper scripts
#禁用日志记录到文件
--no-logging        Disable logging to a file
#脱机模式下工作(仅使用会话数据)
--offline           Work in offline mode (only use session data)
#安全地从 sqlmap数据目录中删除所有内容
--purge             Safely remove all content from sqlmap data directory
#CSV 结果文件在多个目标模式下的位置
--results-file=R..  Location of CSV results file in multiple targets mode
#尝试交互式shell
--shell             Prompt for an interactive sqlmap shell
#用于存储临时文件的本地目录
--tmp-dir=TMPDIR    Local directory for storing temporary files
#调整不稳定连接的选项
--unstable          Adjust options for unstable connections
#更新sqlmap
--update            Update sqlmap
#sqlmap --update
#适合初学者用户的简单向导界面
--wizard            Simple wizard interface for beginner users
四、sqlmap使用技巧
1、技巧1
sqlmap -u http://www.xxx.com/index.php?id=1&page=2
会默认测试第二个提交的参数,所以应将id放在后面或者在1后面加*
sqlmap -u http://www.xxx.com/index.php?id=1*&page=2
sqlmap -u http://www.xxx.com/index.php?page=2&id=1
五、参考链接
https://www.freebuf.com/sectool/164608.html

https://blog.csdn.net/wn314/article/details/78872828

https://blog.csdn.net/weixin_44971640/article/details/127864304
  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值