Skip to content

Commit 972bfda

Browse files
committed
Final QA changes for v0.2
1 parent dd1a8cd commit 972bfda

File tree

1 file changed

+20
-12
lines changed

1 file changed

+20
-12
lines changed

nosqlmap.py

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -89,25 +89,26 @@ def mainMenu():
8989

9090

9191
def options():
92-
global victim
93-
global webPort
94-
global uri
95-
global httpMethod
96-
global myIP
97-
global myPort
92+
9893
#Set default value if needed
9994
if optionSet[0] == False:
95+
global victim
10096
victim = "Not Set"
10197
if optionSet[1] == False:
98+
global webPort
10299
webPort = 80
103100
optionSet[1] = True
104101
if optionSet[2] == False:
102+
global uri
105103
uri = "Not Set"
106104
if optionSet[3] == False:
105+
global httpMethod
107106
httpMethod = "GET"
108107
if optionSet[4] == False:
108+
global myIP
109109
myIP = "Not Set"
110110
if optionSet[5] == False:
111+
global myPort
111112
myPort = "Not Set"
112113

113114
select = True
@@ -228,7 +229,7 @@ def options():
228229
victim = reqData[1].split( " ")[1].replace("\r\n","")
229230
optionSet[0] = True
230231
uri = methodPath[1].replace("\r\n","")
231-
optList[2] = True
232+
optionSet[2] = True
232233

233234
elif select == "9":
234235
savePath = raw_input("Enter file name to save: ")
@@ -836,7 +837,10 @@ def buildUri(origUri, randValue):
836837
return uriArray[0]
837838

838839
def stealDBs(myDB):
839-
menuItem = 1
840+
menuItem = 1
841+
if optionSet[4] == False:
842+
raw_input("No destination database set! Press enter to return to the main menu.")
843+
mainMenu()
840844

841845
for dbName in dbList:
842846
print str(menuItem) + "-" + dbName
@@ -875,8 +879,12 @@ def stealDBs(myDB):
875879
return()
876880

877881
except:
878-
raw_input ("Something went wrong. Are you sure your MongoDB is running and options are set? Press enter to return...")
879-
mainMenu()
882+
if str(sys.exc_info()).find('text search not enabled') != 1:
883+
raw_input("Database copied, but text indexing was not enabled on the target. Indexes not moved. Press enter to return...")
884+
mainMenu()
885+
else:
886+
raw_input ("Something went wrong. Are you sure your MongoDB is running and options are set? Press enter to return...")
887+
mainMenu()
880888

881889
def massMongo():
882890
global victim
@@ -906,8 +914,8 @@ def massMongo():
906914
mainMenu()
907915

908916

909-
print "Debug:"
910-
print ipList
917+
#print "Debug:"
918+
#print ipList
911919

912920
if loadOpt == "2":
913921
while loadCheck == False:

0 commit comments

Comments
 (0)