#!/bin/bash
# License: GPL
# Copyright: kevin@bestkevin.com


OLDIFS=$IFS
IFS="
"

LANG=en_US
today=`date +"%b %e"`
logfile="/var/log/proftpd/xferlog"
toscan="/tmp/toscan"
destmail="kevin@bestkevin.com"
scanoutput="/tmp/scanoutput"
cat /dev/null > $toscan

for line in `grep $today $logfile`
do
	versus=`echo $line | cut -d  ":" -f 3 | cut -d " " -f 9`
	if [ $versus = 'i' ]
	then
		filename=`echo $line | cut -d  ":" -f 3 | cut -d " " -f 6`
		echo $filename >> $toscan
	fi
done
/usr/bin/clamscan --phishing-sigs=yes --phishing-cloak=yes --scan-html=yes --phishing-scan-urls=yes -f $toscan > $scanoutput 2>&1

if [ $? != 0 ]
then
	echo "Virus found on uploaded file" | mail -s "VIRUS FOUND !!!" $destmail
fi

