Loading ooni/nettests/blocking/bridge_reachability.py +11 −0 Original line number Diff line number Diff line Loading @@ -2,6 +2,7 @@ import os import random import tempfile import shutil from twisted.python import usage from twisted.internet import reactor, error Loading Loading @@ -53,6 +54,7 @@ class BridgeReachability(nettest.NetTestCase): os.close(fd) fd, self.obfsproxy_logfile = tempfile.mkstemp() os.close(fd) self.tor_datadir = tempfile.mkdtemp() self.report['error'] = None self.report['success'] = None Loading Loading @@ -123,6 +125,7 @@ class BridgeReachability(nettest.NetTestCase): config = txtorcon.TorConfig() config.ControlPort = random.randint(2**14, 2**16) config.SocksPort = random.randint(2**14, 2**16) config.DataDirectory = self.tor_datadir log.msg( "Connecting to %s with tor %s" % (self.bridge, onion.tor_details['version'])) Loading Loading @@ -208,5 +211,13 @@ class BridgeReachability(nettest.NetTestCase): with open(self.obfsproxy_logfile) as f: self.report['obfsproxy_log'] = f.read() os.remove(self.obfsproxy_logfile) try: with open(os.path.join(self.tor_datadir, 'pt_state', 'obfs4proxy.log')) as f: self.report['obfsproxy_log'] = f.read() except: pass finally: shutil.rmtree(self.tor_datadir) return d ooni/tests/test_onion.py +1 −1 Original line number Diff line number Diff line Loading @@ -7,7 +7,7 @@ sample_transport_lines = { 'scramblesuit': 'scramblesuit exec /fakebin --log-min-severity info --log-file /log.txt managed', 'obfs2': 'obfs2 exec /fakebin --log-min-severity info --log-file /log.txt managed', 'obfs3': 'obfs3 exec /fakebin --log-min-severity info --log-file /log.txt managed', 'obfs4': 'obfs4 exec /fakebin' } 'obfs4': 'obfs4 exec /fakebin --enableLogging=true --logLevel=INFO' } class TestOnion(unittest.TestCase): Loading ooni/utils/onion.py +1 −1 Original line number Diff line number Diff line Loading @@ -99,7 +99,7 @@ _transport_line_templates = { _pyobfsproxy_line('obfs3', bin_loc, log_file), 'obfs4': lambda bin_loc, log_file: \ "obfs4 exec %s" % bin_loc } "obfs4 exec %s --enableLogging=true --logLevel=INFO" % bin_loc } class UnrecognizedTransport(Exception): pass Loading Loading
ooni/nettests/blocking/bridge_reachability.py +11 −0 Original line number Diff line number Diff line Loading @@ -2,6 +2,7 @@ import os import random import tempfile import shutil from twisted.python import usage from twisted.internet import reactor, error Loading Loading @@ -53,6 +54,7 @@ class BridgeReachability(nettest.NetTestCase): os.close(fd) fd, self.obfsproxy_logfile = tempfile.mkstemp() os.close(fd) self.tor_datadir = tempfile.mkdtemp() self.report['error'] = None self.report['success'] = None Loading Loading @@ -123,6 +125,7 @@ class BridgeReachability(nettest.NetTestCase): config = txtorcon.TorConfig() config.ControlPort = random.randint(2**14, 2**16) config.SocksPort = random.randint(2**14, 2**16) config.DataDirectory = self.tor_datadir log.msg( "Connecting to %s with tor %s" % (self.bridge, onion.tor_details['version'])) Loading Loading @@ -208,5 +211,13 @@ class BridgeReachability(nettest.NetTestCase): with open(self.obfsproxy_logfile) as f: self.report['obfsproxy_log'] = f.read() os.remove(self.obfsproxy_logfile) try: with open(os.path.join(self.tor_datadir, 'pt_state', 'obfs4proxy.log')) as f: self.report['obfsproxy_log'] = f.read() except: pass finally: shutil.rmtree(self.tor_datadir) return d
ooni/tests/test_onion.py +1 −1 Original line number Diff line number Diff line Loading @@ -7,7 +7,7 @@ sample_transport_lines = { 'scramblesuit': 'scramblesuit exec /fakebin --log-min-severity info --log-file /log.txt managed', 'obfs2': 'obfs2 exec /fakebin --log-min-severity info --log-file /log.txt managed', 'obfs3': 'obfs3 exec /fakebin --log-min-severity info --log-file /log.txt managed', 'obfs4': 'obfs4 exec /fakebin' } 'obfs4': 'obfs4 exec /fakebin --enableLogging=true --logLevel=INFO' } class TestOnion(unittest.TestCase): Loading
ooni/utils/onion.py +1 −1 Original line number Diff line number Diff line Loading @@ -99,7 +99,7 @@ _transport_line_templates = { _pyobfsproxy_line('obfs3', bin_loc, log_file), 'obfs4': lambda bin_loc, log_file: \ "obfs4 exec %s" % bin_loc } "obfs4 exec %s --enableLogging=true --logLevel=INFO" % bin_loc } class UnrecognizedTransport(Exception): pass Loading