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

Scapy unable to properly parse packets in monitor mode

I'm currently trying to scan over all available channels while in monitor mode to find IP traffic on open networks around me. I noticed that IP in sniffed_packet was never true, and after some debugging, found that frames aren't being parsed…
Carcigenicate
  • 43,494
  • 9
  • 68
  • 117
0
votes
1 answer

Why do I have extra data in my Python Scapy Packet. only wanted to send the last 8 bytes

import time import binascii import time from scapy.all import * import socket from openpyxl import load_workbook filepath = "c:/Users/Don/PycharmProjects/HVACSCHEDULE-PLUS/Updates.xlsx" wb = load_workbook(filepath) print(wb.sheetnames) sheet =…
Don Odom
  • 11
  • 2
0
votes
1 answer

Better way to load all Scapy layers instead of loading one by one

I am using scapy as packet decoder tool. By default it doesn't load certain layers, so I have to specify explicitly in the…
brokenfoot
  • 11,083
  • 10
  • 59
  • 80
0
votes
0 answers

Using Python scapy to establish TCP connection, we found a strange problem

Environment:CentOS7 / Python 3.6.8 / Scapy 2.4.5 Server IP:192.168.182.128 Client IP: 192.168.182.129 Both firewall and SELinux have been shut down Server bind port 5000 # server bind ncat -l -v -p 5000 # Server tcpdump tcpdump -nn port…
ak_neo
  • 1
  • 1
0
votes
0 answers

PyCharm Unresolved reference 'Ether' in scapy

I am trying to make packet and I have red line under the "Ether" that says "Unresolved reference 'Ether'" but the code works just fine. someone know how to I fix it? from scapy.all import * def dns_req(domain): mas = Ether() …
roee
  • 39
  • 5
0
votes
0 answers

Why my import for scapy doesn't work in python 3.8?

I tried do build a program that pings a website and print the answer. I expected that it'll ping google.com, but instead in the 1st line I get Attribute Error. Traceback (most recent call last): File "d:\Magshimim\Networks Programming\Lesson…
0
votes
1 answer

Http request with scapy

I need to implement http request with scapy for a school assignment. Everything works until I need to acknowledge the http segments and close the connection. It is mandatory to use scapy and manually open and close the tcp connection. In wireshark I…
0
votes
1 answer

Scapy cannot sniff from all interfaces

I am trying to sniff from all interfaces using scapy, but when I attempt to provide a list of interfaces I get below Error: sniff(iface=["eth1","eth2"], prn=lambda x: x.sniffed_on+": "+x.summary()) File…
hashy
  • 175
  • 10
0
votes
1 answer

python eel is not working when run as root

I am working on a project with eel and scapy. for scapy sniff, root access is required. I've created virtual environment. scapy part runs fine with root. eel part runs fine without root. but when I tried running eel part with root, nothing is…
0
votes
1 answer

scapy - how to read packet field as enum

I've defined my own protocol with fields. Some of the fields are enumerated. When executing pkt[0].show(), I see the value in enum as expected. Now, I'd like to have some logic based on the this enum filed. The elegant way to write my code is using…
user1977050
  • 496
  • 1
  • 6
  • 18
0
votes
1 answer

Can't run both flask and scapy

The need is server takes it network data and send it all the client and the client shows the data. This is server code. from flask import Flask from flask_cors import CORS from flask_socketio import SocketIO, send import scapy.all as scapy app =…
Subramanya G
  • 39
  • 2
  • 8
0
votes
0 answers

Remove TCP option using scapy

I'm using scapy and NetFilterQueue to manipulate IP packets between client and server. I would like to remove the last option in the TCP header option field list. Removing an option in the TCP header changes the size of the packet and whenever I…
Vencat
  • 1,272
  • 11
  • 36
0
votes
0 answers

Scapy & Docker: Get container's IP address w/o using Container ID?

What is the easiest way to compare IP addresses using Scapy (in Python3.6) and Docker? I have a piece of code that sniffs my Docker bridge network using Scapy sniff(). I want to look at each packet's source IP address, and if it matches the IP…
Vic
  • 33
  • 1
  • 9
0
votes
1 answer

How do I set the IP range for Scapy Sniff filter?

I try to do the below filter in my Sniff function: pkt = sniff(count=1, iface='Qualcomm Atheros QCA61x4A Wireless Network Adapter', filter='host 178.0.0.0/8') try: …
mansis
  • 23
  • 3
0
votes
0 answers

Scapy: How to access a layer's field that has been calculated via post_build()?

I am currently in the process of writing a few custom scapy layers to dissect/build packets for a protocol and I have it mostly working. Since the protocol sits on top of TCP, I've been using a StreamSocket to send/receive the packets, like so: from…