[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [ooni-probe/master] Handle the case in which we do not get a DNS lookup response and include it in the report



commit b2b2b54306f503335cc52edc82426baea45da242
Author: Arturo Filastò <art@xxxxxxxxx>
Date:   Sun Nov 25 16:30:17 2012 +0100

    Handle the case in which we do not get a DNS lookup response and include it in the report
---
 nettests/core/dnsspoof.py |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/nettests/core/dnsspoof.py b/nettests/core/dnsspoof.py
index 48991ea..5c50c2f 100644
--- a/nettests/core/dnsspoof.py
+++ b/nettests/core/dnsspoof.py
@@ -38,8 +38,13 @@ class DNSSpoof(scapyt.ScapyTest):
         This is not tested, but the concept is that if the two responses
         match up then spoofing is occuring.
         """
-        test_answer = report['test_a_lookup']['answered_packets'][0][1]
-        control_answer = report['test_control_a_lookup']['answered_packets'][0][1]
+        try:
+            test_answer = report['test_a_lookup']['answered_packets'][0][1]
+            control_answer = report['test_control_a_lookup']['answered_packets'][0][1]
+        except IndexError:
+            self.report['spoofing'] = 'no_answer'
+            return
+
         if test_answer[UDP] == control_answer[UDP]:
                 self.report['spoofing'] = True
         else:



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits