added test for site existance

This commit is contained in:
Miroslav Stampar 2010-05-21 13:36:49 +00:00
parent 7ee20480a4
commit 3110bb10fc

View File

@ -23,6 +23,7 @@ Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
""" """
import re import re
import socket
import time import time
from lib.core.agent import agent from lib.core.agent import agent
@ -380,6 +381,14 @@ def checkRegexp():
return False return False
def checkConnection(): def checkConnection():
infoMsg = "testing if site exists"
logger.info(infoMsg)
try:
socket.gethostbyname(conf.hostname)
except socket.gaierror:
errMsg = "site '%s' does not exist" % conf.hostname
raise sqlmapConnectionException, errMsg
infoMsg = "testing connection to the target url" infoMsg = "testing connection to the target url"
logger.info(infoMsg) logger.info(infoMsg)