@@ -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
0 commit comments