Skip to content

Commit 08775f1

Browse files
committed
More work on POST requests
1 parent cf07cee commit 08775f1

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

nosqlmap.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ def options():
118118
print "1-Set target host/IP (Current: " + str(victim) + ")"
119119
print "2-Set web app port (Current: " + str(webPort) + ")"
120120
print "3-Set App Path (Current: " + str(uri) + ")"
121-
print "4-Set HTTP Request Method (GET/POST)"
121+
print "4-Set HTTP Request Method (GET/POST) (Current: " + httpMethod + ")"
122122
print "5-Set my local Mongo/Shell IP (Current: " + str(myIP) + ")"
123123
print "6-Set shell listener port (Current: " + str(myPort) + ")"
124124
print "7-Load options file"
@@ -168,7 +168,7 @@ def options():
168168
paramNames = pdArray[0::2]
169169
paramValues = pdArray[1::2]
170170
postData = dict(zip(paramNames,paramValues))
171-
raw_input("Debug: " + str(postData))
171+
#raw_input("Debug: " + str(postData))
172172
options()
173173
else:
174174
print "Invalid selection"
@@ -226,15 +226,27 @@ def options():
226226
httpMethod = "GET"
227227

228228
elif methodPath[0] == "POST":
229+
paramNames = []
230+
paramValues = []
229231
httpMethod = "POST"
230232
postData = reqData[len(reqData)-1]
233+
#split the POST parameters up into individual items
234+
paramsNvalues = postData.split("&")
235+
236+
for item in paramsNvalues:
237+
tempList = item.split("=")
238+
paramNames.append(tempList[0])
239+
paramValues.append(tempList[1])
240+
241+
postData = dict(zip(paramNames,paramValues))
242+
231243
else:
232244
print "unsupported method in request header."
233245

234246
victim = reqData[1].split( " ")[1].replace("\r\n","")
235247
optionSet[0] = True
236248
uri = methodPath[1].replace("\r\n","")
237-
optList[2] = True
249+
optionSet[2] = True
238250

239251
elif select == "9":
240252
savePath = raw_input("Enter file name to save: ")

0 commit comments

Comments
 (0)