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

Minecraft packet sniffing in python

My aim is to sniff through the Minecraft packets in python and decode the data to get this information: The server the person is playing on The player's coordinates on that server The direction the player is pointing The player's health So far,…
Fred Peters
  • 91
  • 1
  • 7
0
votes
2 answers

How can I spoof a Ping reply with Scapy?

What's the simplest way to spoof a ping reply with Scapy? I have a compiled script that keep pinging a certain domain and I need to investigate it's behavior when it receive a ping reply. I thought Scapy would be my best option to do so, but I can't…
B. Bergeron
  • 90
  • 1
  • 10
0
votes
1 answer

How to send command using scapy?

I am learning on how to do reverse shell using scapy by using spoofed IP address(legitimate host) and mac address. I am using this command : send(IP(src="192.168.0.114",dst="192.168.0.113")/TCP(sport=54484,dport=23,seq=2034533561,ack=1565253469)/…
Vikram
  • 1
0
votes
1 answer

Increasing packet size by 2 byte with scapy

I'm new to using scapy and I want to create a little program that sents packets that start with a size of 2 Byte and each next packet increases it's size by 2 byte. I know that i can define a payload variable and put it as a parameter, but how can I…
Kaiser
  • 15
  • 1
  • 5
0
votes
2 answers

for loop stuck at the first items in the list - python

i would like to create script to extract IP and MAC address from ARP protocol (passive Scan) i used python3.8 and scapy 2.4.4 on debian. The code that I use returns all addresses, but I want it to print out the IPs/MACs without repetition, so i…
3mSoft
  • 1
0
votes
0 answers

Traceroute Implementation on Python

So I've been trying to understand how this code works using Scapy on Python as I am trying to create a similar traceroute for my project. However, this does not work. I tried printing the reply type and it shows '11' in between hops. Does anyone…
0
votes
0 answers

Python returns error on scapy.IP and scapy.TCP call

I am taking an online course on ethical hacking and i am trying to make a program in python that injects code into html, at this moment i am at the decoding HTML response stage. def process_packet(packet): scapy_packet =…
Ptmlol
  • 37
  • 2
  • 6
0
votes
0 answers

Sniff Network (ARP) Traffic using scapy.sniff

I am trying to sniff ARP traffic on the network and I'm using scapy.sniff() for the purpose. Following is the code I have written to do this. #! /usr/bin/python3 from scapy.all import * import logging as log def arp_display(pkt): #if…
Zaid
  • 79
  • 10
0
votes
1 answer

selenium search the item under one special class, href link

I am trying to get some link for the website https://web.archive.org/web/*/https://cd.lianjia.com/, I want to get the link for each date, import pandas as pd from selenium import webdriver from selenium.webdriver.common.action_chains import…
0
votes
0 answers

Scapy tcp checksum marked incorret by wireshark

I've been changing content of packets, and setting the tcp.chksum back to None at the end of it. The checksum is recalculated as expected, but when (pcacap) loaded into Wireshark, the checksum is marked as incorrect. This is my packet (will call it…
Zerg Overmind
  • 955
  • 2
  • 14
  • 28
0
votes
1 answer

I'm try an arp spoofing attack with scapy, but my target arp table register my ip address instead the spoofed one

I'm trying to make an arpspoofing attack with scapy. I'm working with virtualbox in Linux Min OS, My attack machine is KaliLinux and my target is Metasploitable. This is my scapy…
0
votes
1 answer

Counting the number of SYN and ACK packets using Python and Scapy

I am analysing a pcap file using Python and Scapy. Currently, I have it counting the number of packets I would like to count the number of SYN and ACK packets, is there a way to do this? My main piece of code thus far is for (pkt_data,…
Alister
  • 29
  • 3
0
votes
0 answers

Can you send packets on Mac OS using Python?

I am trying to broadcast packets from my Mac OS running the latest version using scapy. I have another computer sniffing for the packets I send. I make the packet a Deauthenication packet because not many travel over a network, making it much easier…
Sam Moldenha
  • 463
  • 2
  • 11
0
votes
1 answer

Accessing Fields in scapy DHCP request

I've decided to try to request an IP using scapy. I am able to send out a discover and receive an offer in the variable ansD. Unfortunately I'm having trouble accessing the field that contains the offered IP address which should be…
Wilky
  • 35
  • 1
  • 5
0
votes
1 answer

python scapy "unknown pypcap network interface '\\Device\\NPF_Loopback'"

I've an issue with scapy trying to run the following code: if __name__ == '__main__': sniff(filter="ip",prn=packet_received, count=10) (assume that packet_received is the callback method) I expect to get some packets but I got this…
DBS
  • 151
  • 2
  • 18