In Scapy, each packet is a collection of nested dictionaries, as Scapy uses Python dictionaries as the data structure for packets. Starting from the lowest layer, each layer will be a child dictionary of the parent layer. Also, each and every field inside the layer of a packet is a key value pair inside the dictionary for that layer. So, we can make changes in this field using the assignment operations.
Layering packets
How to do it...
To understand the layering in Scapy, we can go through the following steps:
- We can get the details of a packet and its layered structure using the show() method. We can use the interactive Terminal for inspecting and determining more about each packet's structure. Open up the Terminal...