Packet monitors
- class whad.common.monitors.PcapWriterMonitor(pcap_file, monitor_reception=True, monitor_transmission=True, append=True)[source]
PcapWriterMonitor.
Monitor allowing to export the traffic transmitted and received by the targeted connector to a PCAP file with appropriate header.
- Usage:
>>> monitor = PcapWriterMonitor("mypcapfile.pcap") >>> monitor.attach(connector) >>> monitor.start()
- default_formatter(packet)[source]
Formatter used by default, if no formatter is found in the targeted connector. It only extracts the accurate timestamp if one is available in metadata.
- property packets_written
Return the number of packets already written
- class whad.common.monitors.WiresharkMonitor(monitor_reception=True, monitor_transmission=True)[source]
WiresharkMonitor.
Runs a wireshark instance in background and monitor the traffic received and transmitted by the targeted connector. It is mainly a very basic wrapper that launches wireshark in background, creates a named fifo and populates it using underlying PcapWriterMonitor implementation.