Sending and receiving
Scapy provides us with three functions for sending and receiving packets. The first two functions require that it's constructed for the network layer packets only such as IP, ICMP, and ARP packets. You may use sr() for sending and receiving packets whether they are answered or unanswered responses. The other alternative function is sr1() and this will only return one packet in response to the packet sent. For layer 2 packets, you would use srp() which provides the same function for sending/receiving packets.
Let's go ahead and create one for a single return. At minimum, we provide that it's a layer 3 packet for ICMP with the destination address going to 192.168.6 and we're going to name this packet p. You should have ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access