Capturing and injecting packets with scapy
The analysis of network traffic, which are the packets that are exchanged between two hosts that can be intercepted, could help us identify the details when we know the details of the systems that participate in the communication. The message and the duration of the communication are some of the valuable information that an attacker who is listening in the network medium can obtain.
Introduction to scapy
Scapy is a module written in Python to manipulate data packages with support for multiple network protocols. It allows the creation and modification of network packets of various types, implements functions to passively capture and sniff packets, and then executes actions on these packets. I recommend using scapy on a Linux system, as it was designed with Linux in mind.
The newest version of scapy does support Windows, but for the purpose of this chapter, I assume you are using a Linux distribution that has a fully functioning...