#!/bin/sh # # Copyright (C) 2004 Sergey Y. Afonin # License: none # You can use, redistribute and modify it without any limitations # # This script is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY. # # clamav-milter specific (based on sendmail's log) # cron string: # 00 5 * * * root /usr/local/bin/virusstat-perIP # # v 0.1 2004-10-02 # initial release # PATH="/root/bin:/sbin:/usr/sbin:/usr/local/sbin:/bin:/usr/bin:/usr/local/bin" export PATH CAT='bzcat' LOG='/var/log/mail/all.1.bz2' SERVER='AV Server' VIRADMINS='root@localhost,postmaster@localhost' (echo Statistic by viruses per IP which was blocked yesterday: && echo &&\ $CAT $LOG |grep 'Intercepted virus from'|grep '\[.*\..*\]'|\ sed -e 's/^.*clamfi_eom:.*: \(.*\) .*\[\(.*\)\] .*/\1 \2/'|\ sort|uniq -c|sort -r &&\ echo && echo "Scanned by ClamAV Antivirus (http://www.clamav.net/)")|\ mail -s "Virus Statistic per IP on $SERVER" $VIRADMINS