11
11
import signal
12
12
import ast
13
13
14
+
14
15
def main ():
15
16
signal .signal (signal .SIGINT , signal_handler )
16
17
global optionSet
17
- #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.
18
19
optionSet = [False ]* 9
19
20
global yes_tag
20
21
global no_tag
@@ -31,7 +32,7 @@ def main():
31
32
global verb
32
33
global scanNeedCreds
33
34
global dbPort
34
- #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 )
35
36
platform = "MongoDB"
36
37
dbPort = 27017
37
38
myIP = "Not Set"
@@ -85,13 +86,13 @@ def mainMenu():
85
86
elif platform == "CouchDB" :
86
87
nsmcouch .netAttacks (victim , dbPort , myIP )
87
88
88
- #Check minimum required options
89
+ # Check minimum required options
89
90
else :
90
91
raw_input ("Target not set! Check options. Press enter to continue..." )
91
92
92
93
93
94
elif select == "3" :
94
- #Check minimum required options
95
+ # Check minimum required options
95
96
if (optionSet [0 ] == True ) and (optionSet [2 ] == True ):
96
97
if httpMethod == "GET" :
97
98
nsmweb .getApps (webPort ,victim ,uri ,https ,verb ,requestHeaders )
@@ -119,6 +120,7 @@ def mainMenu():
119
120
else :
120
121
raw_input ("Invalid selection. Press enter to continue." )
121
122
123
+
122
124
def platSel ():
123
125
global platform
124
126
global dbPort
@@ -142,6 +144,7 @@ def platSel():
142
144
else :
143
145
raw_input ("Invalid selection. Press enter to continue." )
144
146
147
+
145
148
def options ():
146
149
global victim
147
150
global webPort
@@ -159,7 +162,7 @@ def options():
159
162
requestHeaders = {}
160
163
optSelect = True
161
164
162
- #Set default value if needed
165
+ # Set default value if needed
163
166
if optionSet [0 ] == False :
164
167
global victim
165
168
victim = "Not Set"
@@ -207,24 +210,24 @@ def options():
207
210
select = raw_input ("Select an option: " )
208
211
209
212
if select == "1" :
210
- #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.
211
214
optionSet [0 ] = False
212
215
ipLen = False
213
216
214
217
while optionSet [0 ] == False :
215
218
goodDigits = True
216
219
notDNS = True
217
220
victim = raw_input ("Enter the host IP/DNS name: " )
218
- #make sure we got a valid IP
221
+ # make sure we got a valid IP
219
222
octets = victim .split ("." )
220
223
221
224
if len (octets ) != 4 :
222
- #Treat this as a DNS name
225
+ # Treat this as a DNS name
223
226
optionSet [0 ] = True
224
227
notDNS = False
225
228
else :
226
- #If len(octets) != 4 is executed the block of code below is also run, but it is not necessary
227
- #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.
228
231
for item in octets :
229
232
try :
230
233
if int (item ) < 0 or int (item ) > 255 :
@@ -296,39 +299,40 @@ def options():
296
299
print "Invalid selection"
297
300
298
301
elif select == "7" :
299
- #Unset the setting boolean since we're setting it again.
302
+ # Unset the setting boolean since we're setting it again.
300
303
optionSet [4 ] = False
301
304
302
305
while optionSet [4 ] == False :
303
306
goodLen = False
304
307
goodDigits = True
305
- #Every time when user input Invalid IP, goodLen and goodDigits should be reset. If this is not done, there will be a bug
306
- #For example enter 10.0.0.1234 first and the goodLen will be set to True and goodDigits will be set to False
307
- #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
308
311
myIP = raw_input ("Enter the host IP for my " + platform + "/Shells: " )
309
- #make sure we got a valid IP
312
+ # make sure we got a valid IP
310
313
octets = myIP .split ("." )
311
- #If there aren't 4 octets, toss an error.
314
+ # If there aren't 4 octets, toss an error.
312
315
if len (octets ) != 4 :
313
316
print "Invalid IP length."
314
317
315
318
else :
316
319
goodLen = True
317
320
318
321
if goodLen == True :
319
- #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.
320
323
for item in octets :
321
324
if int (item ) < 0 or int (item ) > 255 :
322
325
print "Bad octet in IP address."
323
326
goodDigits = False
324
327
325
- # else:
326
- # goodDigits = True
327
- #Default value of goodDigits should be set to True
328
- #for example 12.12345.12.12
328
+ # else:
329
+ # goodDigits = True
329
330
331
+ # Default value of goodDigits should be set to True
332
+ # for example 12.12345.12.12
330
333
331
- #If everything checks out set the IP and break the loop
334
+
335
+ # If everything checks out set the IP and break the loop
332
336
if goodLen == True and goodDigits == True :
333
337
print "\n Shell/DB listener set to " + myIP + "\n "
334
338
optionSet [4 ] = True
@@ -368,7 +372,7 @@ def options():
368
372
if httpMethod == "POST" :
369
373
postData = ast .literal_eval (csvOpt [1 ])
370
374
371
- #Set option checking array based on what was loaded
375
+ # Set option checking array based on what was loaded
372
376
x = 0
373
377
for item in optList :
374
378
if item != "Not Set" :
@@ -398,7 +402,7 @@ def options():
398
402
paramValues = []
399
403
httpMethod = "POST"
400
404
postData = reqData [len (reqData )- 1 ]
401
- #split the POST parameters up into individual items
405
+ # split the POST parameters up into individual items
402
406
paramsNvalues = postData .split ("&" )
403
407
404
408
for item in paramsNvalues :
0 commit comments