Is it possible to specify send and receive ports for scapy sendp

StackOverflow https://stackoverflow.com/questions/22976279

  •  30-06-2023
  •  | 
  •  

سؤال

I want to send via scapy on one interface and listen on another. Instead of writing two functions, I'm curious if the existing "Send and Receive" function of Scapy "srp" supports specifying an "ingress" and "egress" port

For example, I'm sending on "Eth4" now, and I wish to listen to "Eth5", right now it is sending and listening on the same port

h=srp(Ether()/IP()/TCP(sport=80,dport=8080),iface="eth4")
هل كانت مفيدة؟

المحلول

The interface you specify in Scapy via srp() is the one interface it will listen on for sending and receiving.

Both the sendp and sniff functions have the interface option. Send your packet on your chosen interface with sendp and listen for it on your ingress interface with sniff.

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