Skip to content

Commit dd2915a

Browse files
committed
Add post option loading/saving
1 parent 08775f1 commit dd2915a

File tree

1 file changed

+22
-4
lines changed

1 file changed

+22
-4
lines changed

nosqlmap.py

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,14 @@ def mainMenu():
4444
while select:
4545
os.system('clear')
4646
#label = subprocess.check_output(["git","describe","--always"])
47+
print "===================================================="
48+
print " _ _ _____ _____ _ ___ ___ "
49+
print "| \ | | / ___|| _ | | | \/ | "
50+
print "| \| | ___ \ `--. | | | | | | . . | __ _ _ __ "
51+
print "| . ` |/ _ \ `--. \| | | | | | |\/| |/ _` | '_ \ "
52+
print "| |\ | (_) /\__/ /\ \/' / |____| | | | (_| | |_) |"
53+
print "\_| \_/\___/\____/ \_/\_\_____/\_| |_/\__,_| .__/"
54+
print "===================================================="
4755
print "NoSQLMap-v0.3"
4856
4957
print "\n"
@@ -168,7 +176,7 @@ def options():
168176
paramNames = pdArray[0::2]
169177
paramValues = pdArray[1::2]
170178
postData = dict(zip(paramNames,paramValues))
171-
#raw_input("Debug: " + str(postData))
179+
httpMethod = "POST"
172180
options()
173181
else:
174182
print "Invalid selection"
@@ -189,15 +197,21 @@ def options():
189197
loadPath = raw_input("Enter file name to load: ")
190198
try:
191199
fo = open(loadPath,"r" )
192-
csvOpt = fo.read()
200+
csvOpt = fo.readlines()
193201
fo.close()
194-
optList = csvOpt.split(",")
202+
optList = csvOpt[0].split(",")
195203
victim = optList[0]
196204
webPort = optList[1]
197205
uri = optList[2]
198206
httpMethod = optList[3]
199207
myIP = optList[4]
200208
myPort = optList[5]
209+
210+
if httpMethod == "POST":
211+
postData = csvOpt[1]
212+
213+
214+
201215

202216
#Set option checking array based on what was loaded
203217
x = 0
@@ -207,6 +221,7 @@ def options():
207221
x += 1
208222
except:
209223
print "Couldn't load options file!"
224+
#print str(sys.exc_info()) Debug
210225
options()
211226

212227
elif select == "8":
@@ -252,7 +267,10 @@ def options():
252267
savePath = raw_input("Enter file name to save: ")
253268
try:
254269
fo = open(savePath, "wb")
255-
fo.write(str(victim) + "," + str(webPort) + "," + str(uri) + "," + str(httpMethod) + "," + str(myIP) + "," + str(myPort))
270+
fo.write(str(victim) + "," + str(webPort) + "," + str(uri) + "," + str(httpMethod) + "," + str(myIP) + "," + str(myPort))
271+
272+
if httpMethod == "POST":
273+
fo.write(",\n"+ str(postData))
256274
fo.close()
257275
print "Options file saved!"
258276
except:

0 commit comments

Comments
 (0)