added switch --check-tor

This commit is contained in:
Miroslav Stampar
2011-10-25 17:37:43 +00:00
parent 24d495368e
commit 86b4a3562f
5 changed files with 29 additions and 2 deletions

View File

@@ -1732,6 +1732,19 @@ def __setTorProxySettings():
raise sqlmapConnectionException, errMsg
def __checkTor():
infoMsg = "checking Tor connection"
logger.info(infoMsg)
if conf.checkTor:
page, _, _ = Request.getPage(url="https://check.torproject.org/", raise404=False)
if not page or 'Congratulations' not in page:
errMsg = "it seems that your Tor connection is not properly set"
raise sqlmapConnectionException, errMsg
else:
infoMsg = "Tor connection is properly set"
logger.info(infoMsg)
def __basicOptionValidation():
if conf.limitStart is not None and not (isinstance(conf.limitStart, int) and conf.limitStart > 0):
errMsg = "value for --start (limitStart) option must be an integer value greater than zero (>0)"
@@ -1795,6 +1808,10 @@ def __basicOptionValidation():
errMsg = "switch --tor is incompatible with switch --proxy"
raise sqlmapSyntaxException, errMsg
if conf.checkTor and not conf.tor:
errMsg = "switch --check-tor requires usage of switch --tor"
raise sqlmapSyntaxException, errMsg
if conf.skip and conf.testParameter:
errMsg = "switch --skip is incompatible with switch -p"
raise sqlmapSyntaxException, errMsg
@@ -1881,6 +1898,7 @@ def init(inputOptions=AttribDict(), overrideOptions=False):
__setGoogleDorking()
__setBulkMultipleTargets()
__urllib2Opener()
__checkTor()
__setCrawler()
__findPageForms()
__setDBMS()