Skip to content

[enhancement] Provide a PayloadField class that eases the definition of packets with trailer data after the payload #4737

@alxroyer-thales

Description

@alxroyer-thales

This happens quite often when protocols include an integrity field at the end of the packet.

Example of proposal:

class A(Packet):
    def extract_padding(self, s):
        return b'', s

class B(Packet):
    def extract_padding(self, s):
        return b'', s

class M(Packet):
    fields_desc = [
        ByteField("type", default=0),
        PayloadField("pld"),
        XShortField("crc", default=0),
    ]
bind_layers(M, A, type=0x0A)
bind_layers(M, B, type=0x0B)

The same as we do for regular payloads.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions