Scapy portability page

Linux native installation guide

Scapy can run natively on Linux. It can alternatively use dnet and pcap libraries (see generic unix installation guide).

Linux native installation

There are some specific requirements for a native use :

Optional packages

Debian

# apt-get install tcpdump graphviz imagemagick python-gnuplot python-crypto python-pyx 

Generic Unix installation guide

Scapy dependances

You need Python 2.3 or 2.4. Some Python packages (at least Python 2.3 for MacOS) come without libreadline wrapper, so you'll need to install it yourself (
this one for instance).

Dependancies for building wrappers

You'll need Python development packages (for instance, python2.3-dev package for Debian).

Installing libdnet and its Python wrapper

We'll use the CVS version. There is no password.
cvs -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/libdnet login
cvs -z3 -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/libdnet co -P libdnet
cd libdnet
./configure
make
sudo make install
cd python
python ./setup.py build
sudo python ./setup.py install
That's it.

Installing libpcap and its Python wrapper

First, install libpcap and libpcap development headers with any means your OS give to you. For instance, with Debian, you'll type
apt-get install libpcap0.7 libpcap-dev
Once this is ready, we can build the python wrapper. (http://sourceforge.net/projects/pylibpcap)
wget http://ovh.dl.sourceforge.net/sourceforge/pylibpcap/pylibpcap-0.4.tar.gz
tar zxf pylibpcap-0.4.tar.gz
cd pylibpcap-0.4
python ./setup.py build
sudo python ./setup.py install
We encountered a strange error with this wrapper with Python2.4 on MacOS. It seems the module was not able to overload __doc__. Changing the line if sys.version[0] == '2': in something always false (if 0: for instance) resolved it.

Optional packages

Scapy on OpenBSD 3.8 - Quick Installation Guide

(by Lee Chin Sheng)

Below are all the packages/sources that need to be installed in order to get Scapy run properly.

Installing libpcap from source

libpcap-0.9.4 (Packet Capture Library)
shell>wget http://www.tcpdump.org/release/libpcap-0.9.4.tar.gz
shell>tar xvzf libpcap-0.9.4.tar.gz
shell>cd libpcap-0.9.4
shell>./configure
shell>make && make install

Installing other packages

Depends on which shell you are using, the default is ksh Note: You can find lots of mirrors from the this url, check one nearby your location on
http://www.openbsd.org/ftp.html#http
shell>export PKG_PATH=http://public.www.planetmirror.com/pub/OpenBSD/3.8/packages/i386/
Or if you are using csh
shell>setenv PKG_PATH http://public.www.planetmirror.com/pub/OpenBSD/3.8/packages/i386/
Now you can just install all the packages easily with
shell>pkg_add ${PKG_PATH}libdnet-1.10
shell>pkg_add ${PKG_PATH}python-2.3.5p2.tgz
shell>pkg_add ${PKG_PATH}py-libpcap-0.5.3p0.tgz
shell>pkg_add ${PKG_PATH}py-crypto-2.0.tgz
shell>pkg_add ${PKG_PATH}gnuplot-4.0.0.tgz
shell>pkg_add ${PKG_PATH}py-gnuplot-1.7.tgz
shell>pkg_add ${PKG_PATH}graphviz-1.16p1.tgz

Installing PyX from source

Installing PyX-0.8.1 from source - for psdump() and pdfdump() to function properly. There's a slightly issue since PyX requires teTeX including font Type 1 and I have problem installing teTeX through package since I get mismatch md5 checksum. However you can still install PyX and use psfont.cmz instead. PyX-0.8.1 (Python Graphic Package) Choose any PyX download mirror - http://prdownloads.sourceforge.net/pyx/PyX-0.8.1.tar.gz?download
shell>wget http://optusnet.dl.sourceforge.net/sourceforge/pyx/PyX-0.8.1.tar.gz
shell>tar xvzf PyX-0.8.1.tar.gz
shell>cd PyX-0.8.1
shell>python setup.py build
shell>python setup.py install
To use font psfonts.cmz
shell>python
>>>from pyx import *
>>>text.set(fontmaps="/usr/local/share/texmf-dist/fonts/map/dvips/ams/psfonts.cmz")
>>>
If Scapy complains that it can't open Ethertypes file, you can download the ethertypes file that from this url http://www.secdev.org/projects/scapy/files/ethertypes and put it into /etc directory.

Scapy on FreeBSD - Quick Installation Guide

(by Lee Chin Sheng)

Scapy requires lots of dependencies, so I have to install it. Luckily we have all of them in ports/packages and you can go for either one. For me I prefer package as it is fast instead of compiling from port.

Before you install those packages, basically you can specify which mirror site you want to fetch, If you are using tcsh or csh,
shell>setenv PACKAGESITE ftp://ftp5.freebsd.org/pub/FreeBSD/releases/i386/6.0-RELEASE/packages/All/
If you are using ksh or bash,
shell>export PACKAGESITE=ftp://ftp5.freebsd.org/pub/FreeBSD/releases/i386/6.0-RELEASE/packages/All/
You can actually find the mirror sites on this link
http://www.freebsd.org/releases/6.0R/announce.html

Installing Python

shell>pkg_add -r python-2.4.1.3

Installing libpcap from source

libpcap-0.9.4 (Packet Capture Library)
shell>wget http://www.tcpdump.org/release/libpcap-0.9.4.tar.gz
shell>tar xvzf libpcap-0.9.4.tar.gz
shell>cd libpcap-0.9.4
shell>./configure
shell>make && make install

Installing libdnet-1.10 from port

Note on libdnet: You have to install this by using port to enable python wrapping.
shell>cd /usr/ports/net/libdnet
shell>make WITH_PYTHON=yes install

Installing py24-pcap

Note on py24-pcap: If you are installing py24-pcap-0.4, use port, and if you are going for py24-pcap-0.5 which is current, you can just install the package.

If you use py24-pcap-0.4 (/usr/ports/net/py-pcap), a small fix in this package is necessary to make it work :

shell>cd /usr/ports/net/py-pcap/
shell>make
shell>cd work/pylibpcap-0.4/
Then replace line 34 of pcap.py by: if 0:
shell>cd ../..
shell>make install clean

Installing Other Needed Apps

For py24-pycrypto, py24-PyX, py-gnuplot, graphiviz, ImageMagick, you can just install using packages.
shell>pkg_add -vr py24-pycrypto py24-PyX py-gnuplot ImageMagick graphviz
For PyX font mapping, check out /usr/local/etc/pyxrc, or you can create a file under user directory, ~/.pyxrc Edit this line :
fontmaps = psfonts.map bsr.map
then run
shell>updmap
Note: updmap is a utility that creates font config for dvips, pdftex, xdvi, etc. It updates font map files for Tex output drivers, thanks ctime for the tips.

If Scapy complains that it can't open Ethertypes file, you can download the ethertypes file that from this url http://www.secdev.org/projects/scapy/files/ethertypes and put it into /etc directory.

Scapy on Mac OS X 10.4 (Tiger)

There are 3 recipes. Choose the one that fit your taste. Recipe 3 should replace recipe 2 since Scapy has been added to Darwin ports.

Recipe 1

(by Guillaume Valadon)

This guide describes howto install Scapy on a fresh Tiger installation Requirements:

Installing libdnet and its Python wrapper

We'll use the CVS version. There is no password.
cvs -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/libdnet login
cvs -z3 -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/libdnet co -P libdnet
cd libdnet
./configure
make
sudo make install
cd python
python ./setup.py build
sudo python ./setup.py install

Installing libpcap and its Python wrapper

First all, swig must be installed. Fink is used in the example, but any installation should work.
sudo apt-get install swig swig-shlibs
Once this is ready, we can build the python wrapper. (http://sourceforge.net/projects/pylibpcap)
wget http://ovh.dl.sourceforge.net/sourceforge/pylibpcap/pylibpcap-0.4.tar.gz
tar zxf pylibpcap-0.4.tar.gz
cd pylibpcap-0.4
python ./setup.py build
sudo python ./setup.py install

Installing readline

From macosxhints:
python `python -c "import pimp; print pimp.__file__"` -i readline

Recipe 2

(by Christopher Owen)
  1. Install X11
    On the Tiger DVD, it is located in the "Optional Installs.mpkg" package.
  2. Install X11 SDK
    On the Tiger DVD, it is located in the "Xcode Tools/Packages" directory.
  3. Install darwinports
    Download the dmg from darwinports.org and install
    sudo port -d selfupdate
    
  4. Install Python 2.4
    sudo port install python24
    
  5. Add readline support to python
    sudo port install py-readline
    
  6. Add gnuplot support to python
    sudo port install py-gnuplot
    
  7. Add crypto support to python
    sudo port install py-crypto
    
  8. Add PyX support to python
    sudo port install py-pyx
    
  9. Install swig
    sudo port install swig
    
  10. Install wget
    sudo port install wget
    
  11. Install the pylibpcap python wrapper
    wget http://puzzle.dl.sourceforge.net/sourceforge/pylibpcap/ 
    pylibpcap-0.5.1.tar.gz
    tar zxf pylibpcap-0.5.1.tar.gz
    cd pylibpcap-0.5.1
    python2.4 ./setup.py build
    sudo python2.4 ./setup.py install
    
  12. Install libdnet
    sudo port install libdnet
    
  13. Add dnet support to python
    cd /tmp
    cvs -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/libdnet login
    cvs -z3 -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/libdnet  
    co -P libdnet
    cd libdnet/python
    cd python
    python2.4 ./setup.py build
    sudo python2.4 ./setup.py install
    cd ..
    rm -rf libdnet*
    
  14. Download ethertypes file from ebtables project
  15. Download and run scapy
    sudo python2.4 scapy.py
    

Recipe 3

(by Christopher Owen)
  1. Install X11
    On the Tiger DVD, it is located in the "Optional Installs.mpkg" package.
  2. Install X11 SDK
    On the Tiger DVD, it is located in the "Xcode Tools/Packages" directory.
  3. Install darwinports
    Download the dmg from darwinports.org and install it
  4. Update darwinports
    sudo port -d selfupdate
    
  5. Install Scapy
    sudo port install scapy
    

Scapy on Windows

Scapy is developed with Unix systems in mind. Nevertheless some people succeeded in porting it to Windows. Everything you need to know to have it work on windows is on the Windows Installation guide they maintain on Scapy's wiki.