diff --git a/lib/core/common.py b/lib/core/common.py index d057754aa..b4fc24dab 100644 --- a/lib/core/common.py +++ b/lib/core/common.py @@ -1541,7 +1541,7 @@ def parseTargetUrl(): errMsg += "on this platform" raise SqlmapGenericException(errMsg) - if not re.search(r"^https?://", conf.url, re.I) and not re.search(r"^wss?://", conf.url, re.I): + if not re.search(r"^(http|ws)s?://", conf.url, re.I): if re.search(r":443\b", conf.url): conf.url = "https://%s" % conf.url else: @@ -1560,10 +1560,13 @@ def parseTargetUrl(): hostnamePort = urlSplit.netloc.split(":") if not re.search(r"\[.+\]", urlSplit.netloc) else filterNone((re.search(r"\[.+\]", urlSplit.netloc).group(0), re.search(r"\](:(?P\d+))?", urlSplit.netloc).group("port"))) - conf.scheme = (urlSplit.scheme.strip().lower() or "http") if not conf.forceSSL else "https" + conf.scheme = (urlSplit.scheme.strip().lower() or "http") conf.path = urlSplit.path.strip() conf.hostname = hostnamePort[0].strip() + if conf.forceSSL: + conf.scheme = re.sub(r"(?i)\A(http|ws)\Z", r"\g<1>s", conf.scheme) + conf.ipv6 = conf.hostname != conf.hostname.strip("[]") conf.hostname = conf.hostname.strip("[]").replace(kb.customInjectionMark, "") @@ -1585,7 +1588,7 @@ def parseTargetUrl(): except: errMsg = "invalid target URL" raise SqlmapSyntaxException(errMsg) - elif conf.scheme == "https": + elif conf.scheme in ("https", "wss"): conf.port = 443 else: conf.port = 80 diff --git a/lib/core/settings.py b/lib/core/settings.py index 2a8ad6a4a..7993c34a3 100644 --- a/lib/core/settings.py +++ b/lib/core/settings.py @@ -18,7 +18,7 @@ from lib.core.enums import OS from thirdparty.six import unichr as _unichr # sqlmap version (...) -VERSION = "1.3.6.28" +VERSION = "1.3.6.29" TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable" 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) diff --git a/lib/request/connect.py b/lib/request/connect.py index bad21acc8..481599c34 100644 --- a/lib/request/connect.py +++ b/lib/request/connect.py @@ -346,8 +346,8 @@ class Connect(object): pass elif target: - if conf.forceSSL and _urllib.parse.urlparse(url).scheme != "https": - url = re.sub(r"(?i)\Ahttp:", "https:", url) + if conf.forceSSL: + url = re.sub(r"(?i)\A(http|ws):", r"\g<1>s:", url) url = re.sub(r"(?i):80/", ":443/", url) if PLACE.GET in conf.parameters and not get: