What I just pushed
Toralizer works now! It is a small C tool that sends a program's TCP connections through Tor. You run curl, wget or ssh through it and you do not recompile anything. The code is at https://github.com/kleinpanic/toralizer.
How it works
It is an LD_PRELOAD library that hooks connect(). The hook finds the real connect with dlsym(RTLD_NEXT, "connect"). It opens a socket to the local Tor SOCKS proxy and does a SOCKS5 handshake. Then it dup2()s the proxy socket over the app's file descriptor, so the program keeps using the same descriptor it already had. It handles IPv4 and IPv6 by checking sa_family.
The whole thing is src/toralize.c, 242 lines. You need Tor running on your machine. There is also a wrapper script, build/toralize.sh, so you do not have to set LD_PRELOAD by hand. Once it is installed you run this:
toralize curl https://check.torproject.org
The README has the install steps.
What is not done
DNS can still leak. If an app resolves names on its own before it calls connect(), that lookup does not go through Tor. The README says so too, and it matters if you care about this stuff.
The header include/toralize.h still has SOCKS4 style structs and a USERNAME define. They are left over from the first scaffold. I have not cleaned them out yet.
There is no LICENSE file and no tag yet. The wrapper script says version 1.0.0, but that is only the script.
What is next
Try it on something and tell me if it breaks. I want to know.
P.S Thanks for reading. Consider subbing to the RSS feed.
Klein Panic