GXLo
超过十次,就添加到hosts.deny里面去
#!/bin/bash
date=`date +%Y%m%d`
file="/var/log/secure"
max=10
if [[ -f $file ]]
then
        grep Failed $file | awk \'{print $(NF-3)}\' | sort -rn | uniq -c | awk \'{print $2 "=" $1}\'>/shell/ip.txt
fi
for a in `cat /shell/ip.txt`
do
        if [[ `echo $a| awk -F"=" \'{print $2}\'` -gt $max ]]
        then
                b=`echo $a | awk -F"=" \'{print $1}\'`
                grep $b /etc/hosts.deny >/dev/null
                if [[ $? != 0 ]]
                then
                echo "sshd:$b" >> /etc/hosts.deny
                fi
        fi
done

分类:

技术点:

相关文章:

  • 2022-01-19
  • 2021-06-03
  • 2021-08-12
  • 2021-04-15
  • 2021-11-28
  • 2021-06-28
  • 2022-02-03
猜你喜欢
  • 2021-05-25
  • 2021-12-07
  • 2022-12-23
  • 2021-08-04
  • 2021-03-30
  • 2021-11-13
相关资源
相似解决方案