0

I want to send the captured packets to another PC in my local network. When I run it I keep getting the Output:

Sent 1 packets.

Over and over, but in Wireshark I dont see any packets going to the IP-Adress 192.168.0.5... Not sure what is wrong.

#!/usr/bin/env python3
from scapy.all import sniff, send

def spoof_and_send(packet):
    packet[0][1].dst = '192.168.0.5'
    send(packet)

packets = sniff(filter='udp and portrange 6000-7999', prn=spoof_and_send)
Dala Laa
  • 1
  • 2

1 Answers1

0

You cannot use the original Ethernet header:

def spoof_and_send(packet):
    datagram = packet[IP]
    datagram.dst = "192.168.0.5"
    send(packet)

Moreover, if you use this code you are going to receive the packets you create. You need to filter those out to avoid loops.

Martín Gómez
  • 338
  • 2
  • 9