commit d2ea103d60d7cae54c75502e45c69038655ebcb7 Author: Arturo Filastò art@fuffa.org Date: Mon Aug 18 15:35:05 2014 +0200
Make it possible to run ooniprobe also without having dnet installed. --- ooni/director.py | 6 +++++- ooni/oonicli.py | 2 +- ooni/settings.py | 7 ++++--- 3 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/ooni/director.py b/ooni/director.py index 6ef4143..5ffee97 100644 --- a/ooni/director.py +++ b/ooni/director.py @@ -105,7 +105,11 @@ class Director(object): for filename in os.listdir(dirname): if is_nettest(filename): net_test_file = os.path.join(dirname, filename) - nettest = getNetTestInformation(net_test_file) + try: + nettest = getNetTestInformation(net_test_file) + except: + log.err("Error processing %s" % filename) + continue nettest['category'] = category.replace('/', '')
if nettest['id'] in nettests: diff --git a/ooni/oonicli.py b/ooni/oonicli.py index 4df542f..90dc89a 100644 --- a/ooni/oonicli.py +++ b/ooni/oonicli.py @@ -12,7 +12,6 @@ from ooni.settings import config from ooni.director import Director from ooni.deck import Deck, nettest_to_path from ooni.nettest import NetTestLoader -from ooni.utils.txscapy import ScapyFactory
from ooni.utils import log, checkForRoot
@@ -128,6 +127,7 @@ def runWithDirector(logging=True, start_tor=True, check_incoherences=True): if config.privacy.includepcap: try: checkForRoot() + from ooni.utils.txscapy import ScapyFactory config.scapyFactory = ScapyFactory(config.advanced.interface) except errors.InsufficientPrivileges: log.err("Insufficient Privileges to capture packets." diff --git a/ooni/settings.py b/ooni/settings.py index 674b4d3..a2a56b8 100644 --- a/ooni/settings.py +++ b/ooni/settings.py @@ -7,7 +7,6 @@ from twisted.internet import defer, reactor from twisted.internet.endpoints import TCP4ClientEndpoint, connectProtocol
from os.path import abspath, expanduser -from scapy.all import get_if_list
from ooni.utils.net import ConnectAndCloseProtocol from ooni import geoip @@ -119,8 +118,10 @@ class OConfig(object): def check_incoherences(self, configuration): incoherent = []
- if configuration['advanced']['interface'] != 'auto' and configuration['advanced']['interface'] not in get_if_list(): - incoherent.append('advanced:interface') + if configuration['advanced']['interface'] != 'auto': + from scapy.all import get_if_list + if configuration['advanced']['interface'] not in get_if_list(): + incoherent.append('advanced:interface')
self.log_incoherences(incoherent)
tor-commits@lists.torproject.org