This script will read log entries generated by iptables from the any arguments passed to the script or stdin and summarize any outbound traffic by port, protocol and interface. To get iptables to start logging traffic, run the command sudo /sbin/iptables -I OUTPUT -m state --state NEW -j LOG and to disable logging when you are done run sudo /sbin/iptables -D OUTPUT -m state --state NEW -j LOG
yendor/iptables-log-summary
Create a summary of iptables traffic for later firewall rule creation
Python