In this section, you will learn the basics of pcapy and how to capture and read headers from packets.
Capturing and injecting packets with pcapy
Introduction to pcapy
Pcapy is a Python extension module that interfaces with the libpcap packet capture library. Pcapy enables Python scripts to capture packets on the network. Pcapy is highly effective when used in conjunction with other collections of Python classes for constructing and packet-handling.
You can download the source code and the latest stable and development version at https://github.com/CoreSecurity/pcapy.
To install python-pcapy on the Ubuntu linux distribution, run the following commands:
sudo apt-get update
sudo apt-get install python-pcapy