43 lines
1.3 KiB
Python
43 lines
1.3 KiB
Python
# -*- mode: python; indent-tabs-mode: nil; py-indent-offset: 4; coding: utf-8 -*-
|
|
# http://vt5hknv6sblkgf22.onion/tutorials/over_the_river.html
|
|
|
|
import sys
|
|
import os
|
|
import getpass
|
|
from stem.control import Controller
|
|
from stem.connection import MissingPassword
|
|
|
|
if len(sys.argv) <= 1:
|
|
sys.argv += ['']
|
|
|
|
if os.path.exists('/run/tor/control'):
|
|
controller = Controller.from_socket_file(path='/run/tor/control')
|
|
else:
|
|
controller = Controller.from_port(port=9051)
|
|
try:
|
|
controller.authenticate()
|
|
except (Exception, MissingPassword):
|
|
sys.stdout.flush()
|
|
p = getpass.unix_getpass(prompt='Controller Password: ', stream=sys.stderr)
|
|
controller.authenticate(p)
|
|
try:
|
|
|
|
for elt in sys.argv[1:]:
|
|
desc = controller.get_hidden_service_descriptor(elt, await_result=True, timeout=None)
|
|
print(f"{desc} get_hidden_service_descriptor\n")
|
|
l = desc.introduction_points()
|
|
if l:
|
|
print(f"{elt} NO introduction points\n")
|
|
continue
|
|
print(f"{elt} introduction points are...\n")
|
|
|
|
for introduction_point in l:
|
|
print(' %s:%s => %s' % (introduction_point.address,
|
|
introduction_point.port,
|
|
introduction_point.identifier))
|
|
|
|
except Exception as e:
|
|
print(e)
|
|
finally:
|
|
del controller
|