Modifying Packet Fields

Learn how to modify the contents of various network packet fields with Scapy.

Examining a DNS packet

We’ve seen that we can view the contents of network packets in Scapy. However, Scapy also allows us to build and modify network packets. Now, we’ll look at modifying an existing packet.

The code sample below prints out the contents of one of the DNS packets in the traffic capture that we previously examined.

Get hands-on with 1200+ tech skills courses.