[or-cvs] r20292: {torflow} Fix misc issues with idhex vs router vs nick usage when usin (torflow/trunk/NetworkScanners/ExitAuthority)

mikeperry at seul.org mikeperry at seul.org
Fri Aug 14 21:42:24 UTC 2009


Author: mikeperry
Date: 2009-08-14 17:42:23 -0400 (Fri, 14 Aug 2009)
New Revision: 20292

Modified:
   torflow/trunk/NetworkScanners/ExitAuthority/soat.py
Log:

Fix misc issues with idhex vs router vs nick usage when using
the new scanhandler code.



Modified: torflow/trunk/NetworkScanners/ExitAuthority/soat.py
===================================================================
--- torflow/trunk/NetworkScanners/ExitAuthority/soat.py	2009-08-14 21:15:31 UTC (rev 20291)
+++ torflow/trunk/NetworkScanners/ExitAuthority/soat.py	2009-08-14 21:42:23 UTC (rev 20292)
@@ -67,6 +67,10 @@
 
 from soat_config import *
 
+# XXX: really need to standardize on $idhex or idhex :(
+# The convention in TorCtl is that nicks have no $, and ids have $.
+# We should be using that here too...
+
 search_cookies=None
 scanhdlr=None
 datahandler=None
@@ -445,7 +449,7 @@
                      self.nodes))
 
   def mark_chosen(self, node, result):
-    exit_node = scanhdlr.get_exit_node()[1:]
+    exit_node = scanhdlr.get_exit_node().idhex
     if exit_node != node:
       plog("ERROR", "Asked to mark a node that is not current: "+node+" vs "+exit_node)
     plog("INFO", "Marking "+node+" with result "+str(result))
@@ -800,7 +804,7 @@
     for cookie in self.cookie_jar:
       plain_cookies += "\t"+cookie.name+":"+cookie.domain+cookie.path+" discard="+str(cookie.discard)+"\n"
     if tor_cookies != plain_cookies:
-      exit_node = scanhdlr.get_exit_node()
+      exit_node = "$"+scanhdlr.get_exit_node().idhex
       plog("ERROR", "Cookie mismatch at "+exit_node+":\nTor Cookies:"+tor_cookies+"\nPlain Cookies:\n"+plain_cookies)
       result = CookieTestResult(self.node_map[exit_node[1:]],
                           TEST_FAILURE, FAILURE_COOKIEMISMATCH, plain_cookies, 
@@ -991,7 +995,7 @@
     # reset the connection to direct
     socket.socket = defaultsocket
 
-    exit_node = scanhdlr.get_exit_node()
+    exit_node = "$"+scanhdlr.get_exit_node().idhex
     if exit_node == 0 or exit_node == '0' or not exit_node:
       plog('NOTICE', 'We had no exit node to test, skipping to the next test.')
       result = HttpTestResult(None, 
@@ -1783,7 +1787,7 @@
     # reset the connection method back to direct
     socket.socket = defaultsocket
 
-    exit_node = scanhdlr.get_exit_node()
+    exit_node = "$"+scanhdlr.get_exit_node().idhex
     if not exit_node or exit_node == '0':
       plog('NOTICE', 'We had no exit node to test, skipping to the next test.')
       result = SSLTestResult(None, 
@@ -1980,7 +1984,7 @@
     socket.socket = defaultsocket
 
     # check whether the test was valid at all
-    exit_node = scanhdlr.get_exit_node()
+    exit_node = "$"+scanhdlr.get_exit_node().idhex
     if exit_node == 0 or exit_node == '0':
       plog('INFO', 'We had no exit node to test, skipping to the next test.')
       return TEST_INCONCLUSIVE
@@ -2121,7 +2125,7 @@
     socket.socket = defaultsocket 
 
     # check whether the test was valid at all
-    exit_node = scanhdlr.get_exit_node()
+    exit_node = "$"+scanhdlr.get_exit_node().idhex
     if exit_node == 0 or exit_node == '0':
       plog('INFO', 'We had no exit node to test, skipping to the next test.')
       return TEST_INCONCLUSIVE
@@ -2257,7 +2261,7 @@
     socket.socket = defaultsocket 
 
     # check whether the test was valid at all
-    exit_node = scanhdlr.get_exit_node()
+    exit_node = "$"+scanhdlr.get_exit_node().idhex
     if exit_node == 0 or exit_node == '0':
       plog('NOTICE', 'We had no exit node to test, skipping to the next test.')
       return TEST_INCONCLUSIVE
@@ -2345,7 +2349,7 @@
     ip = tor_resolve(address)
 
     # check whether the test was valid at all
-    exit_node = scanhdlr.get_exit_node()
+    exit_node = "$"+scanhdlr.get_exit_node().idhex
     if exit_node == 0 or exit_node == '0':
       plog('INFO', 'We had no exit node to test, skipping to the next test.')
       return TEST_SUCCESS
@@ -2419,7 +2423,7 @@
       for network in ipv4_nonpublic:
         if ipbin[:len(network)] == network:
           handler = DataHandler()
-          node = self.__mt.get_exit_node()
+          node = "$"+self.__mt.get_exit_node().idhex
           plog("ERROR", "DNS Rebeind failure via "+node)
 
           result = DNSRebindTestResult(self.__mt.node_manager.idhex_to_r(node), 
@@ -2737,7 +2741,7 @@
       current_exit_idhex = random.choice(list(common_nodes))
       plog("DEBUG", "Chose to run "+str(n_tests)+" tests via "+current_exit_idhex+" (tests share "+str(len(common_nodes))+" exit nodes)")
 
-      scanhdlr.set_exit_node(current_exit_idhex)
+      scanhdlr.set_exit_node("$"+current_exit_idhex)
       scanhdlr.new_exit()
       for test in to_run:
         result = test.run_test()
@@ -2751,7 +2755,7 @@
       for test in to_run:
         if test.finished(): continue
         current_exit = test.get_node()
-        scanhdlr.set_exit_node(current_exit.idhex)
+        scanhdlr.set_exit_node("$"+current_exit.idhex)
         scanhdlr.new_exit()
         result = test.run_test()
         if result != TEST_INCONCLUSIVE: 



More information about the tor-commits mailing list