I'm preparing for my graduation project. It is about Tor hidden services. I configured my machine as directory so that it can obtain onion addresses of hidden services. I have been studying the basic principles of Tor, but I still don't understand how to get an onion address. But I trust there must be a cache file? Right? How can I find it? The other methods to obtain onion addresses can also be accepted.
You should not be running your relay to try and scrape descriptors of published hidden services, this is considered malicious behavior and your relay will be removed from the tor network.
If you want to view descriptors of onions that are already public, you should use the HSFETCH command, details can be found here and a tutorial on using the stem library to fetch them can be found here.
but I still don't understand how to get onion address.
You would simply edit your
torrc config file, by propagating the settings for hidden service, thereafter tor daemon will re-read it, after SIGHUP:
pidof tor | xargs kill -HUP, and will create an onion address for you.
Add this to your
/etc/tor/torrc config file:
HiddenServiceDir /tmp/hidden/ HiddenServicePort 80 127.0.0.1:8080
And change ownership of a directory:
# mkdir /tmp/hidden # chown -R debian-tor:debian-tor /tmp/hidden # kill -HUP `pidof tor`
After SIGHUP, read your address:
# cat /tmp/hidden/hostname f47tueagfcx6grjs.onion