Socks proxy for non-socks applications

For several reasons you may want to use a socks proxy, but a lot of command line applications are not able to work with a socks proxy.

wget for example is unable to work directly with a socks proxy. Also, configuring wget to work with a http proxy is a pain. You can’t specify the proxy from the command line.

Fortunately, there are transparent ways to make things work.

One option in hand is tsocks (transparent socks). Debian comes with it pre installed. If not just do a:

> apt-get install tsocks

and you’re good to go.

You need to edit the /etc/tsocks.conf. You can specify a lot of thing there but the really important lines are the ones at the end of the file:

server = 127.0.0.1 # socks ip here
server_type = 5 # 5 for socks5, default is 4
server_port = 1080 # well... 

You can use tsocks as simple as this:

> tsocks app args[]

Now we can put it to a test:

> tsocks wget www.whatismyip.com

and test to see if index.html contains the IP of the proxy.

Now, if you want to use a proxy chain you may want to use proxychain. But about this one in another post.

Leave a Reply