[tor-bugs] #15999 [Stem]: End-to-end integ test for hidden service

Tor Bug Tracker & Wiki blackhole at torproject.org
Tue May 12 03:03:27 UTC 2015


#15999: End-to-end integ test for hidden service
-------------------------+------------------------
 Reporter:  atagar       |          Owner:  atagar
     Type:  enhancement  |         Status:  new
 Priority:  minor        |      Milestone:
Component:  Stem         |        Version:
 Keywords:  testing      |  Actual Points:
Parent ID:               |         Points:
-------------------------+------------------------
 While adding support for ephemeral hidden services I tried to add a end-
 to-end integ test without success. Ideally the test would create a new
 hidden service, then use tor to retrieve its content.

 Really shouldn't be a big whoop. We have a tutorial for something similar
 after all. But for some reason even the tutorial wasn't working for me
 (hidden service was inaccessible)...

 {{{
   @require_online
   @require_controller
   @require_version(Requirement.ADD_ONION)
   def test_using_ephemeral_hidden_services(self):
     """
     Create and use a live ephemeral hidden service.
     """

     # TODO: Not having success getting... well, just about any damn hidden
     # serivce working. Even our prior tutorial is failing right now. >:(

     return

     with test.runner.get_runner().get_tor_controller() as controller:
       incoming_address = None, None

       def run_server():
         serversocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
         serversocket.bind(('localhost', 4567))
         serversocket.listen(5)
         incoming_socket, incoming_address = serversocket.accept()
         incoming_socket.write('hello world')
         serversocket.shutdown(socket.SHUT_RDWR)

       server_thread = threading.Thread(target = run_server)
       server_thread.setDaemon(True)
       server_thread.start()

       response = controller.create_ephemeral_hidden_service({80: 4567})

       with test.network.Socks(controller.get_socks_listeners()[0]) as s:
         s.settimeout(30)
         s.connect(('%s.onion' % response.service_id, 80))
         print s.read()

       self.assertTrue(incoming_address is not None)

       server_thread.join()
 }}}

--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/15999>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online


More information about the tor-bugs mailing list