#!/bin/bash # add any excessive validrcptto spammer to hosts.deny spammers=`awk '/excessive/ {print $9}' /var/log/qmail/qmail-smtpd/current` for ip in $spammers do net=`echo $ip | awk -F. '{print $1"."$2"."$3"."}'` if [ `grep -c $net /etc/hosts.deny` = 0 ] ; then echo "ALL : $net" >> /etc/hosts.deny fi done