shellscripts:hear_dropped_packets

Hear your Firewall

Source

This little script watches the /var/log/kern.log for the string [FW] default which is logged by my firewall when dropping a package. For each map a little beep is sent to the pc speaker.

You need beep for it.

#> apt-get install beep
#!/bin/sh
 
tail -f /var/log/kern.log | \
 awk '
   $0 ~ /\[FW\] default/ {
     match($0, / DPT=([0-9]+) /, matches);
     port = matches[1];
     print port;
     if (port < 1024) {
       system("beep -f 500 -l 100");
     }else{
       system("beep -f 2000 -l 100");
     }
   }
 '