Wrap network traffic of almost any application with a SOCKS proxy: Difference between revisions

From XPUB & Lens-Based wiki
(Created page with "So you have your nice little tunnel up and running, and now you would like to also use it for some network scripts/app you wrote. One way to...")
 
No edit summary
 
Line 13: Line 13:
</source>
</source>


And add the following section in you /etc/dante.conf:
And add the following section in your /etc/dante.conf:


<source lang="bash">
<source lang="bash">
Line 29: Line 29:
socksify ./superbot.py
socksify ./superbot.py
</source>
</source>
[[Category: Cookbook]]

Latest revision as of 14:36, 15 January 2011

So you have your nice little tunnel up and running, and now you would like to also use it for some network scripts/app you wrote. One way to do it is to set and export, in your terminal or in a shell wrapper for your application, the SOCKS_SERVER environment variable:

export SOCKS_SERVER=127.0.0.1:12345

In theory everything started in the shell from which this has been set, should have its network traffic going through your SOCKS proxy. Unfortunately this is rarely the case as a lot of applications do not take this variable into account or simply have no support for SOCKS in general.

Enter socksify! Thanks to this small wrapper, it is possible to dynamically SOCKSify a program.

sudo apt-get install dante-client

And add the following section in your /etc/dante.conf:

route {
      from: 0.0.0.0/0 to: 0.0.0.0/0 via: 127.0.0.1 port = 12345
      protocol: tcp udp                
      proxyprotocol: socks_v5
      method: none
}

From now on, any program that should be used through your SOCKS proxy, can be started like this:

socksify ./superbot.py