minor update

This commit is contained in:
Miroslav Stampar 2011-11-23 21:39:53 +00:00
parent ba4234dc42
commit 885b432808
2 changed files with 4 additions and 39 deletions

View File

@ -81,7 +81,7 @@ from lib.core.optiondict import optDict
from lib.core.settings import CODECS_LIST_PAGE from lib.core.settings import CODECS_LIST_PAGE
from lib.core.settings import DEFAULT_GET_POST_DELIMITER from lib.core.settings import DEFAULT_GET_POST_DELIMITER
from lib.core.settings import DEFAULT_PAGE_ENCODING from lib.core.settings import DEFAULT_PAGE_ENCODING
from lib.core.settings import DEFAULT_TOR_PORTS from lib.core.settings import DEFAULT_TOR_SOCKS_PORT
from lib.core.settings import GENERAL_IP_ADDRESS_REGEX from lib.core.settings import GENERAL_IP_ADDRESS_REGEX
from lib.core.settings import IS_WIN from lib.core.settings import IS_WIN
from lib.core.settings import PLATFORM from lib.core.settings import PLATFORM
@ -1682,44 +1682,9 @@ def __setTorSocksProxySettings():
infoMsg = "setting Tor SOCKS proxy settings" infoMsg = "setting Tor SOCKS proxy settings"
logger.info(infoMsg) logger.info(infoMsg)
socks.setdefaultproxy(socks.PROXY_TYPE_SOCKS5, 'localhost', 9050) socks.setdefaultproxy(socks.PROXY_TYPE_SOCKS5, LOCALHOST, DEFAULT_TOR_SOCKS_PORT)
socks.wrapmodule(urllib2) socks.wrapmodule(urllib2)
def __setTorHTTPProxySettings():
if not conf.tor:
return
infoMsg = "setting Tor HTTP proxy settings"
logger.info(infoMsg)
found = None
for port in DEFAULT_TOR_PORTS:
try:
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((LOCALHOST, port))
found = port
break
except socket.error:
pass
s.close()
if found:
conf.proxy = "http://%s:%d" % (LOCALHOST, found)
else:
errMsg = "can't establish connection with the Tor proxy. "
errMsg += "Please make sure that you have Vidalia, Privoxy or "
errMsg += "Polipo bundle installed for you to be able to "
errMsg += "successfully use --tor switch "
if IS_WIN:
errMsg += "(e.g. https://www.torproject.org/projects/vidalia.html.en)"
else:
errMsg += "(e.g. http://www.coresec.org/2011/04/24/sqlmap-with-tor/)"
raise sqlmapConnectionException, errMsg
def __checkTor(): def __checkTor():
if conf.checkTor: if conf.checkTor:
infoMsg = "checking Tor connection" infoMsg = "checking Tor connection"

View File

@ -347,8 +347,8 @@ SQL_SCALAR_REGEX = r"\A(SELECT(?!\s+DISTINCT\(?))?\s*\w*\("
# IP address of the localhost # IP address of the localhost
LOCALHOST = "127.0.0.1" LOCALHOST = "127.0.0.1"
# Default ports used in Tor proxy bundles # Default port used by Tor
DEFAULT_TOR_PORTS = (8123, 8118) DEFAULT_TOR_SOCKS_PORT = 9050
# Percentage below which comparison engine could have problems # Percentage below which comparison engine could have problems
LOW_TEXT_PERCENT = 20 LOW_TEXT_PERCENT = 20