@@ -0,0 +1,1126 @@
+import logging%0Aimport subprocess%0A%0A%0Aclass Tcpdump:%0A    def __init__(self, interface, buffer_size, pcap_size, pcap_timeout, output_filename, post_process=None):%0A        self._interface = interface%0A        self._buffer_size = buffer_size%0A        self._pcap_size = pcap_size%0A        self._pcap_timeout = pcap_timeout%0A        self._output_filename = output_filename%0A        self._post_process = post_process%0A%0A        self._log = logging.getLogger(__name__)%0A%0A    def make_command(self):%0A        cmd = %5B%22tcpdump%22,%0A                %22-pni%22, self._interface,%0A                %22-B%22, str(self._buffer_size),%0A                %22-C%22, str(self._pcap_size),%0A                %22-G%22, str(self._pcap_timeout),%0A                %22-w%22, %22'%7B%7D'%22.format(self._output_filename)%5D%0A%0A        if self._post_process:%0A            cmd += %5B%22-z%22, self._post_process%5D%0A%0A        return cmd%0A%0A    def popen(self, **kwargs):%0A        cmd = self.make_command()%0A        self._log.debug(%22 %22.join(cmd))%0A%0A        return subprocess.Popen(cmd)%0A%0Aif __name__ == %22__main__%22:%0A    tcpdump = Tcpdump(%22enp0s3%22, 10240, 50, 60, %22/tmp/%25s.pcap%22)%0A    process = tcpdump.popen()%0A    process.wait()%0A

add a tcpdump wrapper