I wish to test a subsystems which communicates with another subsystems via tcp. I have used the following:
"iptables -A OUTPUT -p tcp --dport "+port_number" -j DROP"
to stop the traffic on a port so that I could via a script send my own data to the system under test. This worked really well.
I now wish however to forward the traffic to my script instead of simply dropping it. I then wish to manipulate the data in my script before forwarding it to the subsystem under test.
Can I do this using iptables? Is there a better approach?