王艳玲 发表于 2018-8-19 07:44:39

SHELL...

#!/bin/bash###########################################  ########## by_&Frost 20090619 #############
  ###########################################
  ip_file="/app/scripts/ip.txt"
  drop_file="/app/scripts/gt100.txt"
  RATE=100
  ipt=$(which iptables)
  netstat -ant |awk '$4 ~ /\:80$/{gsub(/\:\:ffff\:/,"",$5);split($5,ip,":");++S]}END{for (i in S)print S,i}' > ${ip_file}
  ips=($(awk '$1>R{print $2}' ${ip_file}))
  [ ${#ips
[*]} -eq 0 ] && exit 0 || date >> ${drop_file}
  for((i=0;i> ${drop_file}
  dels[$i]=${ips[$i]}
  $ipt -I INPUT 1 -s ${ips[$i]} -p tcp --dport 80 -j DROP
  done
  sleep 600
  for((i=0;i
页: [1]
查看完整版本: SHELL...