random

- collection of un-sorted bollocks
git clone git://git.acid.vegas/random.git
Log | Files | Refs | Archive

ddosmonit (425B)

      1 #!/bin/sh
      2 while true; do
      3 	pkt_old=$(grep eth0: /proc/net/dev | cut -d ':'  -f2 | awk '{ print $2 }')
      4 	sleep 1
      5 	pkt_new=$(grep eth0: /proc/net/dev | cut -d ':'  -f2 | awk '{ print $2 }')
      6 	pkt=$(( $pkt_new - $pkt_old ))
      7 	echo -ne "\r$pkt packets/s\033[0K"
      8 	if [ $pkt -gt 5000 ]; then
      9 		echo "\nDDoS detected"
     10 		tcpdump -n -s0 -c 5000 -w /home/acidvegas/dumps/dump.$(date +"%Y%m%d-%H%M%S").cap
     11 		sleep 300
     12 	fi
     13 done