1
1
#!/usr/bin/python
2
- #NoSQLMap Copyright 2016 Russell Butturini
3
- #This program is free software: you can redistribute it and/or modify
4
- # it under the terms of the GNU General Public License as published by
5
- #the Free Software Foundation, either version 3 of the License, or
6
- #(at your option) any later version.
7
-
8
- #This program is distributed in the hope that it will be useful,
9
- #but WITHOUT ANY WARRANTY; without even the implied warranty of
10
- #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
- #GNU General Public License for more details.
12
-
13
- #You should have received a copy of the GNU General Public License
14
- #along with this program. If not, see <http://www.gnu.org/licenses/>.
15
-
2
+ # NoSQLMap Copyright 2012-2017 NoSQLMap Development team
3
+ # See the file 'doc/COPYING' for copying permission
16
4
17
5
import sys
18
6
import nsmcouch
23
11
import signal
24
12
import ast
25
13
14
+
26
15
def main ():
27
16
signal .signal (signal .SIGINT , signal_handler )
28
17
global optionSet
29
- #Set a list so we can track whether options are set or not to avoid resetting them in subsequent calls to the options menu.
18
+ # Set a list so we can track whether options are set or not to avoid resetting them in subsequent calls to the options menu.
30
19
optionSet = [False ]* 9
31
20
global yes_tag
32
21
global no_tag
@@ -43,7 +32,7 @@ def main():
43
32
global verb
44
33
global scanNeedCreds
45
34
global dbPort
46
- #Use MongoDB as the default, since it's the least secure ( :-p at you 10Gen )
35
+ # Use MongoDB as the default, since it's the least secure ( :-p at you 10Gen )
47
36
platform = "MongoDB"
48
37
dbPort = 27017
49
38
myIP = "Not Set"
@@ -75,7 +64,7 @@ def mainMenu():
75
64
print "\_| \_/\___/\____/ \_/\_\_____/\_| |_/\__,_| .__/"
76
65
print "===================================================="
77
66
print "NoSQLMap-v0.7"
78
- print "nosqlmap@gmail .com"
67
+ print "codingo@protonmail .com"
79
68
print "\n "
80
69
print "1-Set options"
81
70
print "2-NoSQL DB Access Attacks"
@@ -97,13 +86,13 @@ def mainMenu():
97
86
elif platform == "CouchDB" :
98
87
nsmcouch .netAttacks (victim , dbPort , myIP )
99
88
100
- #Check minimum required options
89
+ # Check minimum required options
101
90
else :
102
91
raw_input ("Target not set! Check options. Press enter to continue..." )
103
92
104
93
105
94
elif select == "3" :
106
- #Check minimum required options
95
+ # Check minimum required options
107
96
if (optionSet [0 ] == True ) and (optionSet [2 ] == True ):
108
97
if httpMethod == "GET" :
109
98
nsmweb .getApps (webPort ,victim ,uri ,https ,verb ,requestHeaders )
@@ -131,6 +120,7 @@ def mainMenu():
131
120
else :
132
121
raw_input ("Invalid selection. Press enter to continue." )
133
122
123
+
134
124
def platSel ():
135
125
global platform
136
126
global dbPort
@@ -154,6 +144,7 @@ def platSel():
154
144
else :
155
145
raw_input ("Invalid selection. Press enter to continue." )
156
146
147
+
157
148
def options ():
158
149
global victim
159
150
global webPort
@@ -171,7 +162,7 @@ def options():
171
162
requestHeaders = {}
172
163
optSelect = True
173
164
174
- #Set default value if needed
165
+ # Set default value if needed
175
166
if optionSet [0 ] == False :
176
167
global victim
177
168
victim = "Not Set"
@@ -219,24 +210,24 @@ def options():
219
210
select = raw_input ("Select an option: " )
220
211
221
212
if select == "1" :
222
- #Unset the boolean if it's set since we're setting it again.
213
+ # Unset the boolean if it's set since we're setting it again.
223
214
optionSet [0 ] = False
224
215
ipLen = False
225
216
226
217
while optionSet [0 ] == False :
227
218
goodDigits = True
228
219
notDNS = True
229
220
victim = raw_input ("Enter the host IP/DNS name: " )
230
- #make sure we got a valid IP
221
+ # make sure we got a valid IP
231
222
octets = victim .split ("." )
232
223
233
224
if len (octets ) != 4 :
234
- #Treat this as a DNS name
225
+ # Treat this as a DNS name
235
226
optionSet [0 ] = True
236
227
notDNS = False
237
228
else :
238
- #If len(octets) != 4 is executed the block of code below is also run, but it is not necessary
239
- #If the format of the IP is good, check and make sure the octets are all within acceptable ranges.
229
+ # If len(octets) != 4 is executed the block of code below is also run, but it is not necessary
230
+ # If the format of the IP is good, check and make sure the octets are all within acceptable ranges.
240
231
for item in octets :
241
232
try :
242
233
if int (item ) < 0 or int (item ) > 255 :
@@ -308,39 +299,40 @@ def options():
308
299
print "Invalid selection"
309
300
310
301
elif select == "7" :
311
- #Unset the setting boolean since we're setting it again.
302
+ # Unset the setting boolean since we're setting it again.
312
303
optionSet [4 ] = False
313
304
314
305
while optionSet [4 ] == False :
315
306
goodLen = False
316
307
goodDigits = True
317
- #Every time when user input Invalid IP, goodLen and goodDigits should be reset. If this is not done, there will be a bug
318
- #For example enter 10.0.0.1234 first and the goodLen will be set to True and goodDigits will be set to False
319
- #Second step enter 10.0.123, because goodLen has already been set to True, this invalid IP will be put in myIP variables
308
+ # Every time when user input Invalid IP, goodLen and goodDigits should be reset. If this is not done, there will be a bug
309
+ # For example enter 10.0.0.1234 first and the goodLen will be set to True and goodDigits will be set to False
310
+ # Second step enter 10.0.123, because goodLen has already been set to True, this invalid IP will be put in myIP variables
320
311
myIP = raw_input ("Enter the host IP for my " + platform + "/Shells: " )
321
- #make sure we got a valid IP
312
+ # make sure we got a valid IP
322
313
octets = myIP .split ("." )
323
- #If there aren't 4 octets, toss an error.
314
+ # If there aren't 4 octets, toss an error.
324
315
if len (octets ) != 4 :
325
316
print "Invalid IP length."
326
317
327
318
else :
328
319
goodLen = True
329
320
330
321
if goodLen == True :
331
- #If the format of the IP is good, check and make sure the octets are all within acceptable ranges.
322
+ # If the format of the IP is good, check and make sure the octets are all within acceptable ranges.
332
323
for item in octets :
333
324
if int (item ) < 0 or int (item ) > 255 :
334
325
print "Bad octet in IP address."
335
326
goodDigits = False
336
327
337
- # else:
338
- # goodDigits = True
339
- #Default value of goodDigits should be set to True
340
- #for example 12.12345.12.12
328
+ # else:
329
+ # goodDigits = True
341
330
331
+ # Default value of goodDigits should be set to True
332
+ # for example 12.12345.12.12
342
333
343
- #If everything checks out set the IP and break the loop
334
+
335
+ # If everything checks out set the IP and break the loop
344
336
if goodLen == True and goodDigits == True :
345
337
print "\n Shell/DB listener set to " + myIP + "\n "
346
338
optionSet [4 ] = True
@@ -380,7 +372,7 @@ def options():
380
372
if httpMethod == "POST" :
381
373
postData = ast .literal_eval (csvOpt [1 ])
382
374
383
- #Set option checking array based on what was loaded
375
+ # Set option checking array based on what was loaded
384
376
x = 0
385
377
for item in optList :
386
378
if item != "Not Set" :
@@ -410,7 +402,7 @@ def options():
410
402
paramValues = []
411
403
httpMethod = "POST"
412
404
postData = reqData [len (reqData )- 1 ]
413
- #split the POST parameters up into individual items
405
+ # split the POST parameters up into individual items
414
406
paramsNvalues = postData .split ("&" )
415
407
416
408
for item in paramsNvalues :
0 commit comments