Fix related to the #6171 (WebSocket Host port)

This commit is contained in:
Miroslav Štampar 2026-11-03 22:04:01 +01:00
parent 3130623afc
commit 8476cf4d09
4 changed files with 32 additions and 3 deletions

View file

@ -5140,7 +5140,7 @@ def getHostHeader(url):
if url:
parsed = _urllib.parse.urlparse(url)
retVal = parsed.netloc
defaultPort = {"http": 80, "https": 443}.get(parsed.scheme.lower())
defaultPort = {"http": 80, "https": 443, "ws": 80, "wss": 443}.get(parsed.scheme.lower())
# Keep non-default ports, including 80 on HTTPS and 443 on HTTP.
if defaultPort is not None and retVal.endswith(':%d' % defaultPort):

View file

@ -19,7 +19,7 @@ from lib.core.enums import OS
from thirdparty import six
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
VERSION = "1.10.11.2"
VERSION = "1.10.11.3"
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)

View file

@ -73,7 +73,7 @@ class WebSocket(object):
self.sock.settimeout(self._timeout)
hostport = "[%s]" % host if ":" in host else host # bracket IPv6 literals
if port not in (80, 443):
if port != (443 if secure else 80): # Note: only the scheme's own default port gets omitted
hostport = "%s:%d" % (hostport, port)
key = getText(base64.b64encode(os.urandom(16)))