Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Running Scapy on Windows with Python 2.7

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.

like image 827
user186477 Avatar asked Mar 27 '11 05:03

user186477


People also ask

Can you use Scapy on Windows?

Windows. Scapy is primarily being developed for Unix-like systems and works best on those platforms. But the latest version of Scapy supports Windows out-of-the-box. So you can use nearly all of Scapy's features on your Windows machine as well.

Does Scapy support Python 3?

Scapy supports Python 2.7 and Python 3 (3.4 to 3.8).

Is Scapy included in Python?

Scapy is a library made in Python, with its own command line interpreter (CLI), which allows to create, modify, send and capture network packets. It can be used interactively through the command line interface or as a library by importing it into Python programs. It can also run on Linux, Mac OS X and Windows systems.

Does Python install PIP?

PIP is automatically installed with Python 2.7.9+ and Python 3.4+ and it comes with the virtualenv and pyvenv virtual environments.


2 Answers

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

  • dnet-1.12.win-amd64-py2.7.exe
  • pcap-1.1.win-amd64-py2.7.exe
  • scapy-2.2.0.win-amd64.exe

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.

like image 192
Konrad Brodzik Avatar answered Sep 28 '22 06:09

Konrad Brodzik


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.

like image 33
circus Avatar answered Sep 28 '22 06:09

circus