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

Skip to content

Commit 02c8f47

Browse files
committed
Adding support for WebSocket over SSL (wss://)
1 parent 8a97e7e commit 02c8f47

3 files changed

Lines changed: 9 additions & 6 deletions

File tree

lib/core/common.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1541,7 +1541,7 @@ def parseTargetUrl():
15411541
errMsg += "on this platform"
15421542
raise SqlmapGenericException(errMsg)
15431543

1544-
if not re.search(r"^https?://", conf.url, re.I) and not re.search(r"^wss?://", conf.url, re.I):
1544+
if not re.search(r"^(http|ws)s?://", conf.url, re.I):
15451545
if re.search(r":443\b", conf.url):
15461546
conf.url = "https://%s" % conf.url
15471547
else:
@@ -1560,10 +1560,13 @@ def parseTargetUrl():
15601560

15611561
hostnamePort = urlSplit.netloc.split(":") if not re.search(r"\[.+\]", urlSplit.netloc) else filterNone((re.search(r"\[.+\]", urlSplit.netloc).group(0), re.search(r"\](:(?P<port>\d+))?", urlSplit.netloc).group("port")))
15621562

1563-
conf.scheme = (urlSplit.scheme.strip().lower() or "http") if not conf.forceSSL else "https"
1563+
conf.scheme = (urlSplit.scheme.strip().lower() or "http")
15641564
conf.path = urlSplit.path.strip()
15651565
conf.hostname = hostnamePort[0].strip()
15661566

1567+
if conf.forceSSL:
1568+
conf.scheme = re.sub(r"(?i)\A(http|ws)\Z", r"\g<1>s", conf.scheme)
1569+
15671570
conf.ipv6 = conf.hostname != conf.hostname.strip("[]")
15681571
conf.hostname = conf.hostname.strip("[]").replace(kb.customInjectionMark, "")
15691572

@@ -1585,7 +1588,7 @@ def parseTargetUrl():
15851588
except:
15861589
errMsg = "invalid target URL"
15871590
raise SqlmapSyntaxException(errMsg)
1588-
elif conf.scheme == "https":
1591+
elif conf.scheme in ("https", "wss"):
15891592
conf.port = 443
15901593
else:
15911594
conf.port = 80

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.3.6.28"
21+
VERSION = "1.3.6.29"
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
@@ -346,8 +346,8 @@ def getPage(**kwargs):
346346
pass
347347

348348
elif target:
349-
if conf.forceSSL and _urllib.parse.urlparse(url).scheme != "https":
350-
url = re.sub(r"(?i)\Ahttp:", "https:", url)
349+
if conf.forceSSL:
350+
url = re.sub(r"(?i)\A(http|ws):", r"\g<1>s:", url)
351351
url = re.sub(r"(?i):80/", ":443/", url)
352352

353353
if PLACE.GET in conf.parameters and not get:

0 commit comments

Comments
 (0)