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).
In this guide, we will be installing Scapy on Ubuntu 20.04, all you have to have is a root user or sudo privileges on Debian-based OS (including Ubuntu) and Python 3.4+ installed in order to follow along with this tutorial. It is pretty straightforward to install Scapy on Linux, only two commands are usually sufficient.
First, let’s refresh our repository:
$ sudo apt update
Now let’s install Scapy:
$ sudo apt install python3-scapy
You can also install it by
sudo apt install scapy, but if you have another version of Python, it will confuse you. As a result,
python3-scapy makes sure you’re installing for Python 3.
You can also install Scapy using Pip, but I suggest you follow this approach anyways.
let’s check if it’s indeed, installed:
$ python3 Python 3.8.2 (default, Jul 16 2020, 14:00:26) [GCC 9.3.0] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import scapy >>> scapy.__version__ '2.4.3' >>>
Awesome, in this tutorial, you have managed to install Scapy for Python 3 on Ubuntu 20.04, this will also work on older versions of Ubuntu as well. I encourage you to check Scapy documentation in order to get started.
Note that if you’re on a Windows machine, you need to make some other steps in order to make Scapy work well on your machine, I suggest you take a look at this tutorial if you want to do that.
Happy installing ♥