commit 05953ba5d3a1f69bd93875ef1e8482349dfaac0b
Author: Arturo Filastò <[email protected]>
Date:   Mon Jan 13 13:11:51 2014 +0100

    Automatically determine the test resolvers to use by reading 
/etc/resolv.conf
---
 ooni/nettests/blocking/dnsconsistency.py |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/ooni/nettests/blocking/dnsconsistency.py 
b/ooni/nettests/blocking/dnsconsistency.py
index f10a48c..49e5360 100644
--- a/ooni/nettests/blocking/dnsconsistency.py
+++ b/ooni/nettests/blocking/dnsconsistency.py
@@ -53,7 +53,12 @@ class DNSConsistencyTest(dnst.DNSTest):
     def setUp(self):
         if (not self.localOptions['testresolvers'] and \
                 not self.localOptions['testresolver']):
-            raise usage.UsageError("You did not specify a testresolver")
+            self.test_resolvers = []
+            with open('/etc/resolv.conf') as f:
+                for line in f:
+                    if line.startswith('nameserver'):
+                        self.test_resolvers.append(line.split(' ')[1].strip())
+            self.report['test_resolvers'] = self.test_resolvers
 
         elif self.localOptions['testresolvers']:
             test_resolvers_file = self.localOptions['testresolvers']



_______________________________________________
tor-commits mailing list
[email protected]
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits

Reply via email to