Skip to content

Instantly share code, notes, and snippets.

@dloss
Created August 15, 2013 12:30
Show Gist options
  • Save dloss/6240457 to your computer and use it in GitHub Desktop.
Save dloss/6240457 to your computer and use it in GitHub Desktop.
Scapy on Windows development howto (DRAFT)
Scapy on Windows development howto (DRAFT)
Dirk Loss, 2010-07-17
Make a development directory:
C:\> mkdir Scapy
C:\> cd Scapy
C:\Scapy>
Install Python
Download Python 2.5: http://www.python.org/ftp/python/2.5.4/python-2.5.4.msi
[x] Install for all users
Set environment variables:
PATH = %PATH%;c:\Python25;c:\Python25\Scripts
PATHEXT = %PATHEXT%;.PY
Install WinPcap DevPack Version 4.0
(4.1 does not compile)
http://www.winpcap.org/devel.htm
Download http://www.winpcap.org/install/bin/WpdPack_4_0_2.zip
Extract to: C:\Scapy\WpdPack
Install MinGW
http://sourceforge.net/projects/mingw/files/Automated%20MinGW%20Installer/MinGW%205.1.4/MinGW-5.1.4.exe/download
[x] Download and install
[x] Current
Minimal
PATH=%PATH%;C:\MinGW\bin
Configure distutils to use MinGW
Create a file "c:\Python25\Lib\distutils\distutils.cfg" with the following contents:
[build]
compiler=mingw32
Install MSYS Base System
Download from http://sourceforge.net/projects/mingw/files/MSYS%20Base%20System/Current%20Release_%20MSYS-1.0.11/MSYS-1.0.11.exe/download
Install to C:\msys\1.0
Install SVN client (e.g. SlikSVN)
Get the pypcap source
C:\Scapy>svn co http://pypcap.googlecode.com/svn/trunk pypcap
Install 'setuptools' or 'distribute'
This will give us "easy_install"
Download and run Python 2.5 version from http://pypi.python.org/pypi/setuptools
Install Cython
easy_install cython
pypcap
------
Delete -lmsvcr71 from the command
$ make install
libdnet
-------
svn checkout http://libdnet.googlecode.com/svn/trunk/ libdnet
cd libdnet
In python/setup.py.in:
Remove double entries in dnet_srcs.extend
$ ./configure
This will generate setup.py from setup.py.in
Convert dnet.pyx to UNIX line endings (LF), else cython will fail
cython dnet.pyx (pyrex does not work)
insert #include <windows.h> in rand.c, fw-pktfilter.c, intf-win32.c, ip-win32.c, eth-win32.c
In eth-win32.c:
comment out VC6 bogosity
python setup.py build --compiler=mingw32
Remove:
-lmsvcr90
Better:
In pcap.c replace strdup with _strdup
Scapy
-----
Install TortoiseHg
Download http://bitbucket.org/tortoisehg/stable/downloads/TortoiseHg-0.8.1-hg-1.3.1.exe
Run setup, then restart computer
Configure TortoiseHg: Right-click on a folder,
Global Settings...
Commit
Username: Dirk Loss <mail@dirk-loss.de>
Apply
Close
OPTIONAL SOFTWARE
-----------------
Install 7-zip
Download from http://www.7-zip.org/
Install Sphinx
C:\> easy_install -U sphinx
Install Subversion client
http://www.sliksvn.com/en/download
Typical
Make NPF start automtically at boot so that all users can use WinPcap
Elevated prompt: C:\> sc config npf start= auto
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment