[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [ooni-probe/master] Add support for detecting bridge lines in tcp_connect test.



commit f9eba6162df21c5c2e0c5446105a772091bcd9c1
Author: Arturo Filastò <art@xxxxxxxxx>
Date:   Mon Sep 22 19:11:45 2014 +0200

    Add support for detecting bridge lines in tcp_connect test.
---
 ooni/nettests/blocking/tcp_connect.py |   13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/ooni/nettests/blocking/tcp_connect.py b/ooni/nettests/blocking/tcp_connect.py
index 852be68..1666ce3 100644
--- a/ooni/nettests/blocking/tcp_connect.py
+++ b/ooni/nettests/blocking/tcp_connect.py
@@ -67,13 +67,24 @@ class TCPConnectTest(nettest.NetTestCase):
             if proto == 'https':
                 return "%s:443" % host
 
+        pluggable_transports = ("obfs3", "obfs2", "fte", "scramblesuit")
+        def is_bridge_line(line):
+            first = line.split(" ")[0]
+            return first.lower() in pluggable_transports + ("bridge",)
+        def strip_bridge(line):
+            if line.lower().startswith("Bridge"):
+                return line.split(" ")[2]
+            return line.split(" ")[1]
+
         if filename:
             fp = open(filename)
             for x in fp.readlines():
                 if x.startswith("http"):
                     yield strip_url(x)
+                elif is_bridge_line(x):
+                    yield strip_bridge(x)
                 else:
-                    yield x.strip()
+                    yield x.split(" ")[0]
             fp.close()
         else:
             pass



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits