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
34
votes
4 answers

Unwanted RST TCP packet with Scapy

In order to understand how TCP works, I tried to forge my own TCP SYN/SYN-ACK/ACK (based on the tutorial: http://www.thice.nl/creating-ack-get-packets-with-scapy/ ). The problem is that whenever my computer recieve the SYN-ACK from the server, it…
user1177093
  • 343
  • 1
  • 3
  • 5
32
votes
3 answers

Python-Scapy or the like-How can I create an HTTP GET request at the packet level

I am a moderate programmer, just getting into network programming. As an attempt to improve my understanding of networks in general, I am trying to perform several basic HTTP actions from the packet level. My question is this: How might I use a…
Trimiert
  • 338
  • 1
  • 3
  • 6
32
votes
5 answers

Scapy installation fails due to invalid token

I have recently taken up learning networks, and I want to install scapy. I have downloaded the latest version (2.2.0), and have two versions of python on my computer- 2.6.1 and 3.3.2. My OS is windows 7 64 bit. After extracting scapy and navigating…
mikibest2
  • 508
  • 1
  • 4
  • 9
30
votes
7 answers

Running Scapy on Windows with Python 2.7

I like to use Scapy with Python v2.7 under Windows 7. How can I install the required module pypcap for Python 2.7? Will it be possible to make Python scripts depending on Scapy into standalone Windows applications using a distribution tool such as…
user186477
  • 1,039
  • 3
  • 11
  • 13
26
votes
4 answers

Sending packets from pcap with changed src/dst in scapy

I am trying to send a previously recorded traffic (captured in pcap format) with scapy. Currently I am stuck at striping original Ether layer. The traffic was captured on another host and I basically need to change both IP and Ether layer src and…
Jason Bart
  • 311
  • 1
  • 3
  • 6
22
votes
5 answers

How to calculate a packet checksum without sending it?

I'm using scapy, and I want to create a packet and calculate its' checksum without sending it. Is there a way to do it? Thanks.
Dima.Go
  • 472
  • 2
  • 7
  • 17
21
votes
1 answer

Scapy on PlanetLab

Has anybody ever succeeded in using Scapy on a PlanetLab node (running Fedora 12)? I am aware of the safe raw socket restrictions, but it seems that I can send packets through Scapy by just setting conf.L3socket=L3RawSocket. As for the reception of…
Ricky Robinson
  • 21,798
  • 42
  • 129
  • 185
20
votes
1 answer

Understanding the Scapy "Mac address to reach destination not found. Using broadcast." warning

If I generate an Ethernet frame without any upper layers payload and send it at layer two with sendp(), then I receive the "Mac address to reach destination not found. Using broadcast." warning and frame put to wire indeed uses ff:ff:ff:ff:ff:ff as…
Martin
  • 957
  • 7
  • 25
  • 38
19
votes
5 answers

Scapy installation fails on osx with dnet import error

Having trouble installing Scapy and it's required dependancies. I have spent some time Googling for a solution but all 'solutions' seem to affect older versions of Python, or simply do not work. Script: #!/usr/bin/python import threading import…
3therk1ll
  • 2,056
  • 4
  • 35
  • 64
18
votes
1 answer

How can I call the send function without getting output?

Does anyone know how to send a packet using scapy and not receive any output? This is the command: send(packet, iface="eth0") This is the output Sent 1 packets. I'm trying to get it not to print the packet count line at all.
CBaker
  • 830
  • 2
  • 10
  • 25
18
votes
1 answer

scapy get packet's arrivals time

Is there a way to get the packet's arrivals time using scapy? Using scapy to read the pcap file and I want to know all the packet's arrivals time because as we know wireshark can see it. So I guess there must be a way. Anyone know?
leong
  • 339
  • 3
  • 5
  • 12
17
votes
1 answer

How to create a Scapy packet from raw bytes

Using the python packet parsing/sniffing tool Scapy, I would like to create a packet from a raw byte-string. While the details of my specific use-case are more realistic, the following example illustrates my problem and my present attempt: # Get an…
icfy
  • 173
  • 1
  • 1
  • 6
16
votes
2 answers

pypcap support for python 2.7?

I want to install Scapy on Windows using Python 2.7, but the required package pypcap doesn't support Python 2.7. Is there a patch or a workaround to be able to install pypcap on Python 2.7?
SourD
  • 2,771
  • 7
  • 28
  • 28
16
votes
4 answers

Get TCP Flags with Scapy

I'm parsing a PCAP file and I need to extract TCP flags (SYN, ACK, PSH, URG, ...). I'm using the packet['TCP'].flags value to obtain all the flags at once. pkts = PcapReader(infile) for p in pkts: F = bin(p['TCP'].flags) print F,…
auino
  • 1,644
  • 5
  • 23
  • 43
15
votes
2 answers

How to check for presence of a layer in a scapy packet?

How do I check for the presence of a particular layer in a scapy packet? For example, I need to check the src/dst fields of an IP header, how do I know that a particular packet actually has an IP header (as opposed to IPv6 for instance). My problem…
Mr. Shickadance
  • 5,283
  • 9
  • 45
  • 61
1
2 3
99 100