Sqlmap中文使用手册 - Request模块参数使用

1. Request模块的帮助文档


指定http请求的相关参数。

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

    -A AGENT, --user..  HTTP User-Agent header value
    -H HEADER, --hea..  Extra header (e.g. "X-Forwarded-For: 127.0.0.1")
    --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
    --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")
    --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)
    --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..  Regular requests between visits to a 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 for extraction of anti-CSRF token
    --csrf-method=CS..  HTTP method to use during anti-CSRF token page visit
    --csrf-data=CSRF..  POST data to send during anti-CSRF token page visit
    --csrf-retries=C..  Retries for anti-CSRF token retrieval (default 0)
    --force-ssl         Force usage of SSL/HTTPS
    --chunked           Use HTTP chunked transfer encoded (POST) requests
    --hpp               Use HTTP parameter pollution method
    --eval=EVALCODE     Evaluate provided Python code before the request (e.g.
                        "import hashlib;id2=hashlib.md5(id).hexdigest()")


2. 各个参数的介绍



2.1 --method=METHOD


参数:–method=METHOD

作用:Force usage of given HTTP method (e.g. PUT)。指定HTTP方法。一般情况下,会自动检测请求的方法。在某些特定的情况下需要强制指定方法。

值:方法

实例:sqlmap -u “https://www.baidu.com/a.php?id=1” --method=put



2.2 --data=DATA


参数:–data=DATA

作用:Data string to be sent through POST (e.g. “id=1”)。指定HTTP数据。默认情况下,用于执行HTTP请求的方法是GET,但是当我们使用data参数,则HTTP会使用post方法将参数当作HTTP data提交,同时也会检测此参数有没有注入漏洞。

值:post提交的数据

实例:sqlmap -u "http://www.target.com/vuln.php" --data="id=1"



2.3 指定参数分割符


参数:–param-del=PARAM

背景:Character used for splitting parameter values (e.g. &)。指定参数分割符。一般情况下,网站会用&作为参数的分隔符,这也是SQLMAP默认使用的分隔符,如果有些web application不使用&作为分隔符的话,那么就使用–param-del去告诉sqlmap分隔符是什么。

实例:sqlmap -u “http://www.xxxxx.com/a.php?id=1;food=2” --param-del=”;”



2.4 -cookie相关


背景:

  1. 指定cookie可以用于两种情况:
    • web应用程序需要基于cookie的身份认证,并且你含有cookie
    • 你想要检测并利用cookie注入。(当–level设置为2或者更高的时候,sqlmap会检测cookie是否存在注入漏洞。)
  2. cookie的字符分隔通常是分号。

参数:

参数作用
–cookie指定cookie的内容
–cookie-del               指定cookie的分隔符
–load-cookies                      也可以把cookie保存在Netscape / wget格式的文件中,通过此参数来调用
–drop-set-cookie                             如果在通信过程中的任何时候,Web应用程序都会响应Set-cookie标题,则sqlmap会自动使用其他的HTTP请求中的值作为cookie,使用此参数sqlmap将会忽略使用cookie。


2.5 -agent相关


参数:

参数作用
–user-agent自定义User-Agent
–random-agent    从sqlmap自带的文本文件中随机选择一个user-agent。这个文件是 ./txt/user-agents.txt

背景:默认情况下,sqlmap使用的User-Agent是sqlmap/1.0-dev-xxxxxxx (http://sqlmap.org) 。(当 --level设置为3或者更高时,sqlmap会自动检测user-agent是否存在注入漏洞)



2.6 --host=HOST


参数:–host=HOST

作用:HTTP Host header value。指定HTTP Host。默认情况下,HTTP Host是从提供的目标URL中分析的,也可以手动设置Host。(当–level设置为5,则会对HTTP Host进行SQL注入测试)



2.7 --referer=REFERER


参数:–referer=REFERER

背景:HTTP Referer header value。指定HTTP Referer。默认情况下,没有HTTP Referer报头在HTTP请求发送。但是可以伪造HTTP Referer标头值。(当–level设置为3或者更高时,则会对HTTP Referer进行注入测试)



2.8 --headers=HEADERS


参数:–headers=HEADERS

作用:Extra headers (e.g. “Accept-Language: fr\nETag: 123”)。指定额外字段。可以在sqlmap发送的HTTP请求报文头部添加额外的字段。若添加多个字段,用”\n”分隔。

实例:sqlmap -u “http://www.xxx.com/a.php?id=1” --headers=”X-A : A \nX-B : B”



2.9 --auth-type / --auth-cred


参数:

参数说明
–auth-type=AUTH…               TTP authentication type (Basic, Digest, Bearer, …)。用于指定认证方式。认证方式有三种:Basic,Digest,NTLM。
–auth-cred=AUTH…HTTP authentication credentials (name:password)。用于给出身份认证的凭证。格式:username:password

作用:用于进行http协议认证。

实例:sqlmap -u “http://www.xxxxx.com/a.php?id=1” --auth-type Basic --auth-cred “admin:admin”



2.10 --auth-file=AUTH


参数:–auth-file=AUTH…

作用:HTTP authentication PEM cert/private key file。HTTP协议私钥认证。当Web服务器需要客户端证书和用于身份验证的私钥时,应使用此选项。提供的值应该是PEM格式的key_file,包含你的证书和私钥。



2.11 --ignore-code=IG


参数:–ignore-code=IG…

作用:Ignore (problematic) HTTP error code(s) (e.g. 401)。忽略HTTP错误状态码。如果你在测试返回401错误的站点时想忽略它并继续测试,则可以使用开关--ignore-401,这是个开关参数,后面不需要加其他的数据。



2.12 --proxy相关


参数作用
–proxy=PROXYUse a proxy to connect to the target URL。
设置代理,格式为:http://url:port
–proxy-cred=PRO      Proxy authentication credentials (name:password)。
当http(s)需要认证时,可以使用这个参数来提供凭证,格式:username:password
–proxy-file=PROLoad proxy list from a file。
指定一个包含有代理列表的文件,在连接时,会依次使用文件里面的代理,当代理无效时,会自动调到下一个代理
–ignor-proxyIgnore system default proxy settings。
忽略代理设置


2.13 --tor相关


作用:如果需要匿名,除了通过定义HTTP(S)代理服务器,还可以安装类似Privoxy这样的软件按照Tor的安装指导配置一个Tor客户端。

参数:

参数作用
–tor设置好Tor客户端后,使用这个参数让sqlmap自动设置使用Tor代理。
–tor-type自定义代理的类型。
–to-port自定义代理的端口。
–check-tor         使用这个开关,可以保证所有的配置都正确,sqlmap会检查是否一切数据都走的匿名代理,如果检查失败,sqlmap会警告你并退出。


2.14 --delay=DELAY


参数:–delay=DELAY

作用:Delay in seconds between each HTTP request。设定每个HTTP请求之间的延迟。默认情况下,不设置延迟。可以指定每个HTTP(S)请求之间等待的秒数。有效值是一个浮点数,例如0.5意味着半秒。



2.15 --timeout=TIMEOUT


参数:–timeout=TIMEOUT

作用:Seconds to wait before timeout connection (default 30)。设置超时时间,默认的超时时间是30s。可以通过这个参数手动设置超时时间,有效值为一个浮点数,比如10.5意味着十秒半。



2.16 连接超时后的最大重试次数


参数:–retries=RETRIES

作用:Retries when the connection timeouts (default 3)。设置连接超时后的最大重试次数。连接超时后sqlmap会重试连接,默认情况下,重试次数为3次。使用这个参数可以指定HTTP(S)连接超时时的最大重试次数。



2.17 --randomize=RPARAM


参数:–randomize=RPARAM

作用:Randomly change value for given parameter(s)。随机更改参数。可以指定请求参数名称,这些参数在请求期间根据原始长度和类型随机更改。



2.18 --safe相关


背景:有时服务器检测到某个客户端错误请求过多会对其进行屏蔽,而Sqlmap的盲注测试会产生大量错误请求。为了避免被限制,我们可以每隔一段时间来访问正确的url。使用以下参数,sqlmap将会每隔一段时间访问一个正确的URL,并且不会对其进行任何注入。

参数:

参数作用
–safe-url=SAFEURLURL address to visit frequently during testing。
隔段时间就访问一下正确的URL
–safe-post=SAFE…POST data to send to a safe URL。
访问正确URL时携带的POST数据
–safe-req=SAFER…Load safe HTTP request from a file。
从文件中载入安全HTTP请求
–safe-freq=SAFE…Regular requests between visits to a safe URL。
每次测试请求之后都会访问一下安全的URL


2.19 --skip-urlencode


参数:–skip-urlencode

作用:Skip URL encoding of payload data。关闭参数值的URL编码。默认情况下sqlmap会对参数进行编码。但是又的服务端只接受未编码的参数,这时候可以使用这个参数来停止sqlmap的自动编码。



2.20 --csrf相关


背景:现在有很多网站通过在表单中添加值为随机生成的token的隐藏字段来防止CSRF攻击。SqlMap的会自动尝试识别并绕过这种保护。

参数:

参数作用
–csrf-token=CSR    Parameter used to hold anti-CSRF token。
可用于指定隐藏字段名称。这对于网站使用非标准名称的情况很有用。
–csrf-url=CSRFURL      URL address to visit for extraction of anti-CSRF token。
用于从任意的URL中回收token值。若最初有漏洞的目标URL中没有包含token值,而在其他地址包含token值时该参数就很有用。


2.21 --force-ssl


参数: --force-ssl

作用:Force usage of SSL/HTTPS。强制使用SSL/HTTPS



2.22 --eval=EVALCODE


参数:–eval=EVALCODE

作用:Evaluate provided Python code before the request 。在每次请求前执行特定的python代码。用户想要更改或者添加新的参数值,这些参数值有某些依赖关系。则可以使用这个参数向sqlmap提供一段自定义的python代码,这段代码在每个请求之前都会被执行。

实例:sqlmap -u "http://www.xxx.com/vuln.php?id=1&hash=c4ca4238a0b9238\ 20dcc509a6f75849b" --eval="import hashlib;hash=hashlib.md5(id).hexdigest()" ,每次请求前,Sqlmap都会依据id值重新计算hash值并更新GET请求中的hash值。



  • 7
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值