Scapy is a packet manipulation tool for computer networks, it was written in Python and can forge, decode, send and capture network packets with very easy API.
Scapy runs natively on Linux, and on most Unixes with
libpcap and its Python wrappers and the same code base works for both Python versions (3 and 2).
However, if you’re on Windows, you need to do additional stuff in order to make it work.
Before we get started, make sure you have Python 3.4+ installed on your Windows machine, in the following section, we’ll install npcap.
Npcap is the Nmap Project’s network packet manipulation library for Windows. It is based on the obsolete WinPcap library, but has many significant improvement in speed, portability, security and efficiency.
Head to this page and choose the Npcap installer, as shown in the following image:
Once you’ve downloaded the installer, click on it and just click “I agree” and then “Install”, and you’re good to go.
Now that you have Npcap installed, you have to install Scapy, it is pretty straightforward and you can do it using the following command in the command line:
$ pip3 install scapy
After you’ve done that, make sure you have it installed:
C:\Users\STRIX>python Python 3.6.6 (v3.6.6:4cf1f54eb7, Jun 27 2018, 03:37:03) [MSC v.1900 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import scapy >>> scapy.__version__ '2.4.3'
Awesome, you have successfully installed Scapy on your machine, let’s see what you can build with it!
If you want to install Scapy on a Debian-based machine, check this tutorial.