On a router running unix I wish to make monitor all outgoing packets, of these packets I want to temporarily white list IP addresses I am connecting to, to both send and receive.
Basically to create a pinhole in a firewall that normally would drop all incoming packets (drops all packets except white listed ones, which were white listed by this script based on ips I send a packet to connect to). In looking around I could make a bash script based off a packet sniffer, but is there a way to do it within iptables itself and not have to involve a packet sniffer and bash script?