Установка scapy python windows

How to Install Scapy on Windows

Scapy is a packet manipulation tool for computer networks, it was written in Python and can forge, decode, send and capture network packets with very easy API.

It is a very powerful interactive packet manipulation program, as it can replaces most classical networking tools, such as hping, arpspoof, arping, and even some parts of Nmap, tcpdump and tshark.

Scapy runs natively on Linux, and on most Unixes with libpcap and its Python wrappers and the same code base works for both Python versions (3 and 2).

However, if you’re on Windows, you need to do additional stuff in order to make it work.

Before we get started, make sure you have Python 3.4+ installed on your Windows machine, in the following section, we’ll install npcap.

Installing Npcap

Npcap is the Nmap Project’s network packet manipulation library for Windows. It is based on the obsolete WinPcap library, but has many significant improvement in speed, portability, security and efficiency.

Head to this page and choose the Npcap installer, as shown in the following image:

Once you’ve downloaded the installer, click on it and just click “I agree” and then “Install”, and you’re good to go.

Installing Scapy

Now that you have Npcap installed, you have to install Scapy, it is pretty straightforward and you can do it using the following command in the command line:

After you’ve done that, make sure you have it installed:

C:\Users\STRIX>python Python 3.6.6 (v3.6.6:4cf1f54eb7, Jun 27 2018, 03:37:03) [MSC v.1900 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import scapy >>> scapy.__version__ '2.4.3'

Awesome, you have successfully installed Scapy on your machine, let’s see what you can build with it! You can check this page for Scapy tutorials.

Читайте также:  Css absolute position and float

If you want to install Scapy on a Debian-based machine, check this tutorial.

Источник

Download and Installation¶

Each of these steps can be done in a different way dependent on your platform and on the version of Scapy you want to use.

This document is for scapy3k. It requires python 3.x. See original scapy homepage for Scapy v2.x or earlier.

In scapy3k and Scapy v2.x use from scapy.all import * instead of from scapy import * .

Installing scapy3k¶

The following steps describe how to install (or update) Scapy itself. Dependent on your platform, some additional libraries might have to be installed to make it actually work. So please also have a look at the platform specific chapters on how to install those requirements.

The following steps apply to Unix-like operating systems (Linux, BSD, Mac OS X). Windows, currently is under development.

Make sure you have Python installed before you go on. Depending on your system you may have to use python3 and pip3 or python and pip for python version 3.x.

Latest release¶

The easiest way to install the latest scapy3k package is using pip.

$ pip3 install scapy-python3

Current development version¶

Clone GitHub repository to a temporary directory and install it in the standard distutils way:

$ cd /tmp $ git clone https://github.com/phaethon/scapy $ cd scapy $ sudo python3 setup.py install

If you always want the latest version with all new features and bugfixes, use Scapy’s GitHub repository:

    Install git version control system. For example, on Debian/Ubuntu use:

$ git clone https://github.com/phaethon/scapy
$ cd scapy $ sudo python3 setup.py install

Then you can always update to the latest version:

$ git pull $ sudo python3 setup.py install

Optional software for special features¶

>>> enc=rdpcap("weplab-64bit-AA-managed.pcap") >>> enc.show() >>> enc[0] >>> conf.wepkey=b"AA\x00\x00\x00" >>> dec=Dot11PacketList(enc).toEthernet() >>> dec.show() >>> dec[0] 

Platform-specific instructions¶

Linux native¶

Scapy can run natively on Linux. I does not require libdnet and libpcap.

  • Install python3 from your package manager if it is not already present
  • Install tcpdump and make sure it is in the $PATH. (It’s only used to compile BPF filters ( -ddd option ))
  • Make sure your kernel has Packet sockets selected ( CONFIG_PACKET )
  • If your kernel is < 2.6, make sure that Socket filtering is selected CONFIG_FILTER )
Читайте также:  Html not equal to

Debian/Ubuntu¶

Just use the standard packages:

$ sudo apt-get install tcpdump python3-crypto ipython3

Mac OS X¶

This section needs updating. In general installing python3, pip for python3, libpcap, libdnet, scapy3k using pip package scapy-python3 should do the job. Corrections are welcome.

Windows¶

Scapy works on Windows 8/2012 and newer version. Unlike earlier versions libdnet is not required. Testing is being done on following configuration: Windows 10/Anaconda 3.5/WinPcap 4.1.3

On Windows 7 (and possibly earlier) scapy can be used for offline packet crafting/dissection. Sniffing and sending requires manual setting of network interface information and routing as corresponding powershell cmdlets used to gather this information are not working on Windows 7.

Источник

Scapy

Scapy is a powerful Python-based interactive packet manipulation program and library.

It is able to forge or decode packets of a wide number of protocols, send them on the wire, capture them, store or read them using pcap files, match requests and replies, and much more. It is designed to allow fast packet prototyping by using default values that work.

It can easily handle most classical tasks like scanning, tracerouting, probing, unit tests, attacks or network discovery (it can replace hping , 85% of nmap , arpspoof , arp-sk , arping , tcpdump , wireshark , p0f , etc.). It also performs very well at a lot of other specific tasks that most other tools can’t handle, like sending invalid frames, injecting your own 802.11 frames, combining techniques (VLAN hopping+ARP cache poisoning, VoIP decoding on WEP protected channel, . ), etc.

Scapy supports Python 2.7 and Python 3 (3.4 to 3.9). It’s intended to be cross platform, and runs on many different platforms (Linux, OSX, *BSD, and Windows).

Читайте также:  Default input border css

Getting started

Scapy is usable either as a shell or as a library. For further details, please head over to Getting started with Scapy, which is part of the documentation.

Shell demo

Scapy can easily be used as an interactive shell to interact with the network. The following example shows how to send an ICMP Echo Request message to github.com , then display the reply source IP address:

The documentation contains more advanced use cases, and examples.
  • Scapy in 20 minutes
  • Interactive tutorial (part of the documentation)
  • The quick demo: an interactive session (some examples may be outdated)
  • HTTP/2 notebook
  • TLS notebooks

Installation

Scapy works without any external Python modules on Linux and BSD like operating systems. On Windows, you need to install some mandatory dependencies as described in the documentation.

On most systems, using Scapy is as simple as running the following commands:

git clone https://github.com/secdev/scapy  scapy ./run_scapy

To benefit from all Scapy features, such as plotting, you might want to install Python modules, such as matplotlib or cryptography . See the documentation and follow the instructions to install them.

Источник

Оцените статью