Is there a standard method for searching the data-portion of a packet for a
given layer?
I have started to build a decoder for EtherNet/IP. When I sniff packets I
usually need to filter for a given layer (ex. ForwardOpen etc). I did not find
a method for this so I created the following two methods in dpkt.Packet:
dpkt.Packet.HasLayer( LayerClass )
dpkt.Packet.GetLayer( LayerClass )
They are basically recursive methods that check the Type of the data attribute
of the packet.
The first one return True/False if the layer is located somewhere in the
current packet, and the second of course return the layer in question (The
first on actually run the second).
I'm running Python 2.7.5 on windows 7 and 1.8 of dpkt.
Original issue reported on code.google.com by anders.a...@gmail.com on 20 Apr 2015 at 6:58
Original issue reported on code.google.com by
anders.a...@gmail.com
on 20 Apr 2015 at 6:58