Wrap network traffic of almost any application with a SOCKS proxy

From XPUB & Lens-Based wiki

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