سؤال

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?

هل كانت مفيدة؟

المحلول

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.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top