I have a system with two network adapters. One of the network adapters is connected to a port mirror, so it sees all the traffic in the network. I'd like to sniff that connection for a certain TCP connection with a specific port number, and forward all the data of that connection that to TCP server using the second network adapter.
What I have tried so far:
- Use
socat
to listen on a port and fork it to another port. This works when a TCP connection would be directly made with the portsocat
is listening on, but I don't know how this could be replaced with the input from a sniffed connection. tcpdump
to sniff all the data. However, I'm unsure how to forward this data to a different TCP connection.
Any help would be much appreciated!