Da1VeR
Постоялец
- Регистрация
- 22 Фев 2012
- Сообщения
- 131
- Реакции
- 21
- Автор темы
- #1
Код:
#!/bin/sh
a=`cat /var/log/auth.log | grep ‘Invalid user *’ | awk ‘{print $10 }’ | sort -u `
f_deny () {
for name in ${a}; do
COUNT=`cat /home/user/scripts/banusers.txt | awk “/${name}$/”|wc -l | sort -u`
if [ ${COUNT} -ge "1" ]; then
continue
else
echo ‘${fwcmd}’ add 1 deny log ip from $name to any >> /etc/firewall
fi
done }
if [ -e test5.txt ]; then
f_deny
else
touch banusers.txt
f_deny
fi
/etc/firewall