Running Scapy on Windows with Python 2.7
Asked Answered
P

7

30

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.

Pit answered 27/3, 2011 at 5:32 Comment(1)
Use latest version. No pypcap or what so ever.scapy.readthedocs.io/en/latest/installation.html#windowsInmate
F
23

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.

Favata answered 20/11, 2014 at 13:26 Comment(0)
S
19

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.

Sarene answered 12/10, 2011 at 10:32 Comment(4)
I think the latest head of pypcap source (v1.1) does not require the patch anymore. It built cleanly with Python 2.7 and mingw-gcc or Visual Studio, for me. The problem I'm hitting is with building libdnet (and its Python wrapper) for Windows Python 2.7. Any pointers?Hallam
But, yes, unfortunately, some of us are stuck with Python 2.7. In my case, I'd like to integrate scapy into our testing framework.Hallam
I do not have any pointers on how to compile libdnet against python 2.7. Looked into it but it does not look promising, yet.Sarene
I think there are no compiled versions of dnet for py2.7, tried searching it a lot and the one on Google Code doesnot seem to work for me for some reason. I am using Scapy on py2.6. If anyone finds anything please update the post.Malpractice
F
6

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.

Frustrated answered 24/4, 2014 at 20:41 Comment(0)
I
3

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

Inmate answered 10/4, 2017 at 14:51 Comment(0)
M
1

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

Marja answered 7/11, 2014 at 9:57 Comment(0)
M
0

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.

Magenmagena answered 25/11, 2015 at 9:9 Comment(0)
Y
-1

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.

Yemen answered 24/8, 2014 at 4:13 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.