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

Skip to content

Commit 671facc

Browse files
committed
Patch for an Issue #930
1 parent d0afa7f commit 671facc

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

lib/core/common.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1225,7 +1225,14 @@ def parseTargetUrl():
12251225
if CUSTOM_INJECTION_MARK_CHAR in conf.url:
12261226
conf.url = conf.url.replace('?', URI_QUESTION_MARKER)
12271227

1228-
urlSplit = urlparse.urlsplit(conf.url)
1228+
try:
1229+
urlSplit = urlparse.urlsplit(conf.url)
1230+
except ValueError, ex:
1231+
errMsg = "invalid URL '%s' has been given ('%s'). " % (conf.url, ex)
1232+
errMsg += "Please be sure that you don't have any leftover characters (e.g. '[' or ']') "
1233+
errMsg += "in the hostname part"
1234+
raise SqlmapGenericException(errMsg)
1235+
12291236
hostnamePort = urlSplit.netloc.split(":") if not re.search("\[.+\]", urlSplit.netloc) else filter(None, (re.search("\[.+\]", urlSplit.netloc).group(0), re.search("\](:(?P<port>\d+))?", urlSplit.netloc).group("port")))
12301237

12311238
conf.scheme = urlSplit.scheme.strip().lower() if not conf.forceSSL else "https"

0 commit comments

Comments
 (0)