Scapy – Safe and Complete Installation

Here are steps for safe and complete installation of Scapy on your Ubuntu/Fedora machine.

Step 1: Install VirtualEnv

Once this is installed, we will create a virtual environment and do all the further installation in that virtual environment. Read more about virtualenv.

$ sudo pip install virtualenv

Create virtual environment named venv

$ virtualenv venv

Activate virtual environment. After activating virtual environment the shell prompt changes and name of virtual environment is appended to prompt.

$ source venv/bin/activate
(venv)$ 

This post is called safe installation because we are not doing system wide installation of softwares but in a virtual environment. So every time for using any software installed in virtual environment you will have to activate virtual environment as shown above.

Step 2: Install Scapy from source code

(venv)$ wget http://www.secdev.org/projects/scapy/files/scapy-2.3.1.zip 
(venv)$ unzip scapy*
(venv)$ cd scapy-2.*
(venv)$ python setup.py install

Or else download source from the link http://scapy.net/ unzip it and install it.
Now scapy is installed but some functionalities won’t work because those functionalities depend upon external softwares that should be installed manually, externally.

Step 3: OS specific Requirements

Install Python-development tools and TCPDUMP.

Fedora

(venv)$ sudo dnf install python-devel tcpdump graphviz sox

Note: dnf is a newer package manager, for older versions of Fedora use yum instead.

Ubuntu

(venv)$ sudo apt-get install python-dev tcpdump graphviz imagemagick

Step 4: Install Python graphics package

This library is needed by Scapy when it generates a graphical representation of packets. Read the documentation of PyX.

(venv)$ pip install --allow-external pyx pyx==0.12.1

Step 5: INSTALL Numpy

Numpy is a dependency of GNUplot, read about that here.

(venv)$ pip install numpy

Step 6: Install GNUPlot

  • Download the source from here. If there are problems in downloading read here about downloading source code.
  • Extract the downloaded tar and go into folder
(venv)$ python setup.py install

Step 7: Install PyCrypto

(venv)$ pip install pycrypto

After this scapy is completely installed now you can run scapy. But scapy needs root access to do stuff so login as root, activate the virtual environment and then run following.

(venv)$ scapy

Try this installation process, if anything is missing or you find anything wrong, please comment below. Thanks for reading.

Advertisements

6 thoughts on “Scapy – Safe and Complete Installation

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s