Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 885b432

Browse files
committed
minor update
1 parent ba4234d commit 885b432

2 files changed

Lines changed: 4 additions & 39 deletions

File tree

lib/core/option.py

Lines changed: 2 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@
8181
from lib.core.settings import CODECS_LIST_PAGE
8282
from lib.core.settings import DEFAULT_GET_POST_DELIMITER
8383
from lib.core.settings import DEFAULT_PAGE_ENCODING
84-
from lib.core.settings import DEFAULT_TOR_PORTS
84+
from lib.core.settings import DEFAULT_TOR_SOCKS_PORT
8585
from lib.core.settings import GENERAL_IP_ADDRESS_REGEX
8686
from lib.core.settings import IS_WIN
8787
from lib.core.settings import PLATFORM
@@ -1682,44 +1682,9 @@ def __setTorSocksProxySettings():
16821682
infoMsg = "setting Tor SOCKS proxy settings"
16831683
logger.info(infoMsg)
16841684

1685-
socks.setdefaultproxy(socks.PROXY_TYPE_SOCKS5, 'localhost', 9050)
1685+
socks.setdefaultproxy(socks.PROXY_TYPE_SOCKS5, LOCALHOST, DEFAULT_TOR_SOCKS_PORT)
16861686
socks.wrapmodule(urllib2)
16871687

1688-
def __setTorHTTPProxySettings():
1689-
if not conf.tor:
1690-
return
1691-
1692-
infoMsg = "setting Tor HTTP proxy settings"
1693-
logger.info(infoMsg)
1694-
1695-
found = None
1696-
1697-
for port in DEFAULT_TOR_PORTS:
1698-
try:
1699-
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
1700-
s.connect((LOCALHOST, port))
1701-
found = port
1702-
break
1703-
except socket.error:
1704-
pass
1705-
1706-
s.close()
1707-
1708-
if found:
1709-
conf.proxy = "http://%s:%d" % (LOCALHOST, found)
1710-
else:
1711-
errMsg = "can't establish connection with the Tor proxy. "
1712-
errMsg += "Please make sure that you have Vidalia, Privoxy or "
1713-
errMsg += "Polipo bundle installed for you to be able to "
1714-
errMsg += "successfully use --tor switch "
1715-
1716-
if IS_WIN:
1717-
errMsg += "(e.g. https://www.torproject.org/projects/vidalia.html.en)"
1718-
else:
1719-
errMsg += "(e.g. http://www.coresec.org/2011/04/24/sqlmap-with-tor/)"
1720-
1721-
raise sqlmapConnectionException, errMsg
1722-
17231688
def __checkTor():
17241689
if conf.checkTor:
17251690
infoMsg = "checking Tor connection"

lib/core/settings.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -347,8 +347,8 @@
347347
# IP address of the localhost
348348
LOCALHOST = "127.0.0.1"
349349

350-
# Default ports used in Tor proxy bundles
351-
DEFAULT_TOR_PORTS = (8123, 8118)
350+
# Default port used by Tor
351+
DEFAULT_TOR_SOCKS_PORT = 9050
352352

353353
# Percentage below which comparison engine could have problems
354354
LOW_TEXT_PERCENT = 20

0 commit comments

Comments
 (0)