mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2025-02-26 00:30:38 +03:00
Minor patch for ws
This commit is contained in:
parent
cd77cdd1e8
commit
01e83cb4a0
|
@ -2882,33 +2882,31 @@ def urldecode(value, encoding=None, unsafe="%%?&=;+%s" % CUSTOM_INJECTION_MARK_C
|
||||||
True
|
True
|
||||||
>>> urldecode('AND%201%3E%282%2B3%29%23', convall=False) == 'AND 1>(2%2B3)#'
|
>>> urldecode('AND%201%3E%282%2B3%29%23', convall=False) == 'AND 1>(2%2B3)#'
|
||||||
True
|
True
|
||||||
|
>>> urldecode(b'AND%201%3E%282%2B3%29%23', convall=False) == 'AND 1>(2%2B3)#'
|
||||||
|
True
|
||||||
"""
|
"""
|
||||||
|
|
||||||
result = value
|
result = value
|
||||||
|
|
||||||
if value:
|
if value:
|
||||||
try:
|
value = getUnicode(value)
|
||||||
# for cases like T%C3%BCrk%C3%A7e
|
|
||||||
value = str(value)
|
|
||||||
except ValueError:
|
|
||||||
pass
|
|
||||||
finally:
|
|
||||||
if convall:
|
|
||||||
result = _urllib.parse.unquote_plus(value) if spaceplus else _urllib.parse.unquote(value)
|
|
||||||
else:
|
|
||||||
result = value
|
|
||||||
charset = set(string.printable) - set(unsafe)
|
|
||||||
|
|
||||||
def _(match):
|
if convall:
|
||||||
char = decodeHex(match.group(1), binary=False)
|
result = _urllib.parse.unquote_plus(value) if spaceplus else _urllib.parse.unquote(value)
|
||||||
return char if char in charset else match.group(0)
|
else:
|
||||||
|
result = value
|
||||||
|
charset = set(string.printable) - set(unsafe)
|
||||||
|
|
||||||
if spaceplus:
|
def _(match):
|
||||||
result = result.replace('+', ' ') # plus sign has a special meaning in URL encoded data (hence the usage of _urllib.parse.unquote_plus in convall case)
|
char = decodeHex(match.group(1), binary=False)
|
||||||
|
return char if char in charset else match.group(0)
|
||||||
|
|
||||||
result = re.sub(r"%([0-9a-fA-F]{2})", _, result)
|
if spaceplus:
|
||||||
|
result = result.replace('+', ' ') # plus sign has a special meaning in URL encoded data (hence the usage of _urllib.parse.unquote_plus in convall case)
|
||||||
|
|
||||||
result = getUnicode(result, encoding or UNICODE_ENCODING)
|
result = re.sub(r"%([0-9a-fA-F]{2})", _, result)
|
||||||
|
|
||||||
|
result = getUnicode(result, encoding or UNICODE_ENCODING)
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ from lib.core.enums import OS
|
||||||
from thirdparty.six import unichr as _unichr
|
from thirdparty.six import unichr as _unichr
|
||||||
|
|
||||||
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
|
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
|
||||||
VERSION = "1.5.2.6"
|
VERSION = "1.5.2.7"
|
||||||
TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable"
|
TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable"
|
||||||
TYPE_COLORS = {"dev": 33, "stable": 90, "pip": 34}
|
TYPE_COLORS = {"dev": 33, "stable": 90, "pip": 34}
|
||||||
VERSION_STRING = "sqlmap/%s#%s" % ('.'.join(VERSION.split('.')[:-1]) if VERSION.count('.') > 2 and VERSION.split('.')[-1] == '0' else VERSION, TYPE)
|
VERSION_STRING = "sqlmap/%s#%s" % ('.'.join(VERSION.split('.')[:-1]) if VERSION.count('.') > 2 and VERSION.split('.')[-1] == '0' else VERSION, TYPE)
|
||||||
|
|
|
@ -498,8 +498,6 @@ class Connect(object):
|
||||||
if six.PY2:
|
if six.PY2:
|
||||||
url = getBytes(url) # Note: Python3 requires text while Python2 has problems when mixing text with binary POST
|
url = getBytes(url) # Note: Python3 requires text while Python2 has problems when mixing text with binary POST
|
||||||
|
|
||||||
post = getBytes(post)
|
|
||||||
|
|
||||||
if webSocket:
|
if webSocket:
|
||||||
ws = websocket.WebSocket()
|
ws = websocket.WebSocket()
|
||||||
ws.settimeout(WEBSOCKET_INITIAL_TIMEOUT if kb.webSocketRecvCount is None else timeout)
|
ws.settimeout(WEBSOCKET_INITIAL_TIMEOUT if kb.webSocketRecvCount is None else timeout)
|
||||||
|
@ -543,6 +541,8 @@ class Connect(object):
|
||||||
|
|
||||||
logger.log(CUSTOM_LOGGING.TRAFFIC_OUT, requestMsg)
|
logger.log(CUSTOM_LOGGING.TRAFFIC_OUT, requestMsg)
|
||||||
else:
|
else:
|
||||||
|
post = getBytes(post)
|
||||||
|
|
||||||
if target and cmdLineOptions.method or method and method not in (HTTPMETHOD.GET, HTTPMETHOD.POST):
|
if target and cmdLineOptions.method or method and method not in (HTTPMETHOD.GET, HTTPMETHOD.POST):
|
||||||
req = MethodRequest(url, post, headers)
|
req = MethodRequest(url, post, headers)
|
||||||
req.set_method(cmdLineOptions.method or method)
|
req.set_method(cmdLineOptions.method or method)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user