Interactive examples

In our first example, we will craft an Internet Control Message Protocol (ICMP) packet on the client and send it to the server. On the server side, we will use tcpdump with a host filter to see the packet coming in:

## Client Sidecisco@Client:~/scapy$ sudo scapy<skip>Welcome to Scapy (2.3.3.dev274)>>> send(IP(dst="10.0.0.14")/ICMP()).Sent 1 packets.>>>## Server Sidecisco@Server:~$ sudo tcpdump -i eth1 host 10.0.0.10tcpdump: verbose output suppressed, use -v or -vv for full protocol decodelistening on eth1, link-type EN10MB (Ethernet), capture size 65535 bytes02:45:16.400162 IP 10.0.0.10 > 10.0.0.14: ICMP echo request, id 0, seq 0, length 802:45:16.400192 IP 10.0.0.14 > 10.0.0.10: ICMP echo reply, id 0, seq 0, length 8 ...

Get Mastering Python Networking - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.