Hello, so I have tried setting up a NIC with dual ethernet interfaces, and I have connected them in a loopback. What I am trying to do is that I send packets from Interface1 (00:11:22:33:44:55) to Interface2 (99:88:77:66:55:44).
I have been failing to read out the packets from the receiving Interface2, but I can see that there is traffic on the interface when I am monitoring in wireshark. As I have understood in the Scapy documentation, the PRN is just a function callback to deal with each packet that is returned by sniff. For some reason the referenced callback "paket_processor" is never called, but I can see that the pakets are sent. I would like to be able to sniff the packets on the receiving end and hexdump them to validate that they look the same in first hand. But since the callback is never fired I don't know what is going wrong. I appreciate all the help I could get, to figure out what I have misunderstood
The code is very simple and looks like this:
I have been failing to read out the packets from the receiving Interface2, but I can see that there is traffic on the interface when I am monitoring in wireshark. As I have understood in the Scapy documentation, the PRN is just a function callback to deal with each packet that is returned by sniff. For some reason the referenced callback "paket_processor" is never called, but I can see that the pakets are sent. I would like to be able to sniff the packets on the receiving end and hexdump them to validate that they look the same in first hand. But since the callback is never fired I don't know what is going wrong. I appreciate all the help I could get, to figure out what I have misunderstood

The code is very simple and looks like this:
from scapy.utils import rdpcap from scapy.layers.l2 import Ether def packet_processor(pkt): print("Packet sniffed..") pkt.show() sniff(count=2, iface="Interface1", prn=packet_processor, store=0) pkts=rdpcap("SomeARP.pcap") for pkt in pkts: print(pkt) pkt[Ether].src = "00:11:22:33:44:55" pkt[Ether].dst = "99:88:77:66:55:44" hexdump(pkt) sendp(pkt, iface="Interface1") pkts=rdpcap("AnotherARP.pcap") for pkt in pkts: print(pkt) pkt[Ether].src = "00:11:22:33:44:55" pkt[Ether].dst = "99:88:77:66:55:44" hexdump(pkt) sendp(pkt, iface="Interface1")
Larz60+ write Sep-06-2024, 10:03 PM:
Please post all code, output and errors (it it's entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.
Tags added this time. Please use BBCode tags on future posts.
Please post all code, output and errors (it it's entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.
Tags added this time. Please use BBCode tags on future posts.