Total Pageviews

Monday 18 June 2012

use Tsocks or proxychains to Proxify any application. Force any program to communicate through a SOCKS, HTTP(S) proxy

How many times have you found applications not having proper proxy support. Or sometimes, they support proxies but does not let you provide proxy authentication. Ever used plain old telnet through a proxy ? Ever ran port scanners through proxies ?
Ever found wanting on how to use multiple cascading proxies, like two or more proxy in series.

Uses for cascading proxies? – TOR networks, OR Sometimes only way to get out of a LAN is to travel through more than two proxies – from one network to other network to internet. For e.g. you are in a secure network inside some outside networks.
Or how about mixing many proxies in the chain, Socks->HTTP->Socks etc,
I think you got the point.
TSOCKS – A simple “Transparent SOCKS”.
Here’s a cool tool “Tsocks” or transparent- socks, which lets you run any program through a socks proxy. All you have to do is specify the proxy server in config file and run the program as,
> tsocks programName
Tsocks forces program to create all its connections through the address specified in configuration file. This way, you can force any program to connect over a socks proxy.
This can find a lot of uses such as, if you want to sniff only a particular application’s traffic, or may be you want to use cascading proxies. I use it to create a socks proxy over SSH and simply run my googleTalk through it.
So why waiting, grab a terminal – sudo apt-get install tsocks
To edit config file, gedit /etc/tsocks.conf
- Specify local networks @ “local = ” e.g. in my case local = 192.168.1.0/255.255.255.0
- Now browse towards the end and specify socks server address and port. Keep server type as 5. That’s SOCKS 5
Windows alternative : FreeCap
2. Proxychains – Daddy of all proxies  (http://proxychains.sourceforge.net/)
Basic use is same as Tsocks, except that as name suggests used for proxy chains. You can even mix different proxies(Socks 4,5, http,https).
Regarding the config file (/etc/proxychain.conf) : It can work in one of three modes:
- strict_chain – All proxies in the chain are used in order.
- dynamic_chain – All proxies in the chain are used in order. Dead proxies are skipped.
- random_chain – Random proxy or proxy-chains are used.
chain_len : length of chains to be used by random_chain
After this simply write proxies in series as shown in the config file.
Again usage is very simple. > proxychains telnet targethost.com
Windows Alternative : Sockschain
It should be interesting to find out how proxychain actually works.
from http://kakku.wordpress.com/2007/11/18/proxify-any-application-tsocks-and-proxychains-force-any-program-to-communicate-through-a-socks-https-proxy-or-use-cascading-proxies