Web:SqlMap工具

一、简介

        sqlmap 是一款开源的渗透测试工具,可以自动化进行SQL注入的检测、利用,并能接管数据库服务器。它具有功能强大的检测引擎,为渗透测试人员提供了许多专业的功能并且可以进行组合,其中包括数据库指纹识别、数据读取和访问底层文件系统,甚至可以通过带外数据连接的方式执行系统命令。

官网下载地址:GitHub - sqlmapproject/sqlmap: Automatic SQL injection and database takeover tool

使用方法:

python sqlmap.py 参数(Windows)

sqlmap 参数(Linux)

sqlmap可以运行在python2.6、2.7和3.x的任何平台上。

官方文档:

Usage · sqlmapproject/sqlmap Wiki (github.com)

二、使用方法

Options模块

1、 -h, --help

显示基础帮助信息。

python sqlmap.py -h

2、 -hh

显示高级帮助信息。

python sqlmap.py -h

3、 --version

显示版本信息。

python sqlmap.py -version

4、 -v VERBOSE

指定的输出信息的内容等级0-6

python sqlmap.py -u "http://ctf/sql_labs/Less-1/?id=1" -v 5

运行结果:

Target模块

1、 -u URL, --url=URL 

需要进行注入检测的目标URL。

python sqlmap.py -u "http://ctf/sql_labs/Less-1/?id=1"

2、 -d DIRECT 

通过字符串直连数据库。

争对不同的数据库有不同的连接字符串方式。

 案例:

python sqlmap.py -d "mysql://root:[email protected]:3306/testdb"

3、 -l LOGFILE 

从Burp或者WebScarab的代理日志中,解析目标。

        指定一个Burp或WebScarab的代理日志文件,Sqlmap将从日志文件中解析出可能的攻击目标,并逐个尝试进行注入。个人没尝试过!

4、 -m BULKFILE 

扫描文本文件提供的多个目标URL目标。

文本文件中包含多个URL目标,针对多个目标时候使用。

案例: 

python sqlmap.py -m url.txt

5、 -r REQUESTFILE 

从文件中加载HTTP请求。

        将一个HTTP请求保存在文件中,然后使用参数“-r”加载该文件,这样,可以跳过其他一些选项的使用(例如设置Cookie,发布数据等),以该文件中HTTP请求目标为攻击目标进行测试。

 案例:

python sqlmap.py -r a.txt

6、 -g GOOGLRFORK :将谷歌查询结果作为目标URL。

将谷歌搜索的前一百条结果,作为检测注入目标(需要科学上网(翻墙))

值:Google hack语句

实例:

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

7、 -c CONFIGFILE :从配置conf文件获取注入目标。

打开配置文件模板,填写需要的参数到模板,使用以下代码进行注入。

python sqlmap.py -c a.conf

Request模块

指定http请求的相关参数,感觉可以通过使用-r参数从文件中加载http请求更合适。

  Request:
    These options can be used to specify how to connect to the target URL

    --method=METHOD     Force usage of given HTTP method (e.g. PUT)
    --data=DATA         Data string to be sent through POST (e.g. "id=1")
    --param-del=PARA..  Character used for splitting parameter values (e.g. &)
    --cookie=COOKIE     HTTP Cookie header value (e.g. "PHPSESSID=a8d127e..")
    --cookie-del=COO..  Character used for splitting cookie values (e.g. ;)
    --live-cookies=L..  Live cookies file used for loading up-to-date values
    --load-cookies=L..  File containing cookies in Netscape/wget format
    --drop-set-cookie   Ignore Set-Cookie header from response
    -A AGENT, --user..  HTTP User-Agent header value
    --mobile            Imitate smartphone through HTTP User-Agent header
    --random-agent      Use randomly selected HTTP User-Agent header value
    --host=HOST         HTTP Host header value
    --referer=REFERER   HTTP Referer header value
    --headers=HEADERS   Extra headers (e.g. "Accept-Language: fr\nETag: 123")
    -H HEADER, --hea..  Extra header (e.g. "X-Forwarded-For: 127.0.0.1")
    --auth-type=AUTH..  HTTP authentication type (Basic, Digest, Bearer, ...)
    --auth-cred=AUTH..  HTTP authentication credentials (name:password)
    --auth-file=AUTH..  HTTP authentication PEM cert/private key file
    --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)
    --ignore-proxy      Ignore 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
    --proxy-freq=PRO..  Requests between change of proxy from a given list
    --tor               Use 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)
    --retry-on=RETRYON  Retry request on regexp matching content (e.g. "drop")
    --randomize=RPARAM  Randomly change value for given parameter(s)
    
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值