解決DOS***生產案例

#!/bin/sh
[ -f tmp.txt ] && rm -fr tmp.txt

while true
do

cat /var/log/httpd/access_log | awk '{print $1}'| sort | uniq -c >tmp.txt
cat tmp.txt| while read line
do
pv=echo $line | awk '{print $1}'
ipaddress=echo $line | awk '{print $2}'

   if [ "$pv" -gt 100 ]
   then
      iptables -I INPUT -s ${ipaddress}  -j DROP

      echo ${ipaddress}
   fi

done
sleep 20
done

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章