Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
A simple script which demonstrates how to retrieve hidden service descriptors via the HSFETCH Tor control port command
import sys
import argparse
import stem
from stem.control import Controller
def main():
parser = argparse.ArgumentParser(description="%s fetches a Tor hidden "
"service descriptor." % sys.argv[0])
parser.add_argument("-p", "--port", type=int, default=9051,
help="Tor controller port")
parser.add_argument('onion_address', type=str, help='Onion address')
args = parser.parse_args()
with Controller.from_port(port=args.port) as controller:
hs_descriptor = controller.get_hidden_service_descriptor(args.onion_address)
except stem.DescriptorUnavailable:
print("Descriptor not found, the hidden service may be offline.")
return 1
if __name__ == '__main__':

This comment has been minimized.

Copy link

ws1021 commented May 6, 2019


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.