Skip to content

Commit cf2d5fd

Browse files
committed
Update for an Issue sqlmapproject#431
1 parent 34ce774 commit cf2d5fd

5 files changed

Lines changed: 16 additions & 8 deletions

File tree

lib/controller/controller.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ def start():
269269
for targetUrl, targetMethod, targetData, targetCookie, targetHeaders in kb.targets:
270270
try:
271271
conf.url = targetUrl
272-
conf.method = targetMethod
272+
conf.method = targetMethod.upper() if targetMethod else targetMethod
273273
conf.data = targetData
274274
conf.cookie = targetCookie
275275
conf.httpHeaders = list(initialHeaders)

lib/core/optiondict.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
},
2424

2525
"Request": {
26+
"method": "string",
2627
"data": "string",
2728
"paramDel": "string",
2829
"cookie": "string",

lib/parse/cmdline.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,9 @@ def cmdLineParser():
9090
request = OptionGroup(parser, "Request", "These options can be used "
9191
"to specify how to connect to the target URL")
9292

93+
request.add_option("--method", dest="method",
94+
help="Force usage of given HTTP method (e.g. PUT)")
95+
9396
request.add_option("--data", dest="data",
9497
help="Data string to be sent through POST")
9598

lib/request/connect.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ def getPage(**kwargs):
307307
url = "%s?%s" % (url, get)
308308
requestMsg += "?%s" % get
309309

310-
if PLACE.POST in conf.parameters and not post and method in (None, HTTPMETHOD.POST):
310+
if PLACE.POST in conf.parameters and not post and method != HTTPMETHOD.GET:
311311
post = conf.parameters[PLACE.POST]
312312

313313
elif get:
@@ -634,6 +634,7 @@ def queryPage(value=None, place=None, content=False, getRatioValue=False, silent
634634
auxHeaders = {}
635635

636636
raise404 = place != PLACE.URI if raise404 is None else raise404
637+
method = method or conf.method
637638

638639
value = agent.adjustLateValues(value)
639640
payload = agent.extractPayload(value)

sqlmap.conf

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,31 +40,34 @@ sitemapUrl =
4040
# These options can be used to specify how to connect to the target URL.
4141
[Request]
4242

43+
# Force usage of given HTTP method (e.g. PUT).
44+
method =
45+
4346
# Data string to be sent through POST.
4447
data =
4548

46-
# Character used for splitting parameter values
49+
# Character used for splitting parameter values.
4750
paramDel =
4851

4952
# HTTP Cookie header value.
5053
cookie =
5154

52-
# Character used for splitting cookie values
55+
# Character used for splitting cookie values.
5356
cookieDel =
5457

55-
# File containing cookies in Netscape/wget format
58+
# File containing cookies in Netscape/wget format.
5659
loadCookies =
5760

58-
# Ignore Set-Cookie header from response
61+
# Ignore Set-Cookie header from response.
5962
# Valid: True or False
6063
dropSetCookie = False
6164

6265
# HTTP User-Agent header value. Useful to fake the HTTP User-Agent header value
63-
# at each HTTP request
66+
# at each HTTP request.
6467
# sqlmap will also test for SQL injection on the HTTP User-Agent value.
6568
agent =
6669

67-
# Use randomly selected HTTP User-Agent header value
70+
# Use randomly selected HTTP User-Agent header value.
6871
# Valid: True or False
6972
randomAgent = False
7073

0 commit comments

Comments
 (0)