Scapy portability page
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 :
- Python 2.3 or 2.4. (Python 2.4 is needed for Bluetooth stuff)
- install tcpdump and make sure it is in the $PATH (only used to compile BPF filters (-ddd option))
- make sure your kernel has Packet socket selected (CONFIG_PACKET)
- if your kernel is < 2.6, make sure that Socket filtering is selected (CONFIG_FILTER)
Optional packages
- install graphviz and imagemagick (for graph stuff)
- install python-gnuplot package (for PacketList.plot())
- install python-crypto package (for WEP stuff)
- install python-visual (http://vpython.org) (for 3D stuff)
- install python-pyx package (for Packet.psdump(), Packet.pdfdump(), PacketList.psdump() and PacketList.pdfdump())
- the /etc/ethertypes file can be found on ebtables or downloaded here
- install acroread and gv (for psdump() and pdfdump() when called without parameters)
- install sox (for VOIP stuff)
Debian
# apt-get install tcpdump graphviz imagemagick python-gnuplot python-crypto python-pyx
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
- install graphviz and imagemagick (for graph stuff)
- install python-gnuplot package (for PacketList.plot())
- install python-crypto package (for WEP stuff)
- install python-pyx package (for Packet.psdump(), Packet.pdfdump(), PacketList.psdump() and PacketList.pdfdump())
- the /etc/ethertypes file can be found on ebtables or downloaded here
- install acroread and gv (for psdump() and pdfdump() when called without parameters)
- install sox (for VOIP stuff)
(by Lee Chin Sheng)
Below are all the packages/sources that need to be installed in order to get Scapy run properly.
- python-2.3.5p2
- libpcap-0.9.4.tar.gz
- py-libpcap-0.3.1p0
- libdnet-1.10
- py-libdnet-1.10
- py-crypto-2.0
- gnuplot-4.0.0
- py-gnuplot-1.7
- PyX-0.8.1.tar.gz
- graphviz-1.16p1
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.
(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.
- python-2.4.1.3 (/usr/ports/lang/python)
- libpcap-0.9.4
- libdnet-1.10 (/usr/ports/net/libdnet)
- py24-pcap-0.4/0.5 (/usr/ports/net/py-pcap)
- py24-pycrypto-2.0.1 (/usr/ports/security/py-pycrypto)
- py24-PyX-0.8 (/usr/ports/graphics/py-PyX)
- py-gnuplot-1.7 (/usr/ports/math/py-gnuplot/)
- ImageMagick-6.2.2.1 (/usr/ports/graphics/ImageMagick)
- graphviz-2.2 (/usr/ports/graphics/graphviz)
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.
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:
- Xcode Tools (on Mac OS X Install Disc)
- swig
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)
- Install X11
On the Tiger DVD, it is located in the "Optional Installs.mpkg"
package.
- Install X11 SDK
On the Tiger DVD, it is located in the "Xcode Tools/Packages"
directory.
- Install darwinports
Download the dmg from darwinports.org and install
sudo port -d selfupdate
- Install Python 2.4
sudo port install python24
- Add readline support to python
sudo port install py-readline
- Add gnuplot support to python
sudo port install py-gnuplot
- Add crypto support to python
sudo port install py-crypto
- Add PyX support to python
sudo port install py-pyx
- Install swig
sudo port install swig
- Install wget
sudo port install wget
- 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
- Install libdnet
sudo port install libdnet
- 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*
- Download ethertypes file from ebtables project
- Download and run scapy
sudo python2.4 scapy.py
Recipe 3
(by Christopher Owen)
- Install X11
On the Tiger DVD, it is located in the "Optional Installs.mpkg"
package.
- Install X11 SDK
On the Tiger DVD, it is located in the "Xcode Tools/Packages"
directory.
- Install darwinports
Download the dmg from darwinports.org and install it
- Update darwinports
sudo port -d selfupdate
- Install Scapy
sudo port install scapy
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.