Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
* 'master' of https://github.com/TheTorProject/ooni-probe:
  Fix typo in dnstamper test example docs
  Properly handle errors when DNS lookups
  Fix typo in test writing documentation
  • Loading branch information
hellais committed Feb 7, 2013
2 parents 64e5801 + 96acbc4 commit bcb2794
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion docs/source/tests/dnstamper.rst
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Sample report
=============

From running:
`./bin/ooniprobe nettests/core/dnstamper.py -t test_inputs/dns_tamper_test_resolvers.txt -f test_inputs/http_host_file.txt`
`./bin/ooniprobe nettests/core/dnstamper.py -T test_inputs/dns_tamper_test_resolvers.txt -f test_inputs/http_host_file.txt`

::

Expand Down
4 changes: 2 additions & 2 deletions docs/source/writing_tests.rst
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ To implement a simple ICMP ping based on this function you can do like so
from ooni.templates import scapyt

class UsageOptions(usage.Options):
optParameters = [['target', 't', '8.8.8.8', "Specify the target to ping"]]
optParameters = [['target', 't', '127.0.0.1', "Specify the target to ping"]]

class ExampleICMPPingScapy(scapyt.BaseScapyTest):
name = "Example ICMP Ping Test"
Expand Down Expand Up @@ -205,7 +205,7 @@ regular sequential code.
from ooni.templates import scapyt

class UsageOptions(usage.Options):
optParameters = [['target', 't', self.localOptions['target'], "Specify the target to ping"]]
optParameters = [['target', 't', '127.0.0.1', "Specify the target to ping"]]

class ExampleICMPPingScapyYield(scapyt.BaseScapyTest):
name = "Example ICMP Ping Test"
Expand Down
9 changes: 8 additions & 1 deletion nettests/blocking/dnstamper.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,14 @@ def test_a_lookup(self):
log.msg("Testing resolver: %s" % test_resolver)
test_dns_server = (test_resolver, 53)

experiment_answers = yield self.performALookup(hostname, test_dns_server)
try:
experiment_answers = yield self.performALookup(hostname, test_dns_server)
except Exception, e:
log.err("Problem performing the DNS lookup")
log.exception(e)
self.report['tampering'][test_resolver] = 'dns_lookup_error'
continue

if not experiment_answers:
log.err("Got no response, perhaps the DNS resolver is down?")
self.report['tampering'][test_resolver] = 'no_answer'
Expand Down

0 comments on commit bcb2794

Please sign in to comment.