[tor-commits] [ooni-probe/master] Merge remote-tracking branch 'remotes/gsathya/check_public' into gsathya

art at torproject.org art at torproject.org
Thu Mar 1 05:17:19 UTC 2012


commit c916dba2f7d74f889496a3d5292e2126fd5c0898
Merge: 7b7ed0b 59e3e0e
Author: Arturo Filastò <hellais at gmail.com>
Date:   Wed Feb 29 21:17:31 2012 -0800

    Merge remote-tracking branch 'remotes/gsathya/check_public' into gsathya
    
    Conflicts:
    	tests/bridget.py

 tests/bridget.py |   28 +++++++++++++++++++++++++---
 1 files changed, 25 insertions(+), 3 deletions(-)

diff --cc tests/bridget.py
index c4515aa,772311c..52bff75
--- a/tests/bridget.py
+++ b/tests/bridget.py
@@@ -36,8 -37,7 +37,9 @@@ try
  except:
      print "Error TorCtl not installed!"
  
 +__plugoo__ = "BridgeT"
 +__desc__ = "BridgeT, for testing Tor Bridge reachability"
+ ONIONOO_URL="http://85.214.195.203/summary/search/"
  
  class SocksiPyConnection(httplib.HTTPConnection):
      def __init__(self, proxytype, proxyaddr, proxyport = None, rdns = True,
@@@ -180,7 -180,12 +182,12 @@@ ControlPort %
          for x in output.split("\n"):
              cfield = x.split(' ')
              if cfield[0] in fields:
+                 #not sure if hellais did this on purpose, but this overwrites
+                 #the previous entries. For ex, 'opt' has multiple entries and
+                 #only the last value is stored
 -                ret[cfield[0]] = ' '.join(cfield[1:]) 
 +                ret[cfield[0]] = ' '.join(cfield[1:])
+                 if cfield[1] == 'fingerprint':
+                     ret['fingerprint'] = ''.join(cfield[2:])
          return ret
  
      #Can't use @torify as it doesn't support concurrency right now
@@@ -195,7 -200,18 +202,18 @@@
          print (time_end-time_start)
          return str(256/(time_end-time_start)) + " KB/s"
  
+     def is_public(self, fp, socksport):
+         opener = urllib2.build_opener(SocksiPyHandler(socks.PROXY_TYPE_SOCKS5,'127.0.0.1',int(socksport)))
+         response = opener.open(str(ONIONOO_URL)+str(fp))
+         reply = json.loads(response.read())
+         if reply['bridges'] or reply['relays']:
+             return True
+         return False
 -            
++
      def connect(self, bridge, timeout=None):
+         bridgeinfo = None
+         bandwidth = None
+         public = None
          if not timeout:
              if self.config.tests.tor_bridges_timeout:
                  self.timeout = self.config.tests.tor_bridges_timeout



More information about the tor-commits mailing list