|
81 | 81 | from lib.core.settings import CODECS_LIST_PAGE |
82 | 82 | from lib.core.settings import DEFAULT_GET_POST_DELIMITER |
83 | 83 | 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 |
85 | 85 | from lib.core.settings import GENERAL_IP_ADDRESS_REGEX |
86 | 86 | from lib.core.settings import IS_WIN |
87 | 87 | from lib.core.settings import PLATFORM |
@@ -1682,44 +1682,9 @@ def __setTorSocksProxySettings(): |
1682 | 1682 | infoMsg = "setting Tor SOCKS proxy settings" |
1683 | 1683 | logger.info(infoMsg) |
1684 | 1684 |
|
1685 | | - socks.setdefaultproxy(socks.PROXY_TYPE_SOCKS5, 'localhost', 9050) |
| 1685 | + socks.setdefaultproxy(socks.PROXY_TYPE_SOCKS5, LOCALHOST, DEFAULT_TOR_SOCKS_PORT) |
1686 | 1686 | socks.wrapmodule(urllib2) |
1687 | 1687 |
|
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 | | - |
1723 | 1688 | def __checkTor(): |
1724 | 1689 | if conf.checkTor: |
1725 | 1690 | infoMsg = "checking Tor connection" |
|
0 commit comments