Question

with Scapy I can sniff packets and filter by destination.

sniff(filter="dst <ip addr>")

How do I use Scapy to only forward packets that are being sent to that specific ip address?

Was it helpful?

Solution

You can use the prn argument for sniff like this

sniff(filter="your ip address", prn=process_packet)

Where process_packet is a method that do what you need, like this

def process_packet(pkt):
    here you do what you need with the sniffed packet

Sniff function will apply process_packet to every packet that is sniffed.

Hope this is what you asked.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top