[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [tor-bugs] #5830 [Analysis]: Write stream/circ event parser to track circuit use



#5830: Write stream/circ event parser to track circuit use
----------------------+-----------------------------------------------------
 Reporter:  arma      |          Owner:       
     Type:  task      |         Status:  new  
 Priority:  normal    |      Milestone:       
Component:  Analysis  |        Version:       
 Keywords:            |         Parent:  #5752
   Points:            |   Actualpoints:       
----------------------+-----------------------------------------------------

Comment(by atagar):

 I'm not entirely sure what you're looking for, but while stem is
 functional it's still pretty rough around the edges. Event parsing will be
 early in Ravi's project so it should be done somewhere in early June, but
 for now stem only provides the unparsed message objects. Here's an example
 for printing events...

 {{{
 # Simple script to start a tor instance, attaches to it, and prints BW
 events
 # for a few seconds.

 import time

 from stem.connection import connect_port, authenticate
 from stem.control import BaseController
 from stem.process import launch_tor, NO_TORRC

 # controller class that simply prints the events that it receives
 class EventPrinter(BaseController):
   def _handle_event(self, event_message):
     print event_message

 # Start a tor instance that, hopefully, won't conflict with anything. We
 can
 # connect to it and start using the instance when bootstrapping reaches
 5%.

 print "starting tor..."
 tor_process = launch_tor(
   options = {'ControlPort': '2777'},
   torrc_path = NO_TORRC,
   completion_percent = 5,
 )

 with connect_port(control_port = 2777) as control_socket:
   controller = EventPrinter(control_socket)
   authenticate(controller)
   controller.msg('SETEVENTS BW')
   time.sleep(5)

 tor_process.kill()
 }}}

 ... and here's an example for doing something similar with TorCtl...

 https://gitweb.torproject.org/pytorctl.git/blob/HEAD:/example.py

-- 
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/5830#comment:7>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online
_______________________________________________
tor-bugs mailing list
tor-bugs@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-bugs