Never Ending Security

It starts all here

Tag Archives: Proxychains

Proxify applications with torsocks, tsocks and proxychains on Linux

Proxify applications with torsocks

Many applications do not directly support the use of socks proxy. Torsocks enables such applications to use the tor socks proxy.

Shell wrapper to simplify the use of the torsocks library to transparently allow an application to use a SOCKS proxy.

Torsocks gets installed along with the tor package on ubuntu for example

$ sudo apt-get install tor

Proxify applications

Lets say we want to proxify the telnet command to connect through a proxy. This can be done by wrapping the telnet command with torify/usewithtor.

$ torify telnet 80


$ usewithtor telnet 80

Now all network calls made by the telnet programs shall be routed through the tor proxy. To see the proxy effect try opening the the url through curl. The url echos the public ip of the requesting user.

Without proxy it would look something like this

$ curl

Now using it with torsocks.

$ usewithtor curl

Now the ip is changed because the url was opened through the tor proxy.

Check the project homepage to find out what applications work well with torsocks. For example pidgin works with torsocks. Just launch it with the usewithtor command

$ usewithtor pidgin

Proxify applications with tsocks and proxychains on ubuntu


There are many network applications that do not have the option to specify a proxy or do not support the use of proxies. In such cases tsocks is a useful tool to wrap all network communication done by a program via a socks proxy.

Project website

Install on ubuntu

$ sudo apt-get install tsocks

Now open the configuration file /etc/tsocks.conf and edit the following parameters

1. server
2. server_type
3. server_port

Sample file

# This is the configuration for libtsocks (transparent socks) # Lines beginning with # and blank lines are ignored # # The basic idea is to specify: #	- Local subnets - Networks that can be accessed directly without #	assistance from a socks server #	- Paths - Paths are basically lists of networks and a socks server #	which can be used to reach these networks #	- Default server - A socks server which should be used to access  #	networks for which no path is available # Much more documentation than provided in these comments can be found in # the man pages, tsocks(8) and tsocks.conf(8)  # Local networks # For this example this machine can directly access  # (192.168.0.*) and (10.*)  local = local =  # Paths # For this example this machine needs to access as  # well as port 80 on the network through # the socks 5 server at (if this machines hostname was  # "" we could also specify that, unless --disable-hostnames # was specified to ./configure).  path { reaches = reaches = server = server_type = 5 default_user = delius default_pass = hello }  # Default server # For connections that aren't to the local subnets or to # the server at should be used (again, hostnames could be used # too, see note above)  server = # Server type defaults to 4 so we need to specify it as 5 for this one server_type = 5 # The port defaults to 1080 but I've stated it here for clarity  server_port = 9050

After doing this its important to start a socks proxy on port 9050. The best solution is TOR.
Download/Install tor and start it.

Now launch any application from the terminal as following

$ tsocks epiphany

Epiphany is a browser. After launching epiphany from tsocks, open to verify your ip address.
So using tsocks any application that uses sockets can be made to use the socks proxy and become anonymous.


Tsocks is limited to socks5 proxy. It cannot use http proxy servers. Here comes the solution for http proxies – proxychain.

Project website

Install on ubuntu

$ sudo apt-get install proxychains

Now edit the configuration file /etc/proxychains.conf

# proxychains.conf VER 3.1 # # HTTP, SOCKS4, SOCKS5 tunneling proxifier with DNS. #	  # The option below identifies how the ProxyList is treated. # only one option should be uncommented at time, # otherwise the last appearing option will be accepted # #dynamic_chain # # Dynamic - Each connection will be done via chained proxies # all proxies chained in the order as they appear in the list # at least one proxy must be online to play in chain # (dead proxies are skipped) # otherwise EINTR is returned to the app # strict_chain # # Strict - Each connection will be done via chained proxies # all proxies chained in the order as they appear in the list # all proxies must be online to play in chain # otherwise EINTR is returned to the app # #random_chain # # Random - Each connection will be done via random proxy # (or proxy chain, see chain_len) from the list. # this option is good to test your IDS :)  # Make sense only if random_chain #chain_len = 2  # Quiet mode (no output from library) #quiet_mode  # Proxy DNS requests - no leak for DNS data #proxy_dns   # Some timeouts in milliseconds tcp_read_time_out 15000 tcp_connect_time_out 8000  # ProxyList format # type host port [user pass] # (values separated by 'tab' or 'blank') # # # Examples: # # socks5	1080	lamer	secret #	http	8080	justu	hidden #	socks4	1080 #	http	8080	 #	 # # proxy types: http, socks4, socks5 # ( auth types supported: "basic"-http "user/pass"-socks ) # [ProxyList] # add proxy here ... # meanwile # defaults set to "tor" #socks5 9050 http	8080

Comment out proxy_dns option, otherwise it will be difficult to make it work. Then towards the end of the file add the list of proxy servers. Add only 1 and comment the rest of easy use. Over here we first test the http proxy so add the following

http	8080

After adding the http proxy to the list its time to start an http proxy server on localhost ( This can be done by either installing TOR+Polipo or by simply launching the burp suite program which has an integrated http proxy server. Once the http proxy server is up, launch proxychains along with the application that needs to be proxified :

$ proxychains telnet 80

This will make the telnet program use the http proxy specified earlier. Simple and effective.

It should be clearly understood that tsocks or proxychains are not proxy servers, they are just proxifying tools that can make non proxy aware programs to communicate via proxies.