[tor-commits] [stem/master] Adding example for listing outdated relays

atagar at torproject.org atagar at torproject.org
Wed Mar 26 16:59:02 UTC 2014


commit 79e924a9e7dc2f193c1869e9e36aea20292e076a
Author: Damian Johnson <atagar at torproject.org>
Date:   Wed Mar 26 09:18:40 2014 -0700

    Adding example for listing outdated relays
    
    Adding our script from ticket 9476 which prints contact information for relays
    prior to a given version. I picked example output that was especially obscured
    addresses, then modified them further to make them useless to scrapers. ;)
---
 docs/contents.rst                                 |    1 +
 docs/tutorials/double_double_toil_and_trouble.rst |    4 +++
 docs/tutorials/examples/outdated_relays.rst       |   40 +++++++++++++++++++++
 3 files changed, 45 insertions(+)

diff --git a/docs/contents.rst b/docs/contents.rst
index 70eda0f..4d79639 100644
--- a/docs/contents.rst
+++ b/docs/contents.rst
@@ -14,6 +14,7 @@ Contents
 
    tutorials/examples/compare_flags
    tutorials/examples/exit_used
+   tutorials/examples/outdated_relays
 
    change_log
    download
diff --git a/docs/tutorials/double_double_toil_and_trouble.rst b/docs/tutorials/double_double_toil_and_trouble.rst
index 093592e..7e39eb8 100644
--- a/docs/tutorials/double_double_toil_and_trouble.rst
+++ b/docs/tutorials/double_double_toil_and_trouble.rst
@@ -63,6 +63,10 @@ Client Usage
 Descriptors
 -----------
 
+* `List Outdated Relays <examples/outdated_relays.html>`_
+
+  Prints contact information for relays prior to a given version.
+
 * `Comparing Directory Authority Flags <examples/compare_flags.html>`_
 
   Compares the votes of two directory authorities, in this case moria1 and
diff --git a/docs/tutorials/examples/outdated_relays.rst b/docs/tutorials/examples/outdated_relays.rst
new file mode 100644
index 0000000..8e11258
--- /dev/null
+++ b/docs/tutorials/examples/outdated_relays.rst
@@ -0,0 +1,40 @@
+List Outdated Relays
+====================
+
+Time marches on. Tor makes new releases, and at some point needs to drop support for old ones. Below is the script we used on :trac:`9476` to reach out to relay operators that needed to upgrade.
+
+::
+
+  from stem.descriptor.remote import DescriptorDownloader
+  from stem.version import Version
+
+  downloader = DescriptorDownloader()
+  count, with_contact = 0, 0
+
+  print "Checking for outdated relays..."
+  print
+
+  for desc in downloader.get_server_descriptors():
+    if desc.tor_version < Version('0.2.3.0'):
+      count += 1
+
+      if desc.contact:
+        print '  %-15s %s' % (desc.tor_version, desc.contact.decode("utf-8", "replace"))
+        with_contact += 1
+
+  print
+  print "%i outdated relays found, %i had contact information" % (count, with_contact)
+
+::
+
+  % python outdated_relays.py
+  Checking for outdated relays...
+
+    0.2.2.39        Random Person admin at gtr-10.de
+    0.2.2.36        dobrovich_psckaal at vietrievus dot ok
+    0.2.2.39        anonymous6 anonymous at mailinator.com
+    0.2.2.39        anonymous12 anonymous at mailinator.com
+    ...
+
+  316 outdated relays found, 120 had contact information
+





More information about the tor-commits mailing list