Pergunta

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?

Foi útil?

Solução

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.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top