I had an idea for a project last night and now trying to find solutions to implement it.
I need a way to detect a TCP/IP connect to any port on one machine, and if a connect is detected i need to run some code (preferably a shell-script) which gets some information like remote host and connected port.
Aditionally, I want to redirect any incoming packets to another machine just like NAT does - but with the script guarding the connects.
I guess that might be doable with some firewall black-magic. Sadly, I'm not a wizzard in this topic so I am asking for help and/or hints how to achieve something like this.