use tor controller to detect circuit/path change

Hi, I'm new to Tor controller, Tor client usually open 3 circuits, one for current use and the other 2 for standby. Tor will change the current circuit/path in use from time to time, depending on the network load dynamics I'm wondering whether it is possible to use Tor controller to detect when the circuit/path in use is changed and obtain the list of IP addresses of those relay nodes. thanks!

Hi, I'm new to Tor controller,
Tor client usually open 3 circuits, one for current use and the other 2 for standby.
Tor will change the current circuit/path in use from time to time, depending on the network load dynamics
I'm wondering whether it is possible to use Tor controller to detect when the circuit/path in use is changed and obtain the list of IP addresses of those relay nodes.
Hi esolve. I'm pretty sure that you'll simply want to write a script that listens for CIRC events... https://gitweb.torproject.org/torspec.git/blob/HEAD:/control-spec.txt#l1232 The main controller libraries at present are... - txtorcon (https://txtorcon.readthedocs.org/en/latest/) - controller library for twisted apps - stem (https://stem.readthedocs.org/en/latest/index.html) - general controller library that'll replace TorCtl - torctl (https://gitweb.torproject.org/pytorctl.git/) - the original and most stable controller library If you want an example for using stem then I'd be happy to write you one later. Ravi and I are currently working to improve its event handling support so it's presently a bit rough for your use case, but still perfectly doable. Cheers! -Damian

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Damian Johnson <atagar@torproject.org> writes:
I'm wondering whether it is possible to use Tor controller to detect when the circuit/path in use is changed and obtain the list of IP addresses of those relay nodes.
- txtorcon (https://txtorcon.readthedocs.org/en/latest/) - controller library for twisted apps
Specifically, try this example: https://github.com/meejah/txtorcon/blob/master/examples/stream_circuit_logge... You'll be interested in the last hop in the "path" attribute of Circuit objects. If you want to know which streams are exiting via which circuits, listen for STREAM events and look at the Circuit to which they're connected. - -- meejah -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) Comment: Processed by Mailcrypt 3.5.8 <http://mailcrypt.sourceforge.net/> iQEcBAEBAgAGBQJQkD/eAAoJEMJgKAMSgGmnUNcH/2hZvHQ3N+MvqT7zN764Jt0j YwbCMfSpVNcOyidDyHIVU3uoT+Ji+il50yhhkCOHelCJAUWuJZjva5K80bpdlNVM QbQ6IW5AuoX4ToCLKJ0qSsNeKlt66tI54G5c0TrZfiS/JVD8viz/iQ/x6/rzvsG/ Qr11AeVY5O9Oo/1Xl1kw/kTHUhCisXX+kou/ZEAh12Hvkkwy6zg4HlX1/z+uh/9J 0PCzGp+Lu5WEKwms+ROd6b8jf48h93S0HiJshFvb4YB5vIy9RStXC203G0ZR415G oQ7ex30NroPtb260nYyi+n6k+Jp0POLwXzgzbljvBlaqdTDgsl5kJL2klbbGeUg= =U4KO -----END PGP SIGNATURE-----

OK, thank you very much! besides, is it possible to get the cypher key for decoding the tcpdump captured packets on the TOR client?? 2012/10/30 Damian Johnson <atagar@torproject.org>
Hi, I'm new to Tor controller,
Tor client usually open 3 circuits, one for current use and the other 2 for standby.
Tor will change the current circuit/path in use from time to time, depending on the network load dynamics
I'm wondering whether it is possible to use Tor controller to detect when the circuit/path in use is changed and obtain the list of IP addresses of those relay nodes.
Hi esolve. I'm pretty sure that you'll simply want to write a script that listens for CIRC events... https://gitweb.torproject.org/torspec.git/blob/HEAD:/control-spec.txt#l1232
The main controller libraries at present are...
- txtorcon (https://txtorcon.readthedocs.org/en/latest/) - controller library for twisted apps - stem (https://stem.readthedocs.org/en/latest/index.html) - general controller library that'll replace TorCtl - torctl (https://gitweb.torproject.org/pytorctl.git/) - the original and most stable controller library
If you want an example for using stem then I'd be happy to write you one later. Ravi and I are currently working to improve its event handling support so it's presently a bit rough for your use case, but still perfectly doable.
Cheers! -Damian _______________________________________________ tor-dev mailing list tor-dev@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-dev

oh, I don't understand this what you mean is, for example, when browsing webpages browser application sock Tor Ethernet interface send packet ----------> forward -------------> encrypt and -----------------> send to the entry node make tor cells receive packet<--------- forward<-------------- decrypt tor cells <--------------- receive from the entry node tcpdump -i eth0(this is my capturing) but you mean I can capture between the browser application and the sock? so I used tcpdump on the ethernet interface the packets are encrypted you mean I can capture the packets before 2012/10/31 Damian Johnson <atagar@torproject.org>
OK, thank you very much! besides, is it possible to get the cypher key for decoding the tcpdump captured packets on the TOR client??
I don't follow, do you mean the traffic between tor and the first hop? Why not just intercept the communication with the socks port? _______________________________________________ tor-dev mailing list tor-dev@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-dev

On Wed, Oct 31, 2012 at 12:17:58PM +0100, esolve esolve wrote:
oh, I don't understand this
what you mean is, for example, when browsing webpages
browser application sock Tor Ethernet interface
send packet ----------> forward -------------> encrypt and -----------------> send to the entry node
make tor cells
receive packet<--------- forward<-------------- decrypt tor cells <--------------- receive from the entry node
tcpdump -i eth0(this is my capturing)
but you mean I can capture between the browser application and the sock?
so I used tcpdump on the ethernet interface the packets are encrypted you mean I can capture the packets before
Yes. capture on the lo interface, on whatever port your Tor SOCKS proxy is listening on. - Ian
participants (4)
-
Damian Johnson
-
esolve esolve
-
Ian Goldberg
-
meejah@meejah.ca