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

How to add IP sniffing filter in Scapy (Python)

I'm trying to write a code in Python using Scapy, which will do the following: Given ip1, ip2 - 2 IPv4 addresses, sniff all of the packets which their source IP is ip1 and their destination IP is ip2, using Scapy.sniff(). Even though I've tried to…
Amit Gabay
  • 106
  • 2
  • 10
0
votes
0 answers

Scapy Packet Based HTTP Client Not Showing HTML?

I've looked at: How to create HTTP GET request Scapy? Python-Scapy or the like-How can I create an HTTP GET request at the packet level So you send syn to get syn-ack, then you send ack along with the HTTP load. And then the reply is this:
John Hao
  • 3
  • 2
0
votes
1 answer

How to send a packet over and over until response (Scapy)

I've built an ARP packet in Scapy (using Python), and I'm trying send this packet over and over, nonstop, until receiving and answer from the destination, saving the response and breaking out of the loop. I tried to google it with no success.…
Amit Gabay
  • 106
  • 2
  • 10
0
votes
1 answer

Remove Duplicate IP Addresses with Scapy

I have a script to listen for incoming traffic and print out only the string “IP 1.1.1.1 53" when a packet hits the line. But now that I’m doing IP resolve on the IPs, I need to access the “ip_src” variable and only do the geolocation once on each…
Anycast
  • 3
  • 2
0
votes
0 answers

Access RAW field for each packet

For a personnal project, I need to capture packets. I've done it on the port I put as an example in the code below that I tested. The application I'm interested in communicates on this port and as soon as it's on (and the program is running), I have…
Pampah
  • 1
  • 1
0
votes
0 answers

Scapy http_request "Failed to open URL"

Im working on creating a Scapy script that does the three-way handshake, GET request, and then finally grabs the contents of a file via HTTP_request thats on a remote apache server, and then display it in the browser on my machine. I've managed to…
giruz
  • 1
  • 1
0
votes
1 answer

Help in scapy and pcapy

I am new to scapy and pcapy. As a project I have to send an ICMP packet using scapy and capture it using pcapy. I have to compare timestamp between sender and receiver to calculate delay in network. I have no clue how can I do this. Any help will be…
Chetan
  • 141
  • 1
  • 1
  • 4
0
votes
1 answer

Scapy sending multiple packets when only one is specified

I'm sending a simple ARP request using Scapy. I noticed that it will send multiple packets out though, even when I've only given it a single packet: from scapy.sendrecv import sr1 from scapy.layers.l2 import ARP from typing import Optional def…
Carcigenicate
  • 43,494
  • 9
  • 68
  • 117
0
votes
1 answer

How to get TCP-Timestamp (TSval) using python

I've searched in several places, but I didn't find a simple answer to this question - I have a .pcap file, generated using Wireshark, with several packets in it, and I wish to extract from each packet it's TCP-Timestamp (TSval). I've managed to open…
adsl
  • 123
  • 7
0
votes
1 answer

Python Scapy wireless scan and match a mac address stored in text file

I have some code that will scan for wireless packets and displays the mac address from each of them. What i would like to do is have a text file of mac addresses and for the code to alert me with a message when one of the addresses in the file is…
K.Meleo
  • 25
  • 1
  • 1
  • 8
0
votes
1 answer

How to capture and send packets via Macbook

I want to capture and send some packets to the access point for testing purposes. I have the packet captures made via wireshark but I do not know how to proceed to be able to send these packets from my macbook. I tried things like scapy, colasoft…
Rekha R
  • 131
  • 1
  • 1
  • 12
0
votes
1 answer

How to verify if a packet in scapy has a Raw layer?

Hello all this is my code: #!usr/bin/env python import scapy.all as scapy from scapy_http import http def sniff(interface): scapy.sniff(iface=interface, store=False, prn=process_sniffed_packet) def process_sniffed_packet(packet): if…
0
votes
1 answer

why am I getting an index error saying my list is out of range when writing an ARP spoofing attack?

I'm trying to get the mac address to be automatically added to the spoof and restore function instead of typing it manually. Not too long ago it worked fine but now it doesn't. The "get_mac" function works by itself but not when I add it this code.…
0
votes
4 answers

ARP in scapy not working, and getting an error Cannot find reference 'ARP' in 'all.py

just wanted to see if there’s a way to resolve a warning i get in pyCharm. Currently watching Learn python & ethical hacking from scratch: Using Scapy To Create an ARP Request. When using import scapy.all as scapy arpRequest = scapy.ARP() I’m…
0
votes
0 answers

Common Industrial Protocol, Python Scripts failing

Context -- I have been running python automation scripts for Common Industrial Protocol using scapy as the means to create packets in this format. There were no problems running the scripts in a python 3.4 environment, but when trying to migrate to…