Torify


torify (and torsocks) is a program that torifies other programs. You can IRC over Tor using this, or scrape websites. Or whatever. Its free software and available on all unixes, via the package managers.

1) install tor (duh)
2) edit the /etc/tor/torrc file as follows:
2.1) Change the line that says "#ControlPort 9051", so it says "ControlPort 9051" (this is so torify can control the Tor program)
2.2) Change the line that says "#CookieAuthentication 1" so it says "CookieAuthentication 0" (so torify does not need to authenticate to your Tor program)
2.3) Save the file
3) Restart tor (e.g. "systemctl restart tor" if you are on most linuxes)
4) Install torify (and maybe torsocks, they do the same thing kindof)

Now you can write "torify COMMAND" and COMMAND will be using Tor to connect to whatever. Even if COMMAND does not usually support Tor or SOCKS5 proxies.


The way torify works is that it injects its own function calls instead of the TCP system calls, so if a program is using normal TCP, then they will instead be going to Tor. It does this my setting the LD_PRELOAD environment variable to point to its own library, and then running COMMAND, which causes the dynamic linker (ld.so) to use the torify librarty for certain system calls (socket system calls, especially TCP sockets). This means that it does not work with statically linked software so be careful to do this with software and onion sites where it is SUPER IMPORTANT that you hide your identity.

torify and torsocks does not torify other types of sockets than TCP. This means that it does not torifies ICMP, SCTP, X.25, UDP, and so on. If you dont know what that means then... well. It means that it only torifies "normal internet" traffic.
torify will BLOCK outgoing traffic that is not TCP. But it will not be able to block statically linked binaries system calls. Basically, this means that "normal unix software" will be possible to torify. Unless you are on a weird distro.
The reason torify can only carry TCP traffic is because Tor itself ONLY carries TCP. (I2P can carry UDP-like traffic, however..)

Scraping an onion site

(Scraping means that you download everything.)

1) torify wget --no-parent --recursive http://ONION_ADDRESS/optional-path/

Example: torify wget --no-parent --recursive http://onion.tor.my/share/nuclear/


Retry infinite number of times for onion sites that has a bad connection, or if you want to download huge files:

Add "--retry-connrefused --read-timeout=20 --timeout=15 --tries=inf --continue" as arguments to wget.

Better Tor experience with large files?!?!!1

Just torify wget the huge files, so you do not have to watch videos in the browser.. idk



Back