[tor-commits] [stem/master] FAQ entry about how to get information about your present exits

atagar at torproject.org atagar at torproject.org
Sun Jun 16 03:40:54 UTC 2013


commit e8a278cfed828be68d83486deefbff86fb548b0d
Author: Damian Johnson <atagar at torproject.org>
Date:   Sat Jun 15 20:40:01 2013 -0700

    FAQ entry about how to get information about your present exits
    
    Answer for a question I like on Stack Overflow...
    
    http://stackoverflow.com/questions/9777192/how-do-i-get-the-tor-exit-node-ip-address-over-the-control-port
---
 docs/faq.rst |   54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 54 insertions(+)

diff --git a/docs/faq.rst b/docs/faq.rst
index f86bdda..b10e01a 100644
--- a/docs/faq.rst
+++ b/docs/faq.rst
@@ -12,6 +12,7 @@ Frequently Asked Questions
 * **Tasks**
 
  * :ref:`how_do_i_request_a_new_identity_from_tor`
+ * :ref:`how_do_i_get_information_about_my_exits`
 
 * **Development**
 
@@ -106,6 +107,59 @@ And with stem...
 
 For lower level control over Tor's circuits and path selection see the `client usage tutorial <tutorials/to_russia_with_love.html>`_.
 
+.. _how_do_i_get_information_about_my_exits:
+
+How do I get information about my exits?
+----------------------------------------
+
+To learn about the Tor relays you're presently using call :func:`stem.control.Controller.get_circuits`. The last relay in the circuit's path is your exit...
+
+::
+
+  from stem import CircStatus
+  from stem.control import Controller
+
+  with Controller.from_port(port = 9051) as controller:
+    controller.authenticate()
+
+    for circ in controller.get_circuits():
+      if circ.status != CircStatus.BUILT:
+        continue
+
+      exit_fp, exit_nickname = circ.path[-1]
+
+      exit_desc = controller.get_network_status(exit_fp, None)
+      exit_address = exit_desc.address if exit_desc else 'unknown'
+
+      print "Exit relay"
+      print "  fingerprint: %s" % exit_fp
+      print "  nickname: %s" % exit_nickname
+      print "  address: %s" % exit_address
+      print
+
+::
+
+  % python example.py 
+  Exit relay
+    fingerprint: 94AD3437EC49A31E8D6C17CC3BDE8316C90262BE
+    nickname: davidonet
+    address: 188.165.236.209
+
+  Exit relay
+    fingerprint: 6042CC1C69BBFE83A1DD2BCD4C15000A0DD5E1BC
+    nickname: Gnome5
+    address: 178.209.50.230
+
+  Exit relay
+    fingerprint: 9634F910C2942A2E46720DD161A873E3A619AD90
+    nickname: veebikaamera
+    address: 81.21.246.66
+
+  Exit relay
+    fingerprint: A59E1E7C7EAEE083D756EE1FF6EC31CA3D8651D7
+    nickname: chaoscomputerclub19
+    address: 31.172.30.2
+
 Development
 ===========
 



More information about the tor-commits mailing list