I would like to use the Scapy package in Python in order to receive a packet (like a DNS query) in a specific port (e.g 53) and then send again the same packet to myself but to a different port. For example, if the original query was sent to port 53, I would like to send it again but to a different port (e.g 1028).
I thought about changing the destination IP address to the loopback address (127.0.0.1) and the destination port to the specific value (e.g 1028) and then use the "send" function of scapy, but it doesn't seems to work.
if the received packet variable is named "packet" then:
packet['IP'].dst = '127.0.0.1'
packet['UDP'].dst = 1028
send(packet)
I also thought about deleting the checksums and recalculating them using show2() but it still does not work.
Any ideas?
Sent 1 packets? Can you see a packet sent with wireshark/tcpdump? It would help to provide a minimal reproducible example