How it works...

First, we set up the packet sniffing using the sniff() function of Scapy, specifying modify_packet_header() as the callback function for each packet. All TCP packets having TCP and a raw layer that are destined to port 80 (HTTP) are considered for modification. So, the current packet header is extracted from the packet's payload data.

The extra header is then appended to the existing header dictionary. The packet is then printed on screen using the show() method, and for avoiding the correctness checking failure, the packet checksum data is removed from the packet. Finally, the packet is sent over the network.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.216.47.169