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
2 answers

Scapy BitField and type() question

I'm writing an addon for scapy, and encountered a problem. I had to slightly modify the original scapy code (every class is inheriting from object) The modified code can be found here: http://pastebin.com/pjcL1KJv The code I wrote is the…
Steve
  • 549
  • 1
  • 5
  • 8
0
votes
1 answer

Netfilterqueue, set_payload does not change packet with python3

I am trying to alter raw.load in a UDP packet using NetfilterQueue (ver. 0.8.1) and Python3 (ver. 3.7.3). Scapy ver. is 2.4.4 Destination server runs tcpdump to sniff incoming packets but nothing arrives. My script can capture packets from nfqueue…
seq16
  • 17
  • 4
0
votes
1 answer

How to decode data from "scapy_packet [scapy.Raw] .load" into a string for modification?

I am trying to write a program that inserts a small script into a web page, before .But the data that is stored in scapy_packet [scapy.Raw] .load is of type bytes. I am trying to decode them to a string, but I always get an error: File…
0
votes
1 answer

Extracting 802.11 data frames in python with the help of scapy

I am trying to use Scapy to analyze a .pcapng file. I have a setup of a client and server that communicates wirelessly. i.e the client is sending data to the server. I have a separate node where I used Wireshark (in monitor mode) to capture the…
Madde
  • 471
  • 1
  • 7
  • 22
0
votes
1 answer

Scapy bind_layers using a layer condition outside the binding scope

I'm new to Scapy so maybe this is written down somewhere but I can't find the answer. I'm trying to create a custom packet dissector but in order to bind specific layers to each other I need to do it on condition of a value in a deeper layer. I have…
Chef Flambe
  • 885
  • 2
  • 15
  • 35
0
votes
2 answers

Not able to download scapy-python3-0.26 in kali linux

I have installed scapy-python3-0.26 tar.gz file from here---> https://pypi.org/project/scapy-python3/#filesthen i did cd /Downloads/scapy-python3-0.26 then i allowed all permissions to the file by chmod +x subfile name then i wrote python3 setup.py…
0
votes
0 answers

Scapy http layer not importing correctly

I'm using Scapy version 2.4.0, and I have this following problem: NameError: global name 'HTTPRequest' is not defined When I try to do this in the code: if packet.haslayer(HTTPRequest): Even though I'm using the wildcard import: from scapy.all…
Johni
  • 23
  • 4
0
votes
1 answer

Scan all clients that connected to specific WIFI

Running everything on kali. I found all wifi networks nearby and their BSSIDs. I am using a network card with monitor mode on. Now I want to find all clients that connected to that specific BSSID Here is how this achieved with…
Alexander Gorelik
  • 3,985
  • 6
  • 37
  • 53
0
votes
1 answer

How to print protocol name instead of corresponding number in pyshark?

import pyshark pkt = pyshark.FileCapture('mypacket.pcap') pkt[1].ip.proto output: 17 I would like to print 'UDP' instead of '17'
Pankaj
  • 43
  • 4
0
votes
1 answer

Scapy not working with Python 3.6. Import problems with Python?

I am trying to test a simple code that will inspect a .pcap file using scapy. My OS is Ubuntu 18.04 and my Python version is 3.6. However when I do: from scapy.all import * I get the error message ModuleNotFoundError: No module named…
Vic
  • 33
  • 1
  • 9
0
votes
1 answer

Writing a network Scanner with python using scapy

I am writing a simple network scanner with python using scapy following is my code : import scapy.all as scapy def scan(ip): scapy.arping(ip) scan("192.168.1.1/24") Error I am getting : Traceback (most recent call last): File…
Omair
  • 7
  • 5
0
votes
0 answers

Send sniffed packets with scapy

I am writing a program which uses scapy to read a pcap file. I can operate on each packet with my custom function, some which I discard and don't want at all. My goal is to do whatever I need to do to a packet and if I need, send it through my lo…
nachofest
  • 23
  • 1
  • 2
  • 6
0
votes
1 answer

Adding sequence numbers to Dot11 traffic

I'm trying to write a tool to do simple deauth attacks. This is my work-in-progress code: from scapy.all import * from scapy.layers.dot11 import Dot11, RadioTap, Dot11Deauth from time import sleep AP_MAC = 'THE_VICTIM_MAC' VICTIM_MAC =…
Carcigenicate
  • 43,494
  • 9
  • 68
  • 117
0
votes
0 answers

Does scapy works on macOS without problems?

I have the following output on macOS. It keeps on printing dots. Does anybody know how to check what is wrong? >>> a, b = sr(IP(dst="www.target.com")/TCP(sport=[RandShort()]*10)) Begin emission: .........Finished sending 10…
user1424739
  • 11,937
  • 17
  • 63
  • 152
0
votes
1 answer

Why are there multiple IP addresses for a IP object?

In scapy, I see the following. >>> a=IP(dst="www.slashdot.org/30") >>> [p for p in a] [, , , ] But I don't see multiple targets with dig. Does…
user1424739
  • 11,937
  • 17
  • 63
  • 152