netstat -lntupa | grep ":80" | grep ESTABLISHED | awk '{print $5}' | awk -F: '{print $1}' | sort | uniq -c| sort -nr | head -n5 > /tmp/ip.txt
while read line; do
COUNT=`echo "$line" | awk '{print $1}'`
IP=`echo "$line" | awk '{print $2}'`
if [ $COUNT -gt 50 -a `iptables -vnL | grep "$IP" | wc -l` -lt 1 ];then
iptables -I INPUT -s "$IP" -j DROP
fi
done < /tmp/ip.txt