views:

16

answers:

2

I have connected to a socks5 server in my java application, and now I want to launch an external application and have all of its connections run through the socks5 server. The external application itself doesn't support socks5.

Any input would be great, scratching my head here..

A: 

The 2 trick I know how to do that are to replace the standard runtime library or a similar trick to intercept the OS networking calls or to setup a set of finely tuned firewall rules in the kernel.

Both of these techniques are very OS specific and have no way to da that using java.

Your best bet would be to run an existing socks5 wrapper and let that program start the external application like socksify.

I have had mixed experience with this approach, some applications work, others do not, and never found any logic in it.

YMMV

Another approach is to play a tcpproxy in the Java application (e.g. using the Apache MINA stuff) and have the application connect to your proxy port on localhost. Again this will only work for certain services.

Peter Tillemans
A: 

If the external application is written in Java it does support SOCKS. Just run it with -DsocksProxyHost=host and -DsocksProxyPort=port. See [1].

[1]: http://download.oracle.com/javase/6/docs/technotes/guides/net/properties.html "Networking Properties".

EJP