[sqlmap-users] Tor enhancement to allow SOCKS port selection
Brought to you by:
inquisb
From: Shane S. <ss...@gm...> - 2011-12-23 05:58:18
|
I noticed that the most recent version of Tor suggests the use of SOCKS5 in lieu of an HTTP proxy, and sqlmap is moving to this approach as well. However, sqlmap attempts to use to use the default SOCKS Tor port of 9050. I have updated my local version to allow users to provide a specific SOCKS port for Tor by providing "--tor-port". Please see the following diffs if you're interested in adding this functionality to your version: Index: lib/core/option.py =================================================================== --- lib/core/option.py (revision 4624) +++ lib/core/option.py (working copy) @@ -1732,7 +1732,7 @@ logger.info(infoMsg) # Has to be SOCKS5 to prevent DNS leaks ( http://en.wikipedia.org/wiki/Tor_%28anonymity_network%29) - socks.setdefaultproxy(socks.PROXY_TYPE_SOCKS5 if conf.torType == PROXYTYPE.SOCKS5 else socks.PROXY_TYPE_SOCKS4, LOCALHOST, DEFAULT_TOR_SOCKS_PORT) + socks.setdefaultproxy(socks.PROXY_TYPE_SOCKS5 if conf.torType == PROXYTYPE.SOCKS5 else socks.PROXY_TYPE_SOCKS4, LOCALHOST, int(DEFAULT_TOR_SOCKS_PORT if conf.torPort is None else conf.torPort)) socks.wrapmodule(urllib2) def __checkTor(): Index: lib/core/optiondict.py =================================================================== --- lib/core/optiondict.py (revision 4624) +++ lib/core/optiondict.py (working copy) @@ -174,6 +174,7 @@ "updateAll": "boolean", "tor": "boolean", "torType": "string", + "torPort": "integer", }, "Miscellaneous": { Index: lib/parse/cmdline.py =================================================================== --- lib/parse/cmdline.py (revision 4624) +++ lib/parse/cmdline.py (working copy) @@ -536,6 +536,9 @@ general.add_option("--tor-type", dest="torType", help="Set Tor proxy type (HTTP - default, SOCKS4 or SOCKS5)") + + general.add_option("--tor-port", dest="torPort", + help="Set Tor port when using SOCKS4 or SOCKS5") general.add_option("--update", dest="updateAll", action="store_true", Cheers, -Shane |