29
votes

I like to use Scapy with Python v2.7 under Windows 7.

  • How can I install the required module pypcap for Python 2.7?
  • Will it be possible to make Python scripts depending on Scapy into standalone Windows applications using a distribution tool such as py2exe?

The particular Python distribution I am using is Enthought Python distribution 7.02.

7
Use latest version. No pypcap or what so ever.scapy.readthedocs.io/en/latest/installation.html#windows - Cukic0d

7 Answers

23
votes

Intrusive update: please note that this answer is outdated, with recent versions (>=2.4.0) scapy will ONLY require Npcap (or Winpcap) to work, and IPython for the console. Have a look at the official windows page

In case someone needs Scapy for 64-bit + Python 2.7, I've uploaded the binaries here:

https://github.com/Kondziowy/scapy_win64

In addition, you probably need to install WinPcap from the official site


Compiling it yourself required a few fixes - I'll commit them upstream soon.

19
votes

Q: how can i install required module pypcap

Using Scapy with Windows 7 is possible, but it does not exactly work out of the box. An install guide can be found here:

http://www.secdev.org/projects/scapy/doc/installation.html#windows

I strongly recommend to switch to python 2.6, as this will make your live much easier.

When you insist on 2.7 you will have to compile some of the require modules yourself. Also, some key modules like pypcap have to be patched before they can be compiled with python 2.7 (see pycap patch).

Here you will find some guidance on how to build the modules.


Q: will it be possible to make python scripts depending on scapy into standalone windows applications

Yes and no. While you can use py2exe to build a an EXE from your python code. Scapy uses WinPcap which you have to install in addition to your application.

6
votes

Dirk Loss provides an Windows installer for the dnet package for Python 2.7. Together with the Windows installer for the pypcap package for Python 2.7 I was able to run Scapy successfully on Python 2.7 on Windows.

3
votes

A LOT OF ANSWERS ARE OUTDATED !

Latest scapy version, that you can download on the official GitHub page: https://github.com/secdev/scapy Works without the old hand-compiled dependencies!

They are two easy requirements: IPython (for the console) and npcap (or winpcap)

You may follow the official tutorial here: http://scapy.readthedocs.io/en/latest/installation.html#windows

1
votes

Using the link posted by circus, I created binary installations for Scapy for python 2.7.x 32bit. Link for the setups (with dependencies) https://github.com/Kondziowy/scapy_win64

0
votes

If you don't have limitations forcing you to work with python2, you can try scapy3k from http://github.com/phaethon/scapy or pip install scapy-python3.

It does not require dnet nor pypcap, no C compilation required. I work with following config Windows 10/Anaconda 3.5/latest WinPcap.

-1
votes

Minimum requirement to get Scapy running on Windows with Python 2.7 seems to be: pyreadline, pcapy, and dnet. The last two are the trickiest to compile and/or find pre-compiled binaries. One option for these is listed in the above answer. Another download, together with with detailed steps on how getting Scapy to run on Windows is at: https://github.com/zlorb/scapy. These steps describe also how to get the optional dependencies, such as Gnuplot and Tex.