From a675c888946b9c27fbfcf3eb0438503184c54737 Mon Sep 17 00:00:00 2001 From: Miroslav Stampar Date: Sat, 7 Jan 2012 16:06:18 +0000 Subject: [PATCH] minor check added for invalid urls (e.g. deliberately too long) --- lib/core/common.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/core/common.py b/lib/core/common.py index 9fd4b99f6..548244afd 100644 --- a/lib/core/common.py +++ b/lib/core/common.py @@ -1248,7 +1248,12 @@ def parseTargetUrl(): conf.path = __urlSplit[2].strip() conf.hostname = __hostnamePort[0].strip() - if any((re.search(r'\s', conf.hostname), '..' in conf.hostname, conf.hostname.startswith('.'))): + try: + _ = conf.hostname.encode("idna") + except UnicodeError: + _ = None + + if any((_ is None, re.search(r'\s', conf.hostname), '..' in conf.hostname, conf.hostname.startswith('.'))): errMsg = "invalid target url" raise sqlmapSyntaxException, errMsg