Friday, April 1, 2011

netstat

#see all unique IP addresses connected to the server
netstat -nat | awk '{ print $5}' | cut -d: -f1 | sed -e '/^$/d' | uniq


#if your server is under a DOS attack
netstat -anp |grep 'tcp\|udp' | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort -n

No comments:

Post a Comment