mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2025-07-25 23:49:49 +03:00
support for URLs containing credentials
This commit is contained in:
parent
dcf304c65e
commit
29e08d80cc
|
@ -1721,13 +1721,13 @@ def parseTargetUrl():
|
||||||
|
|
||||||
try:
|
try:
|
||||||
urlSplit = _urllib.parse.urlsplit(conf.url)
|
urlSplit = _urllib.parse.urlsplit(conf.url)
|
||||||
|
hostnamePort = [urlSplit.hostname, urlSplit.port]
|
||||||
except ValueError as ex:
|
except ValueError as ex:
|
||||||
errMsg = "invalid URL '%s' has been given ('%s'). " % (conf.url, getSafeExString(ex))
|
errMsg = "invalid URL '%s' has been given ('%s'). " % (conf.url, getSafeExString(ex))
|
||||||
errMsg += "Please be sure that you don't have any leftover characters (e.g. '[' or ']') "
|
errMsg += "Please be sure that you don't have any leftover characters (e.g. '[' or ']') "
|
||||||
errMsg += "in the hostname part"
|
errMsg += "in the hostname part"
|
||||||
raise SqlmapGenericException(errMsg)
|
raise SqlmapGenericException(errMsg)
|
||||||
|
|
||||||
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")))
|
|
||||||
|
|
||||||
conf.scheme = (urlSplit.scheme.strip().lower() or "http")
|
conf.scheme = (urlSplit.scheme.strip().lower() or "http")
|
||||||
conf.path = urlSplit.path.strip()
|
conf.path = urlSplit.path.strip()
|
||||||
|
@ -1736,8 +1736,8 @@ def parseTargetUrl():
|
||||||
if conf.forceSSL:
|
if conf.forceSSL:
|
||||||
conf.scheme = re.sub(r"(?i)\A(http|ws)\Z", r"\g<1>s", conf.scheme)
|
conf.scheme = re.sub(r"(?i)\A(http|ws)\Z", r"\g<1>s", conf.scheme)
|
||||||
|
|
||||||
conf.ipv6 = conf.hostname != conf.hostname.strip("[]")
|
conf.ipv6 = ":" in conf.hostname
|
||||||
conf.hostname = conf.hostname.strip("[]").replace(kb.customInjectionMark, "")
|
conf.hostname = conf.hostname.replace(kb.customInjectionMark, "")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
conf.hostname.encode("idna")
|
conf.hostname.encode("idna")
|
||||||
|
|
|
@ -1527,7 +1527,7 @@ def _setHostname():
|
||||||
|
|
||||||
if conf.url:
|
if conf.url:
|
||||||
try:
|
try:
|
||||||
conf.hostname = _urllib.parse.urlsplit(conf.url).netloc.split(':')[0]
|
conf.hostname = _urllib.parse.urlsplit(conf.url).hostname
|
||||||
except ValueError as ex:
|
except ValueError as ex:
|
||||||
errMsg = "problem occurred while "
|
errMsg = "problem occurred while "
|
||||||
errMsg += "parsing an URL '%s' ('%s')" % (conf.url, getSafeExString(ex))
|
errMsg += "parsing an URL '%s' ('%s')" % (conf.url, getSafeExString(ex))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user