commit b97a99c9f9acba460d098b1c6241f625882d553b Author: Arturo Filastò art@fuffa.org Date: Fri Nov 9 13:26:56 2012 +0100
Add txscapy to the commit This should have been in the previous commit and I should not have tagged the release I must run git clean -r;./before_i_commit.sh; before pushing to master. Disregard the v0.0.2-alpha tag --- ooni/utils/txscapy.py | 40 ++++++++++++++++++++++++++++++++++++++++ 1 files changed, 40 insertions(+), 0 deletions(-)
diff --git a/ooni/utils/txscapy.py b/ooni/utils/txscapy.py new file mode 100644 index 0000000..a3a5610 --- /dev/null +++ b/ooni/utils/txscapy.py @@ -0,0 +1,40 @@ +# -*- coding:utf8 -*- +# txscapy +# ******* +# Here shall go functions related to using scapy with twisted. +# +# This software has been written to be part of OONI, the Open Observatory of +# Network Interference. More information on that here: http://ooni.nu/ + +import struct +import socket +import os +import sys +import time + +from twisted.internet import protocol, base, fdesc, error, defer +from twisted.internet import reactor, threads +from zope.interface import implements + +from scapy.all import Gen +from scapy.all import SetGen + +from ooni.utils import log + +from scapy.all import PcapWriter, MTU +from scapy.all import BasePacketList, conf, PcapReader + +class TXPcapWriter(PcapWriter): + def __init__(self, *arg, **kw): + PcapWriter.__init__(self, *arg, **kw) + fdesc.setNonBlocking(self.f) + +def txSniff(count=0, store=1, offline=None, + prn = None, lfilter=None, + L2socket=None, timeout=None, + opened_socket=None, stop_filter=None, + *arg, **karg): + """ + XXX we probably want to rewrite the scapy sniff function to better suite our needs. + """ +
tor-commits@lists.torproject.org