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

Why is my scapy deauth function not working?

When I run this function I am still able to refresh any page, watch videos online, the devices on my network do not get disconnected, isn't this function supposed to dos all devices over the access point, I can see the packets in wireshark but i do…
0
votes
1 answer

Sniff RTS's and send CTS in return with Scapy

I'm able to sniff RTS packets without a problem. I'm also able to utilize 'sendp' to send CTS packets. What I'm unable to figure out is how to have Scapy sniff RTS packets and reply to those RTS's with a crafted CTS in real-time. The intent is to…
rhax07
  • 11
  • 1
0
votes
2 answers

Scapy read packets from bytes

I receive in real-time a list of raw packets (bytes) and I want to parse them into scapy without having to write and read them from a pcap. Here the answer is to use Ether if the first layer is Ether, but what if not? For example: >>>…
0
votes
1 answer

scapy independent layers, no encapsulation

I try to create a protocol, and I have some understanding problems. I created a class for every layer. Then I created some methods that build the packets for me, by stacking the layers one above the other. When I create a packet: a=Foo()/Bar() (or…
Martin
  • 143
  • 2
  • 7
0
votes
0 answers

Is there an alternative function other than rdpcap to read pcap files using scapy?

I am trying to read the pcap files using Scapy in Python. I have a set of pcap/pcapng files. Few of them work just fine when rdpcap is used. Few of them throw this error. Exception has occurred: OSError [Errno 22] Invalid argument I tried using…
EngGu
  • 459
  • 3
  • 14
0
votes
1 answer

Is there any difference between using a Raw layer, and simply attaching a string to a packet?

Is there any difference between explicitly using Raw, and simply using a string/bytes object in its place? Or in other words, is there any difference between these two lines? p1 = ARP(pdst="192.168.72.102") / "Some Test Data" p2 =…
Carcigenicate
  • 43,494
  • 9
  • 68
  • 117
0
votes
0 answers

Generate MacSec traffic via scapy

I need to generate MaACsec traffic via scapy, I've tried to follow scapy.contrib.macsec . Here is what i tried: import scapy.all as scapy from scapy.layers.inet import Ether from scapy.contrib.macsec import MACsec from scapy.layers.inet import IP,…
newbie
  • 646
  • 8
  • 27
0
votes
1 answer

Scapy, Pycharm issue needs solving [Cannot find reference 'ARP' in 'all.py']

Right... I've previously had this working correctly after about two days of slamming my head off my keyboard.... However, my SSD failed and I lost all my VM's and I dont remember what I did to solve this problem. After doing some research, I've came…
Rochie
  • 23
  • 6
0
votes
1 answer

ARP packets with scapy are unanswered

I'm building a network scanner with Python using Scapy. I've been trying to send ARP packets but for some reason they don't get responded to. #!/usr/bin/env python3 from scapy.all import * def scan(ip): arp_request = ARP(pdst=ip) broadcast…
0
votes
1 answer

Get network address of connected interface with Python

How could I get the current network address of a specific interface (not the ip address, but the network address) ? For example, if I run the following command on terminal ip a show | grep inet I get a result similar to this.nn inet…
whatspoppin
  • 353
  • 4
  • 14
0
votes
1 answer

Scapy DHCP-Discover results in malformed packet

I am new to networking. And have found using scapy a great way to learn different protocols. I am trying to send a DHCPDISCOVER packet, however in wireshark it comes out as a malformed packet. Here is the code I use to construct the packet (my MAC…
0
votes
0 answers

scapy sniffing doesnt catch what wireshark catch

I'm programing in python 2.7 and i have tried to write a function which asking for ip address from the DHCP server, the problem is that after I'm sending the packet and do sniffing for DHCP offer the sniffing doesn't catch it(i can see the offer on…
0
votes
1 answer

Change IP in ICMP scapy

I have this ICMP packet and I want to change IP in ICMP field (I've also tried to understand what this inner IP header is), how do I access it? I've tried things like pack[ICMP].fieldname but nothing works so far. ###[ IP ]### version =…
Kuze
  • 41
  • 1
  • 6
0
votes
0 answers

Scapy is not scanning all device in my network

I am Using Kali Linux to run this programme scapy is not able to scan my network . In my Router there is about 5 device connected . 2 are pc and rest are mobile phone . But scapy only shows a Router Ip and My Windows Machine IP. here is the code…
Ramesh A
  • 13
  • 4
0
votes
1 answer

Specify MTU value

I'm trying to pentest some IPSEC implementation for a uni project, and following this guide I'm stuck at: Step 1 (common): Forging an ICMP PTB packet from the untrusted network The attacker first has to forge an appropriate ICMP PTB packet (a…
Kuze
  • 41
  • 1
  • 6