Skip to content

is UPD Packet padding wrong?  #46

Description

@cherepanovic

https://github.com/munhouiani/Deep-Packet/blob/ce15b900772a6691cb1762c6ec5ad7f19edc222e/preprocessing.py#L33C1-L44C50

def pad_udp(packet):
    if UDP in packet:
        # get layers after udp
        layer_after = packet[UDP].payload.copy()

        # build a padding layer
        pad = Padding()
        pad.load = "\x00" * 12

        layer_before = packet.copy()
        layer_before[UDP].remove_payload()
        packet = layer_before / pad / layer_after

        return packet

    return packet

If the UDP Packet should be padded with 12 bytes immediately after the UDP header but before the payload, then this code does not do what it should. It pads after the entire UDP packet.

https://scapy.readthedocs.io/en/latest/usage.html#stacking-layers

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions