1111import signal
1212import ast
1313
14+
1415def main ():
1516 signal .signal (signal .SIGINT , signal_handler )
1617 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.
1819 optionSet = [False ]* 9
1920 global yes_tag
2021 global no_tag
@@ -31,7 +32,7 @@ def main():
3132 global verb
3233 global scanNeedCreds
3334 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 )
3536 platform = "MongoDB"
3637 dbPort = 27017
3738 myIP = "Not Set"
@@ -85,13 +86,13 @@ def mainMenu():
8586 elif platform == "CouchDB" :
8687 nsmcouch .netAttacks (victim , dbPort , myIP )
8788
88- #Check minimum required options
89+ # Check minimum required options
8990 else :
9091 raw_input ("Target not set! Check options. Press enter to continue..." )
9192
9293
9394 elif select == "3" :
94- #Check minimum required options
95+ # Check minimum required options
9596 if (optionSet [0 ] == True ) and (optionSet [2 ] == True ):
9697 if httpMethod == "GET" :
9798 nsmweb .getApps (webPort ,victim ,uri ,https ,verb ,requestHeaders )
@@ -119,6 +120,7 @@ def mainMenu():
119120 else :
120121 raw_input ("Invalid selection. Press enter to continue." )
121122
123+
122124def platSel ():
123125 global platform
124126 global dbPort
@@ -142,6 +144,7 @@ def platSel():
142144 else :
143145 raw_input ("Invalid selection. Press enter to continue." )
144146
147+
145148def options ():
146149 global victim
147150 global webPort
@@ -159,7 +162,7 @@ def options():
159162 requestHeaders = {}
160163 optSelect = True
161164
162- #Set default value if needed
165+ # Set default value if needed
163166 if optionSet [0 ] == False :
164167 global victim
165168 victim = "Not Set"
@@ -207,24 +210,24 @@ def options():
207210 select = raw_input ("Select an option: " )
208211
209212 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.
211214 optionSet [0 ] = False
212215 ipLen = False
213216
214217 while optionSet [0 ] == False :
215218 goodDigits = True
216219 notDNS = True
217220 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
219222 octets = victim .split ("." )
220223
221224 if len (octets ) != 4 :
222- #Treat this as a DNS name
225+ # Treat this as a DNS name
223226 optionSet [0 ] = True
224227 notDNS = False
225228 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.
228231 for item in octets :
229232 try :
230233 if int (item ) < 0 or int (item ) > 255 :
@@ -296,39 +299,40 @@ def options():
296299 print "Invalid selection"
297300
298301 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.
300303 optionSet [4 ] = False
301304
302305 while optionSet [4 ] == False :
303306 goodLen = False
304307 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
308311 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
310313 octets = myIP .split ("." )
311- #If there aren't 4 octets, toss an error.
314+ # If there aren't 4 octets, toss an error.
312315 if len (octets ) != 4 :
313316 print "Invalid IP length."
314317
315318 else :
316319 goodLen = True
317320
318321 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.
320323 for item in octets :
321324 if int (item ) < 0 or int (item ) > 255 :
322325 print "Bad octet in IP address."
323326 goodDigits = False
324327
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
329330
331+ # Default value of goodDigits should be set to True
332+ # for example 12.12345.12.12
330333
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
332336 if goodLen == True and goodDigits == True :
333337 print "\n Shell/DB listener set to " + myIP + "\n "
334338 optionSet [4 ] = True
@@ -368,7 +372,7 @@ def options():
368372 if httpMethod == "POST" :
369373 postData = ast .literal_eval (csvOpt [1 ])
370374
371- #Set option checking array based on what was loaded
375+ # Set option checking array based on what was loaded
372376 x = 0
373377 for item in optList :
374378 if item != "Not Set" :
@@ -398,7 +402,7 @@ def options():
398402 paramValues = []
399403 httpMethod = "POST"
400404 postData = reqData [len (reqData )- 1 ]
401- #split the POST parameters up into individual items
405+ # split the POST parameters up into individual items
402406 paramsNvalues = postData .split ("&" )
403407
404408 for item in paramsNvalues :
0 commit comments