wltrace.wltrace module

Wireless Packet Trace

This module can load a packet trace, and yields a sequence of packets. Currently, only IEEE 802.11 (aka Wifi) pakcet traces saved in Pcap or Omnipeek’s peek-tagged format are supported. For Pcap format, this module can parse the Radiotap header if exists.

wltrace.wltrace.FILE_TYPE_HANDLER = {'\xd4\xc3\xb2\xa1': <class 'wltrace.pcap.PcapCapture'>, '\xa1\xb2\xc3\xd4': <class 'wltrace.pcap.PcapCapture'>, '\x7fver': <class 'wltrace.peektagged.PeektaggedCapture'>, 'M<\xb2\xa1': <class 'wltrace.pcap.PcapCapture'>, '\xa1\xb2<M': <class 'wltrace.pcap.PcapCapture'>}

A map from magic bytes to file handler.

wltrace.wltrace.MAGIC_LEN = 4

File type magic length in bytes.

wltrace.wltrace.is_packet_trace(path)[source]

Determine if a file is a packet trace that is supported by this module.

Parameters:path (str) – path to the trace file.
Returns:True if the file is a valid packet trace.
Return type:bool
wltrace.wltrace.load_trace(path, *args, **kwargs)[source]

Read a packet trace file, return a wltrace.common.WlTrace object.

This function first reads the file’s magic (first FILE_TYPE_HANDLER bytes), and automatically determine the file type, and call appropriate handler to process the file.

Parameters:path (str) – the file’s path to be loaded.
Returns:WlTrace object.