<html><head><meta http-equiv="Content-Type" content="text/html charset=iso-8859-1"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Damian, thanks, this is very helpful. <div><br></div><div>is there a way to do this in torrc? Else, i suppose i will need to:</div><div><br></div><div>1) create a socket or connection to my port 9051 ; do i need/can i use <span style="white-space: pre-wrap; ">TORRC_CONTROL_SOCKET ?</span></div><div>2) call get_circuits()<span class="Apple-tab-span" style="white-space: pre; ">                                        </span> ; grab the relay fingerprints</div><div><span class="Apple-tab-span" style="white-space: pre; ">  </span>Do I need <span style="white-space: pre-wrap; ">circuit = controller.get_circuit(circ_id)</span></div><div>3) <span style="white-space: pre-wrap; ">return class:`stem.events.CircuitEvent` <span class="Apple-tab-span" style="white-space: pre; "> </span> ; for the given circuit</span></div><div><span class="Apple-tab-span" style="white-space: pre; ">     </span>Not sure whether or where to use the "path" attribute</div><div>4) call <span style="white-space: pre-wrap; ">controller.</span>get_network_status() to get IP address, nickname, ORPort, </div><div><span class="Apple-tab-span" style="white-space: pre; ">  </span>Should I use:</div><div><span style="white-space: pre-wrap; "><span class="Apple-tab-span" style="white-space: pre; ">               </span>desc_by_fingerprint = controller.get_network_status(test_relay.fingerprint)</span></div><pre style="white-space: pre-wrap; "><span class="Apple-tab-span" style="white-space: pre; ">        </span>+      desc_by_nickname = controller.get_network_status(test_relay.nickname)</pre><div>5) use Maxmind- i already have the GeoIPLite DB to grab AS and country, and onion code also from Arturo</div><div><br></div><div><br></div><div>Any guidance is appreciated<br><div><br></div><div><br></div><div><a href="https://lists.torproject.org/pipermail/tor-commits/2012-December/051174.html">https://lists.torproject.org/pipermail/tor-commits/2012-December/051174.html</a></div><div><pre style="white-space: pre-wrap; ">get_circuit(self, circuit_id, default = UNDEFINED):
+    """
+    Provides a circuit presently available from tor.
+    
+    :param int circuit_id: circuit to be fetched
+    :param object default: response if the query fails
+    
+    :returns: :class:`stem.events.CircuitEvent` for the given circuit
+    
+    :raises:
+      * :class:`stem.ControllerError` if the call fails
+      * ValueError if the circuit doesn't exist
+      
+      An exception is only raised if we weren't provided a default response.
+    """
+    
+    try:
+      for circ in self.get_circuits():
+        if circ.id == circuit_id:
+          return circ
+      
+      raise ValueError("Tor presently does not have a circuit with the id of '%s'" % circuit_id)
+    except Exception, exc:
+      if default: return default
+      else: raise exc
+  
   def get_circuits(self):
     """
     Provides the list of circuits Tor is currently handling.</pre></div></div><div><br></div><div><div>On Jun 10, 2013, at 10:34 AM, Damian Johnson <<a href="mailto:atagar@torproject.org">atagar@torproject.org</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><blockquote type="cite">Hi, Damian, thanks. I am happy to discuss it on tor-dev@. But I want to keep<br>off spam, which some of my questions at first may be, essentially Qs. But,<br>if you think they would be of interest to tor-dev, or others could help,<br>just let me know, and i will sign up for it.<br></blockquote><br>They certainly are! If you're interested in tor and development then I<br>would definitely suggest being on that list. Including it for this<br>thread.<br><br><blockquote type="cite">I am trying to figure out how to pull in the nodes that are actually used in<br>my Tor circuits. They are the nodes reflected in the Network map function.<br></blockquote><br>You want the get_circuits() method. As you mentioned the 'path'<br>attribute has the relays in your present circuits...<br><br><a href="https://stem.torproject.org/api/control.html#stem.control.Controller.get_circuits">https://stem.torproject.org/api/control.html#stem.control.Controller.get_circuits</a><br><br><blockquote type="cite">I have created a MySql DB of some of my Tor circuits and nodes which i am<br>analyzing. I grabbed 48 circuits with their 144 nodes and info (IP address,<br>nickname, country) manually from my laptop's Tor network map.<br></blockquote><br>That certainly sounds painful. The circuit paths will provide the<br>relay fingerprints which you can use for get_network_status() to get<br>the address, nickname, ORPort, etc...<br><br>https://stem.torproject.org/api/control.html#stem.control.Controller.get_network_status<br><br>As for locales that would be done via get_info('ip-to-country/<address>')...<br><br>https://gitweb.torproject.org/torspec.git/blob/HEAD:/control-spec.txt#l672<br><br><blockquote type="cite">... and ultimately to AS and country.<br></blockquote><br>AS will require the Maxmind AS database or something else. I know that<br>Onionoo includes the AS information so the options that come to mind<br>are either to (a) see how it does it or (b) query Onionoo for this<br>information.<br><br>https://onionoo.torproject.org/<br><br><blockquote type="cite">And i have read much of the control-spec, don't know how much is out of date<br></blockquote><br>The control-spec should be up to date. If there are any inaccuracies<br>then please let us know!<br><br>Did you have any other questions? -Damian<br><br>On Mon, Jun 10, 2013 at 4:44 AM, SARAH CORTES <sarah@lewis.is> wrote:<br><blockquote type="cite">Hi, Damian, thanks. I am happy to discuss it on tor-dev@. But I want to keep<br>off spam, which some of my questions at first may be, essentially Qs. But,<br>if you think they would be of interest to tor-dev, or others could help,<br>just let me know, and i will sign up for it.<br><br>For example, I am trying to figure out how to pull in the nodes that are<br>actually used in my Tor circuits. They are the nodes reflected in the<br>Network map function. I have read your fine stem tutorials, it is so<br>impressive you have dome so much work and documentation on your own<br>initiative. It is certainly a huge help to me and otter researchers like me.<br><br>I have created a MySql DB of some of my Tor circuits and nodes which i am<br>analyzing. I grabbed 48 circuits with their 144 nodes and info (IP address,<br>nickname, country) manually from my laptop's Tor network map. I am analyzing<br>their country, so I am seeking to map nickname or fingerprint of the node to<br>IP address and ultimately to AS and country. Ultimately, I am analyzing<br>jurisdictional arbitrage and the hostility factors of differ countries to<br>Tor traffic, and whether it is possible to incorporate country or AS in to<br>the Tor path algorithm.<br><br>I can see the entry guard nicknames and fingerprints in my state file and<br>pick them up there, if necessary. Wish i could just edit the logs to display<br>all nodes, then figure out how to map the node fingerprint or nickname to<br>its IP address them AS and country. I understand there is a Tor atlas<br>function but have not read it carefully yet.<br><br>I have read documentation on the contents of the consensus file, the<br>descriptors, geoip and state files, and played around with them a bit to<br>understand them. I grasp that a fingerprint is a hash of the node's public<br>key, and one or both of which seem to be the most reliable ID for a node.<br><br>I can see from your documentation that variable path(nickname, fingerprint)<br>contains the data i want. Just need to be able to get that data easily. Not<br>sure if editing my torrc file is the way or what. If you have any<br>suggestions, they are much appreciated.<br><br>And i have read much of the control-spec, don't know how much is out of date<br>https://gitweb.torproject.org/torspec.git/blob/HEAD:/control-spec.txt<br><br>I have read this on modifying torrc, and played around with modifying torrc,<br>on an elementary basis:<br>https://www.torproject.org/docs/faq.html.en#torrc<br><br>and some tickets on modifying torrc<br>https://trac.torproject.org/projects/tor/ticket/6147<br><br>and what I believe is your excellent documentation on stem events;<br>https://stem.torproject.org/api/response.html#stem.response.events.BandwidthEvent<br><br><br><br><br><br><br><br>On Jun 8, 2013, at 2:31 PM, Damian Johnson <atagar@torproject.org> wrote:<br><br>Hi Sarah. Yup, I'd be more than happy to help if you have any stem<br>questions. Email would definitely be better since we look to keep<br>missing each other on irc. I'd appreciate it though if we discussed it<br>on the tor-dev@ email list...<br><br>https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-dev<br><br>On Sat, Jun 8, 2013 at 3:42 AM, SARAH CORTES <sarah@lewis.is> wrote:<br><br>Hi Damian, I'm Sarah Cortes, a researcher. I tried you on irc on #tor-dev<br>but was unable to reach you. We met at the tor dev meeting which i attended<br>in March. I have some Qs for you regarding stem. Please let me know if you<br>are available, thanks<br><br><br></blockquote></blockquote></div><br></body></html>