Skip to content

Commit 01e83cb

Browse files
committed
Minor patch for ws
1 parent cd77cdd commit 01e83cb

File tree

3 files changed

+19
-21
lines changed

3 files changed

+19
-21
lines changed

lib/core/common.py

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2882,33 +2882,31 @@ def urldecode(value, encoding=None, unsafe="%%?&=;+%s" % CUSTOM_INJECTION_MARK_C
28822882
True
28832883
>>> urldecode('AND%201%3E%282%2B3%29%23', convall=False) == 'AND 1>(2%2B3)#'
28842884
True
2885+
>>> urldecode(b'AND%201%3E%282%2B3%29%23', convall=False) == 'AND 1>(2%2B3)#'
2886+
True
28852887
"""
28862888

28872889
result = value
28882890

28892891
if value:
2890-
try:
2891-
# for cases like T%C3%BCrk%C3%A7e
2892-
value = str(value)
2893-
except ValueError:
2894-
pass
2895-
finally:
2896-
if convall:
2897-
result = _urllib.parse.unquote_plus(value) if spaceplus else _urllib.parse.unquote(value)
2898-
else:
2899-
result = value
2900-
charset = set(string.printable) - set(unsafe)
2892+
value = getUnicode(value)
2893+
2894+
if convall:
2895+
result = _urllib.parse.unquote_plus(value) if spaceplus else _urllib.parse.unquote(value)
2896+
else:
2897+
result = value
2898+
charset = set(string.printable) - set(unsafe)
29012899

2902-
def _(match):
2903-
char = decodeHex(match.group(1), binary=False)
2904-
return char if char in charset else match.group(0)
2900+
def _(match):
2901+
char = decodeHex(match.group(1), binary=False)
2902+
return char if char in charset else match.group(0)
29052903

2906-
if spaceplus:
2907-
result = result.replace('+', ' ') # plus sign has a special meaning in URL encoded data (hence the usage of _urllib.parse.unquote_plus in convall case)
2904+
if spaceplus:
2905+
result = result.replace('+', ' ') # plus sign has a special meaning in URL encoded data (hence the usage of _urllib.parse.unquote_plus in convall case)
29082906

2909-
result = re.sub(r"%([0-9a-fA-F]{2})", _, result)
2907+
result = re.sub(r"%([0-9a-fA-F]{2})", _, result)
29102908

2911-
result = getUnicode(result, encoding or UNICODE_ENCODING)
2909+
result = getUnicode(result, encoding or UNICODE_ENCODING)
29122910

29132911
return result
29142912

lib/core/settings.py

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

2020
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
21-
VERSION = "1.5.2.6"
21+
VERSION = "1.5.2.7"
2222
TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable"
2323
TYPE_COLORS = {"dev": 33, "stable": 90, "pip": 34}
2424
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: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -498,8 +498,6 @@ def getPage(**kwargs):
498498
if six.PY2:
499499
url = getBytes(url) # Note: Python3 requires text while Python2 has problems when mixing text with binary POST
500500

501-
post = getBytes(post)
502-
503501
if webSocket:
504502
ws = websocket.WebSocket()
505503
ws.settimeout(WEBSOCKET_INITIAL_TIMEOUT if kb.webSocketRecvCount is None else timeout)
@@ -543,6 +541,8 @@ class _(dict):
543541

544542
logger.log(CUSTOM_LOGGING.TRAFFIC_OUT, requestMsg)
545543
else:
544+
post = getBytes(post)
545+
546546
if target and cmdLineOptions.method or method and method not in (HTTPMETHOD.GET, HTTPMETHOD.POST):
547547
req = MethodRequest(url, post, headers)
548548
req.set_method(cmdLineOptions.method or method)

0 commit comments

Comments
 (0)