scapy.layers.ppi

CACE Per-Packet Information (PPI) header.

A method for adding metadata to link-layer packets.

For example, one can tag an 802.11 packet with GPS coordinates of where it was captured, and include it in the PCAP file.

New PPI types should:

  • Make their packet a subclass of PPI_Element

  • Call bind_layers(PPI_Hdr, ExamplePPI, pfh_type=0xffff)

See layers/contrib/ppi_cace.py for an example.

class scapy.layers.ppi.PPI(_pkt, /, *, version=0, flags=0, len=None, dlt=None, headers=[])[source]

Bases: Packet

add_payload(payload)[source]
aliastypes = [<class 'scapy.layers.ppi.PPI'>, <class 'scapy.packet.Packet'>]
fields_desc: ClassVar[List[Field[Any, Any] | _FieldContainer]] = [<ByteField (PPI).version>, <ByteField (PPI).flags>, <FieldLenField (PPI).len>, <LEIntField (PPI).dlt>, <PacketListField (PPI).headers>]
guess_payload_class(payload)[source]
class scapy.layers.ppi.PPI_Element(_pkt, /)[source]

Bases: Packet

Superclass for all PPI types.

aliastypes = [<class 'scapy.layers.ppi.PPI_Element'>, <class 'scapy.packet.Packet'>]
extract_padding(s)[source]
static length_from(pkt)[source]
class scapy.layers.ppi.PPI_Hdr(_pkt, /, *, pfh_type=0, pfh_length=None)[source]

Bases: Packet

aliastypes = [<class 'scapy.layers.ppi.PPI_Hdr'>, <class 'scapy.packet.Packet'>]
fields_desc: ClassVar[List[Field[Any, Any] | _FieldContainer]] = [<LEShortEnumField (PPI_Hdr).pfh_type>, <LenField (PPI_Hdr).pfh_length>]
mysummary()[source]
payload_guess: List[Tuple[Dict[str, Any], Type[Packet]]] = [({'pfh_type': 30006}, <class 'scapy.layers.bluetooth4LE.BTLE_PPI'>), ({'pfh_type': 2}, <class 'scapy.contrib.ppi_cace.PPI_Dot11Common'>), ({'pfh_type': 30002}, <class 'scapy.contrib.ppi_geotag.PPI_Geotag_GPS'>), ({'pfh_type': 30003}, <class 'scapy.contrib.ppi_geotag.PPI_Geotag_Vector'>), ({'pfh_type': 30004}, <class 'scapy.contrib.ppi_geotag.PPI_Geotag_Sensor'>), ({'pfh_type': 30005}, <class 'scapy.contrib.ppi_geotag.PPI_Geotag_Antenna'>)]