Questions tagged [scapy]

Scapy is a network packet manipulation tool for use with Python.

What is Scapy?

Scapy is a network packet manipulation program for use with Python. It is able to:

  • forge or decode packets of a wide number of protocols
  • send them on the wire, capture them, match requests and replies, and much more. 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, tethereal, p0f, etc.)

What makes scapy different from most other networking tools?

  • You can build whatever packets you want, stack ARP on top of 802.11, use double 802.1q encapsulation or send an ICMP packet with padding, and send them over the wire.

  • Scapy does not interpret answers: unlike most tools, it won't say “this port is open” instead of “I received a SYN-ACK”. You are free to interpret the packets as you want

  • It reports everything: you see the padding, the reserved fields... Nothing is dismissed


Useful links:

2198 questions
0
votes
1 answer

How to Install Scapy_http for python 3 windows

I can't seem to install scapy_http on my windows machine. I have installed scapy-http (Please note the difference), but it doesn't work. I always get this error when trying to install scapy_http: ERROR: Command errored out with exit status 1: …
Mario
  • 53
  • 5
0
votes
1 answer

Scapy 2.4.4 - Py 3.7.9 - TypeError: can't concat str to bytes

I'm using Python 3.7.9. I'm trying to use scapy by adapting the code found in this link (for the credits): https://cabeggar.github.io/2016/02/21/DHCP-starvation-with-ScaPy/ from scapy.all import * from time import sleep from threading import…
Alex
  • 65
  • 9
0
votes
1 answer

Scapy Ethernet padding layer lost when write to pcap file

when I try to modify IP header field using Scapy and write the modified packet to pcap using wrpcap, the Ethernet Padding layer is changed to Raw. The packet's show function shows the Padding layer: pktn.show() ###[ Padding ]### load =…
Zhen
  • 1
  • 2
0
votes
1 answer

Undrstanding simple bytes output from scapy

I'm trying to print the payload of packets from IP 192.168.1.198 that have a payload: from scapy.all import * packets = rdpcap('capture1_bug.pcapng') payloads = [] for packet in packets: if IP in packet: ip_src=packet[IP].src …
Guerlando OCs
  • 1,886
  • 9
  • 61
  • 150
0
votes
2 answers

Python scapy sprintf syntax

ans,uans=srp(Ether(...)/ARP(pdst="x.x.x.x"),...) for snd,rcv in ans: return rcv.sprintf(r"%Ether.src%") Let's say I find the mac address of an IP using the above method. What does r in sprintf() mean and what is returned here? This may be a…
Kingslayer
  • 53
  • 1
  • 8
0
votes
1 answer

How to save ICMP data in a python variable

I have the following script. It uses scapy to create a ICMP packet. My end goal is to copy the data returned into a variable. But when I try to print the end variable, it shows nothing. I am not understanding what I am missing here. Code: from…
Neil Roy
  • 17
  • 5
0
votes
1 answer

scapy not working on windows/parrotsec (pycharm)

I have been writing a network scanner using pycharm and it seems to be having issues when trying to run the code: As with all of my other post I have googled excessively but have not found out how to fix the problem yet. I have tried this using…
Ooo
  • 39
  • 9
0
votes
0 answers

ImportError: cannot import name cast

I am making a call to my python script via Java using jython . The python script has a scapy module (Python version : 2.7) . When I make a call using the below code ,I receive the below exception from scapy.all import * File…
arpit joshi
  • 1,987
  • 8
  • 36
  • 62
0
votes
1 answer

how to fix Scapy.all has no attribute for arp in kali linux?

how to fix this please i have tried to install necessary tools to the virtualenv it's still the same i tried to download scapy on linux terminal, still the same #!/usr/bin/env python import scapy.all as scapy def scan(ip): arp_request =…
0
votes
1 answer

Create a client by using Scapy on MQTT

I'm working in order to create a legitimate client by uscing scapy for a MQTT network. I implemented the 3-way handshake and a possible connection with the MQTT broker (the broker is fully working, i tested it with another client). Here my…
NoName91
  • 29
  • 5
0
votes
1 answer

TLV VLAN corrupted or missing for STP via scapy

i need to generate an STP traffic but when I capture it via wireshark it says that tlv (tag-length-value) of the vlan is missing and tlv record is truncated prematurely this is my code: sendp(Dot3(dst="01:00:0c:cc:cc:cd",…
newbie
  • 646
  • 8
  • 27
0
votes
0 answers

Unable to run thes scapy program gone through various solutions but nthing works

import scapy.all as scapy def scan(ip): scapy.arping(ip) scan("192.168.0.1/24") error:ModuleNotFoundError: no module named as 'scapy'
0
votes
1 answer

Convert PCAP to MAC addresses in Python

I'm tryng to read a Pcap file, and after that I get the Ip's and the realtions between Ip's, I want to transform these relattions in MAC relations but I'm not sure how I have to do it. trafico= rdpcap('example-01.pcap') unique_streams =[] for frame…
othali
  • 3
  • 5
0
votes
1 answer

STP traffic generation [Malformed Packet] with scapy & wireshark

I am trying to generate an STP packet and to capture it with wireshark, this is my code: from scapy.all import STP import scapy from scapy.all import * sendp(Dot3(dst="01:00:0c:cc:cc:cd", src="08:17:35:51:29:2e")/LLC(dsap=0xaa,…
newbie
  • 646
  • 8
  • 27
0
votes
1 answer

Configure STP protocol via scapy

I need to generate and STP traffic using scapy and when I visualize it via wireshark I get an output similar to the caption shown below: when I run this code: from scapy.all import STP import scapy from scapy.all import…
newbie
  • 646
  • 8
  • 27
1 2 3
99
100