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

Replying to packets with scapy

For a POC, I need to create a MITM setup where I would listen to ICMP traffic on the interface and for all the ping commands received, I would send my own reply. So far with python scapy, I have been able to intercept all ICMP packets. How do I…
user16490564
0
votes
2 answers

Having Issue Importing scapy.all in my file

I am having issues when importing scapy in my Ubuntu virtual machine. I can easily use from scapy.all import * in the terminal. I am using Visual Studio Code and when I hover over scapy, right click and go to defintion, it takes me to the scapy…
0
votes
1 answer

Scapy will listen on wlan0 but not wlan1 that is set to monitor mode

I have two wireless interfaces, wlan0 and wlan1. I am connected to a raspberry pi on my home network via wlan0 and I am using wlan1 as an access point to collect probe requests. I set wlan1 into monitor mode (iwconfig shows mode: Master when…
0
votes
0 answers

python network sniffer for real time applications under load of 75K packets/second

I'm developing some application based on python (mainly due to flexibility to do changes) which shall listen to data on the Ethernet, save it to the database (sqlite) and display the data in real time. The data on the Ethernet is UDP based with some…
user1977050
  • 496
  • 1
  • 6
  • 18
0
votes
1 answer

How do I get a scapy field as bytes?

I converted raw bytes into a scapy Ether instance like this: scapy_packet = Ether(data) Now I want to get the source mac address of this frame as bytes. So assuming the source mac address is 01:02:03:04:05:06, I want the same object as bytes((0x01,…
Jolly
  • 199
  • 6
0
votes
1 answer

Argparse or sys.argv - Check for incorrect CLI argument

How can I check if an CLI argument has been entered incorrectly using argparse or sys.argv and then print something? The arguments are: --remote_host google.com --verbose 0 (or verbose 1 for full verbosity...) or --help #!/usr/bin/env…
IlludiumPu36
  • 4,196
  • 10
  • 61
  • 100
0
votes
1 answer

Scapy Port Scanner - Set verbose mode in command line

I have the following script scanning a host's ports. Verbose mode is set initially to off verbose=0. I want the user to be able to add '-verbose' in the command line to enable verbosity. How should this be done? import…
IlludiumPu36
  • 4,196
  • 10
  • 61
  • 100
0
votes
2 answers

Having a problem with my scapy port scanner using sys.argv

This is for my python class, I'm trying to make a port scanner that can scan TCP ports when the user enters an IP address, address range or domain on PowerShell. Here is what I have done so far: import sys from scapy.all import* if len(sys.argv) <…
0
votes
0 answers

why my import scapy.all is not working at all?

My scapy is not working at all. I don't know what the problem. I already install "pip install scapy" but it still persists in not working. I install the scapy in my pyserver/venv/Scripts. Im using windows for my laptop. from scapy.all import * ip =…
Odain
  • 1
  • 2
0
votes
0 answers

Figuring out what kind of payload is carried by a packet

I'm working with Scapy to parse a set of .pcap files. I would like to understand what kind of payload those packets are carrying. If I have for example a pcap file with a lot of UDP packets which payloads has the same starting bytes I don't know…
fd1004
  • 1
  • 1
0
votes
0 answers

python/scapy - packets sent but unable to receive them

I'm trying to do an ARP scan and print MAC addresses of reachable IP addresses. Here's the part of my code where I use ARP ping method : ans, unans = srp(Ether(dst="ff:ff:ff:ff:ff:ff")/ARP(pdst="192.168.1.0/24"),timeout=2) ans.summary(lambda s,r:…
0
votes
2 answers

Is there a way to capture packets in background and send packets using scapy?

I am trying to capture incoming packets while sending continues packets in an interface (interval - 1 pps) using scapy. I tried sniff function with different parameters associated with it (ex. prn). But it didn't worked, since sniff not completes…
0
votes
0 answers

scapy sniff doesn't find any devices on VM

I'm trying to sniff in VM in Ubuntu, using Wifi Adapter Card in Python. The sniffing takes a lot of time, and does not show any available devices. I installed the latest version of SCAPY. the is code below: (in the interface i put the wlan of the…
0
votes
1 answer

How to send ldap searchquery with Scapy?

I have a question related to the ldap protocol. Is it possible to send a ldap / c-ldap searchquery using scapy? Kind regards Benshii
Benshii
  • 1
  • 4
0
votes
0 answers

DLT error when reading pcap file created with Scapy

I have created a pcap file using Scapy with some dummy values like pkt = IP(dst="116.73.117.174", src="239.50.50.12") / UDP(sport=10812, dport=42)/ Raw(load=b"Data")) pkt.show2() # Calculates checksum wrpcap('DATA.pcap', pkt, append=True) But when…
DrBug
  • 2,004
  • 2
  • 20
  • 21