Proxify any application. Tsocks and proxychains. Force any program to communicate through a SOCKS, HTTP(S) proxy. And how to use cascading proxies.

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. Proxychain – Daddy of all proxies

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. So much there, and so less time. Damn! weekend is about to get over. Off to watch, “Hairspray”. :)

6 Responses to “Proxify any application. Tsocks and proxychains. Force any program to communicate through a SOCKS, HTTP(S) proxy. And how to use cascading proxies.”

  1. Download Music » Proxify any application. Tsocks and proxychains. Force any program … Says:

    [...] You can read the rest of this blog post by going to the original source, here [...]

  2. Proxy Hacks - Final. HTTPTunnel. TCP/IP connections over plain old GET and POST requests. « Ubuntu, Life, Mobiles, Music, Movies, iPod and Ofcourse Windows! Says:

    [...] That’s it. You are done. Restart client service and you have a ready to go SOCKS proxy over which you can tunnel as many protocols as you want. Again for application not supporting SOCKS proxy like IE, Opera use proxifiers as suggested in my previous post here. [...]

  3. Ben Says:

    Excellent guide! I often use proxychain but did not know about tsocks.

  4. Jonathan Says:

    I can’t seem to get proxychains to authenticate correctly – even in the case of a single proxy. My configuration line looks like this:

    strict_chain
    http 3128 \

    If I set http_proxy to “http://\:@:3128″ then I can at least do something like “wget yahoo.com” but if I clear http_proxy and instead try “proxychains wget yahoo.com” then I get:

    –18:05:28– http://yahoo.com/
    => `index.html’
    Resolving yahoo.com… 66.94.234.13, 216.109.112.135
    Connecting to yahoo.com|66.94.234.13|:80… ProxyChains-2.1 (http://proxychains.sf.net)
    strict chain:..broken
    failed: Connection refused.

    So I presume proxychains isn’t authenticating correctly with my local proxy, possibly because of having the domain specified. I’ve tried putting quotes around the “\” and I’ve tried putting double-backslash in the place of single-backslash. No change.

    Any ideas?

  5. Jonathan Says:

    Let me try that again… all the bits that look like HTML got swallowed by WordPress…

    I can’t seem to get proxychains to authenticate correctly – even in the case of a single proxy. My configuration line looks like this:

    strict_chain
    http (URL) 3128 (domain)\(user) (pass)

    If I set http_proxy to “http://(domain)\(user):(pass)@(URL):3128″ then I can at least do something like “wget yahoo.com” but if I clear http_proxy and instead try “proxychains wget yahoo.com” then I get:

    –18:05:28– http://yahoo.com/
    => `index.html’
    Resolving yahoo.com… 66.94.234.13, 216.109.112.135
    Connecting to yahoo.com|66.94.234.13|:80… ProxyChains-2.1 (http://proxychains.sf.net)
    strict chain:..broken
    failed: Connection refused.

    So I presume proxychains isn’t authenticating correctly with my local proxy, possibly because of having the domain specified. I’ve tried putting quotes around the “(domain)\(user)” and I’ve tried putting double-backslash in the place of single-backslash. No change.

    Any ideas?

  6. Eloims Says:

    Try doing the same w/o using strict chain: use dynamic

    I don’t know why but it worked for me.
    You must use IP adresses (no DNS) when you put proxies in the config file.


Leave a Reply