-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsqlxh.py
100 lines (82 loc) · 4.16 KB
/
sqlxh.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
#!/bin/python3
import os
import re
from PySide2 import QtCore
from PySide2 import QtGui
from PySide2.QtGui import QImageReader
from PySide2.QtUiTools import QUiLoader
from PySide2.QtWidgets import QApplication
gongnen = ['查询是否存在注入点',
'检测站点包含哪些数据库',
'获取网页的数据库名',
'获取指定数据库中的表名',
'获取数据库表中的字段',
'获取字段的数据内容',
'检测当前用户且判断是否为管理员用户'
]
class sql:
def __init__(self):
self.ui = QUiLoader().load('ui/untitled.ui')
self.ui.comboBox.addItems(gongnen)
self.ui.button1.clicked.connect(self.handleCalc)
pixmap = QtGui.QPixmap('img/1.png')
self.ui.label.setPixmap(pixmap)
self.ui.label.show()
def handleCalc(self):
url = sql.ui.text1.toPlainText()
level = int(sql.ui.text5.toPlainText())
threads = int(sql.ui.text6.toPlainText())
database = sql.ui.text2.toPlainText()
table = sql.ui.text3.toPlainText()
colu = sql.ui.text4.toPlainText()
method = sql.ui.comboBox.currentText()
b = ""
a = ""
if method == gongnen[0]:
b = os.popen(
"sqlmap -u \"{}\" --level {} --batch --threads {}".format(url, level, threads)).read()
if method == gongnen[1]:
a = os.popen("sqlmap -u \"{}\" --dbs --level {} --batch --threads {}".format(url, level, threads))
a = re.findall("\[\*] .*", a.read())
a = a[1:-1]
if method == gongnen[2]:
a = os.popen(
"sqlmap -u \"{}\" --current-db --level {} --batch --threads {}".format(url, level, threads))
a = re.findall("current (.*)", a.read())
a = [a[1]]
if method == gongnen[3]:
a = os.popen(
"sqlmap -u \"{}\" --tables -D \"{}\" --level {} --batch --threads {}".format(url, database, level,
threads))
a = re.findall("Database: .*\+", a.read(), flags=re.S)
if method == gongnen[4]:
a = os.popen(
"sqlmap -u \"{}\" --columns -T \"{}\" -D \"{}\" --level {} --batch --threads {}".format(url, table,
database,
level,
threads))
a = re.findall("Database: .*\+", a.read(), flags=re.S)
if method == gongnen[5]:
a = os.popen(
"sqlmap -u \"{}\" --dump -C \"{}\" -T \"{}\" -D \"{}\" --level {} --batch --threads {}".format(url,
colu,
table,
database,
level,
threads))
a = re.findall("Database: .*\+", a.read(), flags=re.S)
if method == gongnen[6]:
a = os.popen(
"sqlmap -u \"{}\" --current-user --is-dba --level {} --batch --threads {}".format(url, level, threads))
a = re.findall("current user: .*", a.read())
for i in a:
b += i
b += "\n"
sql.ui.textx1.setPlainText(b)
# print(b)
QImageReader.supportedImageFormats()
app = QApplication([])
app.addLibraryPath(os.path.join(os.path.dirname(QtCore.__file__), "plugins"))
sql = sql()
sql.ui.show()
app.exec_()