commit e8058852a049f30f90520041e497d9277c1825e9 Author: Arturo Filastò art@fuffa.org Date: Sat Nov 10 18:17:49 2012 +0100
Finish implementing multi port traceroute for UDP and TCP --- nettests/core/traceroute.py | 8 +++----- ooni/utils/txscapy.py | 7 +------ 2 files changed, 4 insertions(+), 11 deletions(-)
diff --git a/nettests/core/traceroute.py b/nettests/core/traceroute.py index b14e013..23f124a 100644 --- a/nettests/core/traceroute.py +++ b/nettests/core/traceroute.py @@ -28,12 +28,11 @@ class TracerouteTest(scapyt.BaseScapyTest):
def test_tcp_traceroute(self): def finished(packets, port): - log.debug("Finished tcp %s" % port) + log.debug("Finished running TCP traceroute test" % port) answered, unanswered = packets self.report['hops_'+str(port)] = [] for snd, rcv in answered: report = {'ttl': snd.ttl, 'address': rcv.src} - log.debug("Writing %s" % report) self.report['hops_'+str(port)].append(report)
dl = [] @@ -47,12 +46,11 @@ class TracerouteTest(scapyt.BaseScapyTest):
def test_udp_traceroute(self): def finished(packets, port): - log.debug("Finished udp") + log.debug("Finished running udp traceroute test") answered, unanswered = packets - self.report['hops_'+str(port)].append(report) + self.report['hops_'+str(port)] = [] for snd, rcv in answered: report = {'ttl': snd.ttl, 'address': rcv.src} - log.debug("Writing %s" % report) self.report['hops_'+str(port)].append(report) dl = [] for port in self.dst_ports: diff --git a/ooni/utils/txscapy.py b/ooni/utils/txscapy.py index 2559d19..2b108ca 100644 --- a/ooni/utils/txscapy.py +++ b/ooni/utils/txscapy.py @@ -70,14 +70,10 @@ class ScapyProtocol(abstract.FileDescriptor): """
def processAnswer(self, packet, answer_hr): - log.debug("Got an answer processing it") + log.debug("Got a packet from %s" % packet.src) for i in range(len(answer_hr)): if packet.answers(answer_hr[i]): self.answered_packets.append((answer_hr[i], packet)) - if self.debug: - print packet.src, packet.ttl - #answer.show() - if not self.multi: del(answer_hr[i]) break @@ -87,7 +83,6 @@ class ScapyProtocol(abstract.FileDescriptor):
def doRead(self): timeout = time.time() - self._start_time - log.debug("Checking for timeout %s > %s" % (timeout, self.timeout)) if self.timeout and time.time() - self._start_time > self.timeout: self.stopSending() packet = self.super_socket.recv()
tor-commits@lists.torproject.org