Reputation: 33
i have collected packets from networks and i saved it to file *.pcap I want to change src and dst ip address and send it to network. I wrote a simple script:
#! /usr/bin/env python
from scapy.all import *
from scapy import *
from scapy.utils import rdpcap
from scapy.utils import wrpcap
packets = rdpcap("/root/Desktop/500000pkt.pcap", 1000)
for pkt in packets:
if pkt.haslayer(IP) == 1:
pkt[IP].src = "10.0.1.2"
pkt[IP].dst = "10.0.1.1"
#for pkt in packets:
# pkt.display()
wrpcap("/root/Desktop/500000pkt_changed.pcap", packets)
sendpfast(packets)
I am using eth1 interface. After execute this script i see it:
WARNING: No route found for IPv6 destination :: (no default route?)
sending out eth1
processing file: /tmp/scapylUGae4
Actual: 1000 packets (627010 bytes) sent in 0.09 seconds. Rated: 6966778.0 bps, 53.15 Mbps, 11111.11 pps
Statistics for network device: eth1
Attempted packets: 1000
Successful packets: 1000
Failed packets: 0
Retried packets (ENOBUFS): 0
Retried packets (EAGAIN): 0
In wireshark i observe network flow but nothing happens. Its silence. Ping from computer to router is successfull.
What i doing wrong? Can anyone help?
Upvotes: 0
Views: 2890
Reputation: 3356
remove the chksum
field to force scapy to re-calculate it.
del pkt[IP].chksum
Upvotes: 1