心海恋歌 发表于 2018-8-22 13:46:15

生产实用shell

#!/bin/bash  
for i in `cat /var/log/secure |awk '/Failed/ {print $(NF-3)}'|sort | uniq -c |awk '{if($1>2) print $2}'`
  
do
  
grep $i /etc/hosts.deny > /dev/null 2>&1 || echo "sshd:$i" >> /etc/hosts.deny
  
done


页: [1]
查看完整版本: 生产实用shell