scapy | based interactive packet manipulation program & library | Learning library

 by   secdev Python Version: 2.5.0rc3 License: GPL-2.0

kandi X-RAY | scapy Summary

kandi X-RAY | scapy Summary

scapy is a Python library typically used in Tutorial, Learning applications. scapy has no bugs, it has no vulnerabilities, it has build file available, it has a Strong Copyleft License and it has high support. You can install using 'pip install scapy' or download it from GitHub, PyPI.

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).

            kandi-support Support

              scapy has a highly active ecosystem.
              It has 8877 star(s) with 1869 fork(s). There are 220 watchers for this library.
              It had no major release in the last 12 months.
              There are 67 open issues and 1395 have been closed. On average issues are closed in 20 days. There are 57 open pull requests and 0 closed requests.
              It has a negative sentiment in the developer community.
              The latest version of scapy is 2.5.0rc3

            kandi-Quality Quality

              scapy has 0 bugs and 0 code smells.

            kandi-Security Security

              scapy has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              scapy code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              scapy is licensed under the GPL-2.0 License. This license is Strong Copyleft.
              Strong Copyleft licenses enforce sharing, and you can use them when creating open source projects.

            kandi-Reuse Reuse

              scapy releases are available to install and integrate.
              Deployable package is available in PyPI.
              Build file is available. You can build the component from source.
              Installation instructions, examples and code snippets are available.
              scapy saves you 95646 person hours of effort in developing the same functionality from scratch.
              It has 109491 lines of code, 5372 functions and 304 files.
              It has low code complexity. Code complexity directly impacts maintainability of the code.

            Top functions reviewed by kandi - BETA

            kandi has reviewed scapy and discovered the below as its top functions. This is intended to give you an instant insight into scapy implemented functionality, and help decide if they suit your requirements.
            • Run tcpdump .
            • Interactively interactively .
            • Start the background thread .
            • Impersonate a packet .
            • Explorer a given layer .
            • Return a list of unit_and scaling fields .
            • Generate a tracebook notebook
            • This function is used to attack an attack .
            • Deal with a negotiation response .
            • Compute the difference between two strings .
            Get all kandi verified functions for this library.

            scapy Key Features

            No Key Features are available at this moment for scapy.

            scapy Examples and Code Snippets

            No Code Snippets are available at this moment for scapy.

            Community Discussions


            Renault Zoe doesn't send SDP Request After SLAC Matching Process
            Asked 2022-Feb-25 at 12:01

            We are trying to communicate with Renault Zoe according to DIN SPEC 70121.

            We are successfully communciating with the Hyundai Kona and BMW i3 but fail to receive the SPD Request with Renault Zoe. We are passing the SLAC process with Renault Zoe but we don't recieve any UDP messages afterwards. We are sending the CM_SLAC_MATCH_CNF message as an ethernet unicast message according to DIN SPEC 70121:2014-12,, Table 2 (noted in Design Guide Combined Charging System V5 - Failures during SLAC - Interruption at SLAC match sequence).

            Why can it be that we receive the SDP Request with Kona and i3 but fail to do so with Zoe? Has anyone experienced this behaviour before?

            Sniffed SLAC messages with scapy:

            (= '' means the field is filled with zeroes)

            Received from Zoe:



            Answered 2022-Feb-25 at 12:01

            The solution was to send the 2 byte field MatchVariableFieldLen in the CM_SLAC_MATCH_CNF message in little-endian byte order.

            From the message that was send by the Renault Zoe, we can see that Zoe sends the CM_SLAC_MATCH_REQ with the MatchVariableFieldLen as 0x3e 0x00 (15872 == 0x3e00). Since this field should be 0x3e according to DIN SPEC 2014-12, we can see the byte order of this field is little-endian. So a reasonable guess was that it expects this field in little-endian in the response message.

            Result: We received the SDP request and the messages after that.

            The HomePlug GP Specification does not specify the endianness of this field in clause 11.5.58. But looking at the example in Table 11-316, one would say its big-endian.

            It's clear that Zoe interpret this field as little-endian and doesn't accept 0x00 0x56 but accepts 0x56 0x00.

            Kona and i3 either don't complain about this field and accept the message or Zoe's intepreting is false. Either way the cause of the problem has been identified.



            How to use threading in python to make multiple fake access points with Scapy?
            Asked 2022-Jan-07 at 17:04

            So I've made a python program that creates a fake access point by sending lots of beacon frames using Scapy. The program works fine, but i wanted to expand it. I want the program to be able to make multiple fake access points. I tried simple threading but that didn't work out. I tried running the program on 3 different terminals and give each terminal another SSID. That worked fine, but i want my code to do that.

            Here's my code:



            Answered 2022-Jan-07 at 17:02

            So since nobody wanted to help me with my problem, i figured it out myself with simple multiprocessing. Here's my new code



            Getting all IP addresses connected to WiFi using python and scapy
            Asked 2022-Jan-05 at 03:18

            How would I get the IP addresses of all ips connected to wifi (that I am on). I tried doing it by using sniff() and getting all src IP of those packets using the following lines:



            Answered 2022-Jan-05 at 03:18

            Forgive me if I'm misunderstanding your question.. what you're trying to do is map all live hosts on your LAN?

            A simpler approach is to use the builtin ipaddress and socket libraries. For each IP in your LAN subnet, try connecting a socket to various ports (TCP/UDP). If a connection is established, a host exists at that IP.

            Here's some code I can think of that might solve your problem (I have not tested this myself)



            Scapy module not working on RPI with error: "No such file or directory: b'liblibc.a'"
            Asked 2021-Dec-23 at 05:25

            when I run anyu python using scapy fully updated it does this:



            Answered 2021-Dec-23 at 05:25

            Fore me when I updated scapy it works.



            "OSError: [WinError 10022] An invalid argument was supplied" when trying to send TCP SYN packet (python)
            Asked 2021-Dec-10 at 16:53

            Currently trying to make handshake process on python using raw sockets but for some reason I can't send any packet with TCP protocol receiving OSError: [WinError 10022] An invalid argument was supplied. Here is my code:



            Answered 2021-Dec-10 at 16:53

            I found out what is wrong. Windows doesn't allow to send TCP packets with raw sockets so this code will never work. Probably it is possible to write the same with scapy or using other libraries but that's not what I need so the only way to make it work is to run on linux. Still not sure if the packet creation is correct but TCP protocol with raw sockets sure works fine on linux.



            Python Scapy TCP SYN and TCP Port
            Asked 2021-Nov-11 at 07:31

            Anyone have a solution when using scapy to grab the tcp syn flags and store the source ip, destination ip, port number in a dictionary? I'm trying to build a tool that will take a pcap file and get that

            This is what I've tired:



            Answered 2021-Nov-11 at 07:31

            To access the port values in TCP layer you can use sport and dport. So you can adjust your code like this:



            Can't import Scapy arping() method
            Asked 2021-Nov-05 at 20:56
            from scapy.layers.l2 import arping
            from scapy.all import *
            def scan(ip):


            Answered 2021-Nov-05 at 20:56

            If you import as you have there, you'd use the name arping directly:



            Reading Raw Bytes using Scapy?
            Asked 2021-Oct-22 at 05:57

            I have a project in which I am building a DNS Forwarder.

            I am using a UDP Server socket to listen to the DNS requests on port 53 (client is using the dig command) and I have to forward the received raw DNS request to scapy for dissecting it. I know that scapy is used to forge/send/manipulate packets.

            The raw request looks something like this -



            Answered 2021-Oct-22 at 05:57

            Just initialise a DNS payload with your byte string:



            Circular import error only when importing specific function
            Asked 2021-Oct-17 at 19:07

            I am using scapy 2.4.5 and am trying to use the UDP class.



            Answered 2021-Oct-17 at 19:07


            Python Scapy - create a new protocol definition within UDP Data
            Asked 2021-Oct-07 at 02:26

            Is it possible to use Scapy's PcapReader to analyze UDP packet data with custom fields? For example, within the UDP packet Data (see attached Wireshark capture), there are the following fields of my_proto:



            Answered 2021-Sep-30 at 16:51

            as you said your protocol could like similar to that:


            Community Discussions, Code Snippets contain sources that include Stack Exchange Network


            No vulnerabilities reported

            Install scapy

            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.


            Want to contribute? Great! Please take a few minutes to read this!.
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
          • PyPI

            pip install scapy

          • CLONE
          • HTTPS


          • CLI

            gh repo clone secdev/scapy

          • sshUrl


          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link