Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f67148a

Browse files
committed
Update for an Issue #431
1 parent 661b441 commit f67148a

3 files changed

Lines changed: 18 additions & 15 deletions

File tree

lib/core/enums.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,12 @@ class HTTPMETHOD:
7676
GET = "GET"
7777
POST = "POST"
7878
HEAD = "HEAD"
79+
PUT = "PUT"
80+
DELETE = "DETELE"
81+
TRACE = "TRACE"
82+
OPTIONS = "OPTIONS"
83+
CONNECT = "CONNECT"
84+
PATCH = "PATCH"
7985

8086
class NULLCONNECTION:
8187
HEAD = "HEAD"

lib/core/option.py

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -241,10 +241,10 @@ def _parseBurpLog(content):
241241
else:
242242
scheme, port = None, None
243243

244-
if not re.search(r"^[\n]*(GET|POST).*?\sHTTP\/", request, re.I | re.M):
244+
if not re.search(r"^[\n]*(%s).*?\sHTTP\/" % "|".join(getPublicTypeMembers(HTTPMETHOD, True)), request, re.I | re.M):
245245
continue
246246

247-
if re.search(r"^[\n]*(GET|POST).*?\.(%s)\sHTTP\/" % "|".join(CRAWL_EXCLUDE_EXTENSIONS), request, re.I | re.M):
247+
if re.search(r"^[\n]*(%s|%s).*?\.(%s)\sHTTP\/" % (HTTPMETHOD.GET, HTTPMETHOD.POST, "|".join(CRAWL_EXCLUDE_EXTENSIONS)), request, re.I | re.M):
248248
continue
249249

250250
getPostReq = False
@@ -260,19 +260,16 @@ def _parseBurpLog(content):
260260
for line in lines:
261261
newline = "\r\n" if line.endswith('\r') else '\n'
262262
line = line.strip('\r')
263+
match = re.search(r"\A(%s) (.+) HTTP/[\d.]+\Z" % "|".join(getPublicTypeMembers(HTTPMETHOD, True)), line) if not method else None
264+
263265
if len(line) == 0:
264-
if method == HTTPMETHOD.POST and data is None:
266+
if method in (HTTPMETHOD.POST, HTTPMETHOD.PUT) and data is None:
265267
data = ""
266268
params = True
267269

268-
elif (line.startswith("GET ") or line.startswith("POST ")) and " HTTP/" in line:
269-
if line.startswith("GET "):
270-
index = 4
271-
else:
272-
index = 5
273-
274-
url = line[index:line.index(" HTTP/")]
275-
method = line[:index - 1]
270+
elif match:
271+
method = match.group(1)
272+
url = match.group(2)
276273

277274
if "?" in line and "=" in line:
278275
params = True

lib/core/target.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ def _setRequestParams():
8686
raise SqlmapSyntaxException(errMsg)
8787

8888
if conf.data is not None:
89-
conf.method = HTTPMETHOD.POST
89+
conf.method = HTTPMETHOD.POST if not conf.method or conf.method == HTTPMETHOD.GET else conf.method
9090

9191
def process(match, repl):
9292
retVal = match.group(0)
@@ -103,7 +103,7 @@ def process(match, repl):
103103
return retVal
104104

105105
if re.search(JSON_RECOGNITION_REGEX, conf.data):
106-
message = "JSON like data found in POST data. "
106+
message = "JSON like data found in %s data. " % conf.method
107107
message += "Do you want to process it? [Y/n/q] "
108108
test = readInput(message, default="Y")
109109
if test and test[0] in ("q", "Q"):
@@ -115,7 +115,7 @@ def process(match, repl):
115115
kb.postHint = POST_HINT.JSON
116116

117117
elif re.search(SOAP_RECOGNITION_REGEX, conf.data):
118-
message = "SOAP/XML like data found in POST data. "
118+
message = "SOAP/XML like data found in %s data. " % conf.method
119119
message += "Do you want to process it? [Y/n/q] "
120120
test = readInput(message, default="Y")
121121
if test and test[0] in ("q", "Q"):
@@ -126,7 +126,7 @@ def process(match, repl):
126126
kb.postHint = POST_HINT.SOAP if "soap" in conf.data.lower() else POST_HINT.XML
127127

128128
elif re.search(MULTIPART_RECOGNITION_REGEX, conf.data):
129-
message = "Multipart like data found in POST data. "
129+
message = "Multipart like data found in %s data. " % conf.method
130130
message += "Do you want to process it? [Y/n/q] "
131131
test = readInput(message, default="Y")
132132
if test and test[0] in ("q", "Q"):

0 commit comments

Comments
 (0)