Skip to content

Commit 445d69f

Browse files
committed
Implementation for multipart/eval (#5021)
1 parent 02ff0ee commit 445d69f

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

lib/core/settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
from thirdparty.six import unichr as _unichr
2121

2222
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
23-
VERSION = "1.6.3.8"
23+
VERSION = "1.6.3.9"
2424
TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable"
2525
TYPE_COLORS = {"dev": 33, "stable": 90, "pip": 34}
2626
VERSION_STRING = "sqlmap/%s#%s" % ('.'.join(VERSION.split('.')[:-1]) if VERSION.count('.') > 2 and VERSION.split('.')[-1] == '0' else VERSION, TYPE)

lib/request/connect.py

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1356,7 +1356,27 @@ def _randomizeParameter(paramString, randomParameter):
13561356
found = False
13571357
value = getUnicode(value, UNICODE_ENCODING)
13581358

1359-
if kb.postHint and re.search(r"\b%s\b" % re.escape(name), post or ""):
1359+
if kb.postHint == POST_HINT.MULTIPART:
1360+
boundary = "--%s" % re.search(r"boundary=([^\s]+)", contentType).group(1)
1361+
if boundary:
1362+
parts = post.split(boundary)
1363+
match = re.search(r'\bname="%s"' % re.escape(name), post)
1364+
if not match and parts:
1365+
parts.insert(2, parts[1])
1366+
parts[2] = re.sub(r'\bname="[^"]+".*', 'name="%s"' % re.escape(name), parts[2])
1367+
for i in xrange(len(parts)):
1368+
part = parts[i]
1369+
if re.search(r'\bname="%s"' % re.escape(name), part):
1370+
match = re.search(r"(?s)\A.+?\r?\n\r?\n", part)
1371+
if match:
1372+
found = True
1373+
first = match.group(0)
1374+
second = part[len(first):]
1375+
second = re.sub(r"(?s).+?(\r?\n?\-*\Z)", r"%s\g<1>" % re.escape(value), second)
1376+
parts[i] = "%s%s" % (first, second)
1377+
post = boundary.join(parts)
1378+
1379+
elif kb.postHint and re.search(r"\b%s\b" % re.escape(name), post or ""):
13601380
if kb.postHint in (POST_HINT.XML, POST_HINT.SOAP):
13611381
if re.search(r"<%s\b" % re.escape(name), post):
13621382
found = True

0 commit comments

Comments
 (0)