Hi, I am trying to build a packet-duplicator tool that will receive UDP packets sent by an external host1 to the localhost where the tool is running, and then forward the data to an external host2.
However, I want to spoof the sender ip:port on these forwarded packets to reflect the ip:port of the original sender (host1). I do not see any straightforward method to create a UdpSocket from an arbitrary ip:port; is there a way to achieve this?
You're going to need to go down to the Ethernet layer and manually craft packets. And, even if you do manage to do this, you'll need to make sure your operating system's firewall doesn't filter the packet, and furthermore, you'll need to make sure the router in your LAN doesn't filter it either. You can use the crate pnet to craft such packets, but do be aware of the challenges in the debugging stage