Crafting an HTTP Response Packet
Explore how to craft HTTP response packets using Scapy in Python. Understand how to set key headers like status codes and reason phrases to build valid responses for servers or honeypots. Learn the differences in packet construction for various HTTP statuses and how to embed content within TCP packets.
We'll cover the following...
Defining HTTP response packets
HTTP traffic is carried over TCP. As a result, an HTTP server or honeypot will need to be capable of maintaining the connection by sending SYN/ACK and ACK packets to acknowledge receipt of the client's requests.
However, the HTTP server must also respond to the client’s actual request for a web page. To do so, it needs to be able to build an HTTP response packet.
HTTP responses in Scapy
HTTP is an ASCII-based protocol, meaning that the contents of an HTTP packet are ...