Search code examples
scapy

New Scapy layer


I am trying to add a new layer to Scapy. Unfortunately, I have been looking at many guides and other questions as well for answer but couldn't figure it out.

Currently this is my code:

from scapy.all import *

class HSR(Packet):
    name = "HSR"
    fields_desc = [
        BitField("path",0,4),
        BitField("network_id",0,4),
        BitField("lane_id",0,4),
        BitField("LSDU_size",0,4),
        ShortField("sequence_number",0),
        ShortField("type",0),
    ]

bind_layer(Ether,HSR)

This is the layer in Wireshark: Wireshark

And when I try to use the new layer in scapy, I get this error: Scapy Error


Solution

  • So apparently it only means that in my pcap file I have a package which does NOT contain the HSR layer and that is why I get that error message.