Установка scapy kali linux

How To Install python3-scapy on Kali Linux

In this tutorial we learn how to install python3-scapy on Kali Linux.

What is python3-scapy

Scapy is a powerful interactive packet manipulation tool, packet generator, network scanner, network discovery, packet sniffer, etc. It can for the moment replace hping, 85% of nmap, arpspoof, arp-sk, arping, tcpdump, tethereal, p0f, ….

In scapy you define a set of packets, then it sends them, receives answers, matches requests with answers and returns a list of packet couples (request, answer) and a list of unmatched packets. This has the big advantage over tools like nmap or hping that an answer is not reduced to (open/closed/filtered), but is the whole packet.

This package contains the Python 3 version of the library and scapy executable.

There are three ways to install python3-scapy on Kali Linux . We can use apt-get , apt and aptitude . In the following sections we will describe each method. You can choose one of them.

Install python3-scapy Using apt-get

Update apt database with apt-get using the following command.

After updating apt database, We can install python3-scapy using apt-get by running the following command:

sudo apt-get -y install python3-scapy 

Install python3-scapy Using apt

Update apt database with apt using the following command.

After updating apt database, We can install python3-scapy using apt by running the following command:

sudo apt -y install python3-scapy 

Install python3-scapy Using aptitude

If you want to follow this method, you might need to install aptitude first since aptitude is usually not installed by default on Kali Linux. Update apt database with aptitude using the following command.

After updating apt database, We can install python3-scapy using aptitude by running the following command:

sudo aptitude -y install python3-scapy 

How To Uninstall python3-scapy on Kali Linux

To uninstall only the python3-scapy package we can use the following command:

sudo apt-get remove python3-scapy 

Uninstall python3-scapy And Its Dependencies

To uninstall python3-scapy and its dependencies that are no longer needed by Kali Linux, we can use the command below:

sudo apt-get -y autoremove python3-scapy 

Remove python3-scapy Configurations and Data

To remove python3-scapy configuration and data from Kali Linux we can use the following command:

sudo apt-get -y purge python3-scapy 

Remove python3-scapy configuration, data, and all of its dependencies

We can use the following command to remove python3-scapy configurations, data and all of its dependencies, we can use the following command:

sudo apt-get -y autoremove --purge python3-scapy 

References

Summary

In this tutorial we learn how to install python3-scapy using different package management tools like apt, apt-get and aptitude.

Читайте также:  What is my system architecture linux

Источник

Download and Installation

Each of these steps can be done in a different way depending on your platform and on the version of Scapy you want to use. Follow the platform-specific instructions for more detail.

Scapy versions

Scapy 2.5.0 was the last version to support Python 2.7 !

Installing Scapy v2.x

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). For Windows, see the special chapter below.

Make sure you have Python installed before you go on.

Latest release

To get the latest versions, with bugfixes and new features, but maybe not as stable, see the development version.

Current development version

If you always want the latest version of Scapy with all new the features and bugfixes (but slightly less stable), you can install Scapy from its Git repository.

If you don’t want to clone Scapy, you can install the development version in one line using:

$ pip install https://github.com/secdev/scapy/archive/refs/heads/master.zip
$ git clone https://github.com/secdev/scapy.git $ cd scapy

You can run scapy without installing it using the run_scapy (unix) or run_scapy.bat (Windows) script.

Optional Dependencies

For some special features, Scapy will need some dependencies to be installed. Most of those software are installable via pip . Here are the topics involved and some examples that you can use to try if your installation was successful.

    Plotting. plot() needs Matplotlib. Matplotlib is installable via pip install matplotlib

>>> p=sniff(count=50) >>> p.plot(lambda x:len(x)) 
>>> p=rdpcap("myfile.pcap") >>> p.conversations(type="jpg", target="> test.jpg") 

Note Graphviz and ImageMagick need to be installed separately, using your platform-specific package manager.

>>> a,u=traceroute(["www.python.org", "google.com","slashdot.org"]) >>> a.trace3D() 
>>> enc=rdpcap("weplab-64bit-AA-managed.pcap") >>> enc.show() >>> enc[0] >>> conf.wepkey="AA\x00\x00\x00" >>> dec=Dot11PacketList(enc).toEthernet() >>> dec.show() >>> dec[0] 
>>> load_module("nmap") >>> nmap_fp("192.168.0.1") Begin emission: Finished to send 8 packets. Received 19 packets, got 4 answers, remaining 4 packets (0.88749999999999996, ['Draytek Vigor 2000 ISDN router']) 

Platform-specific instructions

As a general rule, you can toggle the libpcap integration on or off at any time, using:

from scapy.config import conf conf.use_pcap = True

Linux native

Scapy can run natively on Linux, without libpcap.

  • Install Python 3.7+.
  • Install libpcap. (By default it will only be used to compile BPF filters)
  • 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 )

Debian/Ubuntu/Fedora

Make sure libpcap is installed:

$ sudo apt-get install libpcap-dev

Then install Scapy via pip or apt (bundled under python3-scapy ) All dependencies may be installed either via the platform-specific installer, or via PyPI. See Optional Dependencies for more information.

Mac OS X

On Mac OS X, Scapy DOES work natively since the recent versions. However, you may want to make Scapy use libpcap. You can choose to install it using either Homebrew or MacPorts. They both work fine, yet Homebrew is used to run unit tests with Travis CI.

Читайте также:  Смонтировать файловую систему linux

Libpcap might already be installed on your platform (for instance, if you have tcpdump). This is the case of OSX

Install using Homebrew

Install using MacPorts

$ sudo port install libpcap

OpenBSD

In a similar manner, to install Scapy on OpenBSD 5.9+, you may want to install libpcap, if you do not want to use the native extension:

Then install Scapy via pip or pkg_add (bundled under python-scapy ) All dependencies may be installed either via the platform-specific installer, or via PyPI. See Optional Dependencies for more information.

SunOS / Solaris

Solaris / SunOS requires libpcap (installed by default) to work.

In fact, Solaris doesn’t support AF_PACKET , which Scapy uses on Linux, but rather uses its own system DLPI . See this page. We prefer using the very universal libpcap that spending time implementing support for DLPI .

Windows

You need to install Npcap in order to install Scapy on Windows (should also work with Winpcap, but unsupported nowadays):

  • Download link: Npcap: the latest version
  • During installation:
    • we advise to turn off the Winpcap compatibility mode
    • if you want to use your wifi card in monitor mode (if supported), make sure you enable the 802.11 option

    You should then be able to open a cmd.exe and just call scapy . If not, you probably haven’t enabled the “Add Python to PATH” option when installing Python. You can follow the instructions over here to change that (or add it manually).

    Screenshots

    _images/scapy-win-screenshot1.png _images/scapy-win-screenshot2.png

    Known bugs

    You may bump into the following bugs, which are platform-specific, if Scapy didn’t manage work around them automatically:

    • You may not be able to capture WLAN traffic on Windows. Reasons are explained on the Wireshark wiki and in the WinPcap FAQ. Try switching off promiscuous mode with conf.sniff_promisc=False .
    • Packets sometimes cannot be sent to localhost (or local IP addresses on your own host).

    Winpcap/Npcap conflicts

    As Winpcap is becoming old, it’s recommended to use Npcap instead. Npcap is part of the Nmap project.

    This does NOT apply for Windows XP, which isn’t supported by Npcap .

    1. If you get the message ‘Winpcap is installed over Npcap.’ it means that you have installed both Winpcap and Npcap versions, which isn’t recommended.

    You may first uninstall winpcap from your Program Files, then you will need to remove:

    C:/Windows/System32/wpcap.dll C:/Windows/System32/Packet.dll

    And if you are on an x64 machine:

    C:/Windows/SysWOW64/wpcap.dll C:/Windows/SysWOW64/Packet.dll

    To use Npcap instead, as those files are not removed by the Winpcap un-installer.

    2. If you get the message ‘The installed Windump version does not work with Npcap’ it surely means that you have installed an old version of Windump , made for Winpcap . Download the correct one on https://github.com/hsluoyz/WinDump/releases

    In some cases, it could also mean that you had installed Npcap and Winpcap , and that Windump is using Winpcap . Fully delete Winpcap using the above method to solve the problem.

    Build the documentation offline

    The Scapy project’s documentation is written using reStructuredText (files *.rst) and can be built using the Sphinx python library. The official online version is available on readthedocs.

    HTML version

    The instructions to build the HTML version are:

    (activate a virtualenv) pip install sphinx cd doc/scapy make html

    You can now open the resulting HTML file _build/html/index.html in your favorite web browser.

    To use the ReadTheDocs’ template, you will have to install the corresponding theme with:

    pip install sphinx_rtd_theme

    UML diagram

    Using pyreverse you can build a UML representation of the Scapy source code’s object hierarchy. Here is an example of how to build the inheritance graph for the Fields objects :

    (activate a virtualenv) pip install pylint cd scapy/ pyreverse -o png -p fields scapy/fields.py

    This will generate a classes_fields.png picture containing the inheritance hierarchy. Note that you can provide as many modules or packages as you want, but the result will quickly get unreadable.

    To see the dependencies between the DHCP layer and the ansmachine module, you can run:

    pyreverse -o png -p dhcp_ans scapy/ansmachine.py scapy/layers/dhcp.py scapy/packet.py

    In this case, Pyreverse will also generate a packages_dhcp_ans.png showing the link between the different python modules provided.

    © Copyright 2008-2023 Philippe Biondi and the Scapy community. Revision 9abb9cb6 .

    Источник

    Tutorial Install and Configure Scapy on Kali Linux

    Tutorial-Install-and-Configure-Scapy-on-Kali-Linux

    If you are looking for a tool to decrypt and record data, we recommend Scapy. The Scapy tool spoofs data packets coming from a source, decrypts and then captures them. In this article, you will get acquainted with Scapy and learn How to Install and Configure Scapy on Kali Linux. You can check out packages offered on Eldernode website, if you want to purchase a Linux VPS server.

    How to Install and Configure Scapy on Kali Linux

    What is Scapy?

    Scapy is a free and open-source tool for interactive package manipulation based on Python. This tool can be used as a shell to interact with incoming and outgoing network traffic. Also you can use Scapy for routing with built-in modules.

    What Can be Done with Scapy?

    Using Scapy, you can easily perform classic tasks such as scanning, tracing, exploration, unit testing, attacks or network discovery. You can use this tool instead of hping, 85% of nmap, arpspoof, apr-sk, arping, tcpdump, Wireshark, P0f.

    Also Scapy can be used in special tasks, such as sending invalid frames, VLAN hopping + ARP cache poisoning, VoIP decoding in WEP protected channel.

    In the continuation of this article from the Kali Linux training series, we intend to teach you How to Install and Configure Scapy on Kali Linux.

    Installing Scapy on Kali Linux

    You can use the following command to install Scapy on Kali Linux:

    How to Configure Scapy on Kali Linux

    In the following, we will review various tools of Scapy and learn how to configure them on Kali Linux.

    This is a tool for interactive package manipulation. Run the following command to configure it:

    Another interactive package manipulation tool is Scapy3. You can configure it by running the command below:

    FAQ

    Conclusion

    In this way, you knew that Scapy is a tool for manipulating interactive packages. After the short introduction of Scapy in this article, you learned how to install Scapy on Kali Linux and how to configure different tools of Scapy.

    Click on a star to rate it!

    Average rating 1 / 5. Vote count: 1

    No votes so far! Be the first to rate this post.

    Источник

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