Developing a Valid TCP Layer Response

Learn how to define a valid TCP header in response to a received packet.

Creating responses to TCP/IP queries

When creating a SYN scanner, we build queries and analyze their responses. Defining a valid query is much easier than crafting a response to that query. When creating a request, we can allow several values to be set automatically by Scapy. In a response packet, we need to appropriately set these values to match those defined in a request.

For IP and UDP packet headers, this is relatively simple. However, the complexity of the TCP protocol means that we need to set many more fields within our network packets.

Inside a TCP/IP communication

TCP is a connection-oriented protocol, meaning that it puts in more work to ensure a good connection than UDP does. Part of this is the TCP handshake, which is used to set up a communications channel and that we took advantage of when building a port scanner.

Get hands-on with 1400+ tech skills courses.