[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [ooni-probe/master] set our own datadir so we can grab obfs4 logs
commit 8c06659922baf1db5e142a43cfcdd183f0716619
Author: Joe Landers <joe@xxxxxxxxxxxxxx>
Date: Fri Feb 27 16:11:11 2015 +0100
set our own datadir so we can grab obfs4 logs
---
ooni/nettests/blocking/bridge_reachability.py | 11 +++++++++++
ooni/tests/test_onion.py | 2 +-
ooni/utils/onion.py | 2 +-
3 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/ooni/nettests/blocking/bridge_reachability.py b/ooni/nettests/blocking/bridge_reachability.py
index aa1140a..8ec1bf9 100644
--- a/ooni/nettests/blocking/bridge_reachability.py
+++ b/ooni/nettests/blocking/bridge_reachability.py
@@ -2,6 +2,7 @@
import os
import random
import tempfile
+import shutil
from twisted.python import usage
from twisted.internet import reactor, error
@@ -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
@@ -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']))
@@ -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
diff --git a/ooni/tests/test_onion.py b/ooni/tests/test_onion.py
index fa608d6..6dce5fc 100644
--- a/ooni/tests/test_onion.py
+++ b/ooni/tests/test_onion.py
@@ -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):
diff --git a/ooni/utils/onion.py b/ooni/utils/onion.py
index b0638f8..6476636 100644
--- a/ooni/utils/onion.py
+++ b/ooni/utils/onion.py
@@ -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
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits