[tor-bugs] #17086 [Stem]: CircuitEvent socks_username and socks_password is always None

Tor Bug Tracker & Wiki blackhole at torproject.org
Tue Sep 15 22:25:14 UTC 2015


#17086: CircuitEvent socks_username and socks_password is always None
--------------------------------------------+---------------------
 Reporter:  trodun                          |          Owner:
     Type:  defect                          |         Status:  new
 Priority:  normal                          |      Milestone:
Component:  Stem                            |        Version:
 Keywords:  socks_username, socks_password  |  Actual Points:
Parent ID:                                  |         Points:
--------------------------------------------+---------------------
 Passing a socks user and pass with the request will not lead to these
 attributes being set, but the stream isolation is triggered.

 {{{
 import io

 import pycurl
 from stem.process import launch_tor_with_config
 from stem.control import Controller, EventType


 SOCKS_PORT = 9050
 CONTROL_PORT = 9051


 def query(url, user=None, passw=None):

     output = io.BytesIO()

     query = pycurl.Curl()
     query.setopt(query.URL, url)
     query.setopt(query.PROXY, '127.0.0.1')
     query.setopt(query.PROXYPORT, SOCKS_PORT)
     query.setopt(query.PROXYTYPE, 7)
     query.setopt(query.PROXYUSERNAME, user)
     query.setopt(query.PROXYPASSWORD, passw)
     query.setopt(query.WRITEFUNCTION, output.write)

     query.perform()
     return output.getvalue()


 def circ_event(circ):
     print(circ.socks_username, circ.socks_password)

 tor_process = launch_tor_with_config(
     config={'SocksPort': str(SOCKS_PORT),
             'ControlPort': str(CONTROL_PORT),
             'SOCKSListenAddress': '127.0.0.1'})

 controller = Controller.from_port(port=CONTROL_PORT)
 controller.authenticate()
 controller.add_event_listener(circ_event, EventType.CIRC)

 query('http://example.com/', user='data', passw='lost')

 controller.close()
 tor_process.kill()
 }}}

 Output:
 {{{
 None None
 None None
 None None
 None None
 None None
 None None
 None None
 None None
 None None
 None None
 }}}

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


More information about the tor-bugs mailing list