2013-01-03

super ghetto connection watching with netstat:

#!/bin/sh
rm /tmp/t0
rm /tmp/t1
rm /tmp/d
touch /tmp/t0

while [ 1 ]
do
  netstat --wide --protocol=inet|
  grep tcp |
  awk '{ print $5 }' >/tmp/t1
  diff /tmp/t0 /tmp/t1 > /tmp/d
  if [ $? -eq 1 ]
    then
       date
       cat /tmp/d
       mv /tmp/t1 /tmp/t0
       echo '=='
   fi
   sleep 3
done

This is just a start. It may be wrong.