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
fields_desc
Display RFC-like schema
 0                   1                   2                   3
 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|    VERSION    |     FLAGS     |              LEN              |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                              DLT                              |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|            HEADERS            |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

                             Fig. PPI                             
PPI fields

version

ByteField

0

flags

ByteField

0

len

FieldLenField

None

dlt

LEIntField

None

headers

PacketListField

[]

guess_payload_class(payload)[source]
class scapy.layers.ppi.PPI_Element(_pkt, /)[source]

Bases: Packet

Superclass for all PPI types.

aliastypes
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
fields_desc
Display RFC-like schema
 0                   1                   2                   3
 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|            PFH TYPE           |           PFH LENGTH          |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

                           Fig. PPI_Hdr                           
PPI_Hdr fields

pfh_type

LEShortEnumField

0

pfh_length

LenField

None

mysummary()[source]
payload_guess

Possible sublayers: PPI_Dot11Common, PPI_Geotag_Antenna, PPI_Geotag_GPS, PPI_Geotag_Sensor, PPI_Geotag_Vector, BTLE_PPI