Thursday, December 1, 2011

Monitoring my network traffic

Today I wrote this simple script to monitor my network traffic. I release this script under GPLv3

Enjoy

#!/bin/sh
# monitor-traffic.sh - Monitor network traffic excluding common requests
# Andres Hernandez - Tonejito

TCPDUMP=/usr/sbin/tcpdump
IP=/sbin/ip
DEV=en1
ADDR=`$IP addr show dev $DEV | grep 'inet ' | cut -d ' ' -f 6 | cut -d '/' -f 1`

$TCPDUMP -ni $DEV "host $ADDR and port not (67 or 68 or 80 or 443 or 1863 or 5222 or 587 or 993 or 995)"

--
= ^ . ^ =