January 5, 2016

How to View Tor Service Hostnames on a Machine

My favourite way to get around ISPs not letting me run my own services for myself is to use tor. However, tor assigns me a random hostname, which for the world of me, I cannot remember. Therefore, I've written a script to tell me which services are available on a certain server and their onion hosts. It is available below:

This is a bash script. Bash has a set of builtin commands, among them is getopts, which is used to GET OPTionS; in other words, parse arguments. Tor runs chrooted on this server where my normal user doesn't have access, so I must use sudo to change to the tor user (alternatively, one could setuid the script to the tor user). If the 'h' argument is given, the second argument is the directory under the tor directory which is checked for the hostname, and echoed to standard output. Without the 'h' argument, a list of hosts is discerned from the control directory. The awk script parses the last field of the path, after skipping the first line, which is the control directory itself. Sample run below:

No comments:

Post a Comment