Skip to content

Commit 101d1f0

Browse files
committed
Fixes #3395
1 parent 8431267 commit 101d1f0

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

lib/controller/checks.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@
7070
from lib.core.enums import PLACE
7171
from lib.core.enums import REDIRECTION
7272
from lib.core.exception import SqlmapConnectionException
73+
from lib.core.exception import SqlmapDataException
7374
from lib.core.exception import SqlmapNoneDataException
7475
from lib.core.exception import SqlmapSilentQuitException
7576
from lib.core.exception import SqlmapSkipTargetException
@@ -1530,10 +1531,14 @@ def checkConnection(suppressOutput=False):
15301531
except socket.gaierror:
15311532
errMsg = "host '%s' does not exist" % conf.hostname
15321533
raise SqlmapConnectionException(errMsg)
1533-
except (socket.error, UnicodeError), ex:
1534+
except socket.error, ex:
15341535
errMsg = "problem occurred while "
15351536
errMsg += "resolving a host name '%s' ('%s')" % (conf.hostname, getSafeExString(ex))
15361537
raise SqlmapConnectionException(errMsg)
1538+
except UnicodeError, ex:
1539+
errMsg = "problem occurred while "
1540+
errMsg += "handling a host name '%s' ('%s')" % (conf.hostname, getSafeExString(ex))
1541+
raise SqlmapDataException(errMsg)
15371542

15381543
if not suppressOutput and not conf.dummy and not conf.offline:
15391544
infoMsg = "testing connection to the target URL"

lib/core/option.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@
8282
from lib.core.enums import REFLECTIVE_COUNTER
8383
from lib.core.enums import WIZARD
8484
from lib.core.exception import SqlmapConnectionException
85+
from lib.core.exception import SqlmapDataException
8586
from lib.core.exception import SqlmapFilePathException
8687
from lib.core.exception import SqlmapGenericException
8788
from lib.core.exception import SqlmapInstallationException
@@ -1364,7 +1365,12 @@ def _setHostname():
13641365
"""
13651366

13661367
if conf.url:
1367-
conf.hostname = urlparse.urlsplit(conf.url).netloc.split(':')[0]
1368+
try:
1369+
conf.hostname = urlparse.urlsplit(conf.url).netloc.split(':')[0]
1370+
except ValueError, ex:
1371+
errMsg = "problem occurred while "
1372+
errMsg += "parsing an URL '%s' ('%s')" % (conf.url, getSafeExString(ex))
1373+
raise SqlmapDataException(errMsg)
13681374

13691375
def _setHTTPTimeout():
13701376
"""

0 commit comments

Comments
 (0)