Em Seg 21 Nov 2005 20:09, Sönke Ruempler escreveu:
> Not native in XMail. Just set up a SpamAssassin ;-)

I already have SpamAssassin installed, but it's not enought.
With this small script I caught 8 bad guys in 15 minutes. The script is called 
by crontab every 5 minutes and every 23:59 (11:59 pm) I run the following 
command to take them out of the punishment:
echo -n > /var/MailRoot/spammers.tab

Here goes the script:
============================
#!/bin/sh

spammer() {
  if [ $2 -gt 30 ]; then
    if [ ! "`grep \"^$1\/24\$\" /var/MailRoot/spammers.tab`" ]; then
      echo "$1/24" >> /var/MailRoot/spammers.tab
    fi
  fi
}

tail -n 1000 /var/MailRoot/logs/smtp-`date +%Y%m%d`0000 | \
sed 's/"//g' | cut -f3,4 | sort > /tmp/$$
while read ip datetime ; do
  if [ "$ip" = "$lip" ]; then
    let n=$n+1
  else
    if [ "$lip" ]; then
      spammer $lip $n
    fi
    n=1
    lip=$ip
  fi
done < /tmp/$$
rm -f /tmp/$$
if [ "$ip" ]; then
  spammer $ip $n
fi
==========================
Just it!
Helio
-
To unsubscribe from this list: send the line "unsubscribe xmail" in
the body of a message to [EMAIL PROTECTED]
For general help: send the line "help" in the body of a message to
[EMAIL PROTECTED]

Reply via email to