[tor-commits] [ooni-probe/master] Pep8 fixes

art at torproject.org art at torproject.org
Tue Aug 12 18:08:13 UTC 2014


commit 49150087dded2885a9eb17d07c436fefe06c9104
Author: Arturo Filastò <art at fuffa.org>
Date:   Sun Aug 10 20:10:54 2014 +0200

    Pep8 fixes
---
 ooni/templates/scapyt.py |   35 +++++++++++++++++------------------
 1 file changed, 17 insertions(+), 18 deletions(-)

diff --git a/ooni/templates/scapyt.py b/ooni/templates/scapyt.py
index c6dedd7..925a9d6 100644
--- a/ooni/templates/scapyt.py
+++ b/ooni/templates/scapyt.py
@@ -1,26 +1,23 @@
-import random
-from zope.interface import implements
-from twisted.plugin import IPlugin
-from twisted.internet import protocol, defer, threads
-
-from scapy.all import send, sr, IP, TCP, config
-
-from ooni.reporter import createPacketReport
 from ooni.nettest import NetTestCase
 from ooni.utils import log
 from ooni.settings import config
 
-from ooni.utils.txscapy import ScapySender, getDefaultIface, ScapyFactory
+from ooni.utils.txscapy import ScapySender, ScapyFactory
 from ooni.utils.txscapy import hasRawSocketPermission
 
 
 class BaseScapyTest(NetTestCase):
+
     """
     The report of a test run with scapy looks like this:
 
     report:
-        sent_packets: [{'raw_packet': BASE64Encoding of packet,
-                        'summary': 'IP / TCP 192.168.2.66:ftp_data > 8.8.8.8:http S'}]
+        sent_packets: [
+            {
+            'raw_packet': BASE64Encoding of packet,
+            'summary': 'IP / TCP 192.168.2.66:ftp_data > 8.8.8.8:http S'
+            }
+        ]
 
         answered_packets: []
 
@@ -31,12 +28,12 @@ class BaseScapyTest(NetTestCase):
     requiresRoot = not hasRawSocketPermission()
     baseFlags = [
         ['ipsrc', 's',
-         'Does *not* check if IP src and ICMP IP citation matches when processing answers'],
+         'Does *not* check if IP src and ICMP IP citation '
+         'matches when processing answers'],
         ['seqack', 'k',
-         'Check if TCP sequence number and ACK match in the ICMP citation when processing answers'],
-        ['ipid', 'i',
-         'Check if the IPID matches when processing answers']
-    ]
+         'Check if TCP sequence number and ACK match in the '
+         'ICMP citation when processing answers'],
+        ['ipid', 'i', 'Check if the IPID matches when processing answers']]
 
     def _setUp(self):
         super(BaseScapyTest, self)._setUp()
@@ -84,8 +81,10 @@ class BaseScapyTest(NetTestCase):
             received_packet = rcv
 
             if not config.privacy.includeip:
-                log.debug("Detected you would not like to include your ip in the report")
-                log.debug("Stripping source and destination IPs from the reports")
+                log.debug("Detected you would not like to "
+                          "include your ip in the report")
+                log.debug(
+                    "Stripping source and destination IPs from the reports")
                 sent_packet.src = '127.0.0.1'
                 received_packet.dst = '127.0.0.1'
 





More information about the tor-commits mailing list