#!/bin/bash netstat -an|grep 80 |awk -F[:‘ ‘]+ ‘{print $6}‘ |sort -rn |uniq -c|awk ‘{ if($1>=25)print $2}‘>/tmp/dropip #netstat -an|grep EST |awk -F[:‘ ‘]+ ‘{print $6}‘ |sort -rn |uniq -c |sort -rn |head -10 |awk ‘{ if($1>15)print $2}‘>/tmp/dropip for i in $(cat /tmp/dropip|grep -v ‘127.0.0.1‘) do /sbin/iptables -I INPUT -p tcp --dport 80 -s $i -j DROP echo "$i kill at `date`" >>/var/log/gua_ip.txt done
时间: 2024-10-25 20:03:08