BASH – F-Prot Scripts

Here are 2 scripts created for the AV software F-Prot,

FProt_scan

Runs a scan on your system, you will need to enter you own path under the variable $path

#!/bin/bash

#Variables
path=/

#binaries
fprot=/usr/local/f-prot/f-prot

if [ ! -x "${fprot}" ]; then
        echo "Error: ${fprot} not found or not executable!" | /usr/bin/logger -t fprot_scan -p daemon.err
        exit 1
fi

${f-prot} ${path} -disinf -silent -report=/var/log/fprot.log -dumb -archive -server -collect -ai
RC=$?

if [ ${RC} != 0 ]; then
        echo "Error: ${fprot} returned rc=${RC}" | /usr/bin/logger -t fprot_scan -p daemon.err
else
        echo "Completed successfully" | /usr/bin/logger -t fprot_scan -p daemon.err
fi

exit ${RC}

FProt_mail

Emails you if a virus has been found on your system, you will need to add your own email address to $email

#!/bin/bash

#variables
email="myemail@somewhere.com"

#binaries
mailx=/usr/bin/mailx

if [ ! -x "${mailx}" ]; then
        echo "Error: ${mailx} not found or not executable!" | /usr/bin/logger -t fprot_mail -p daemon.err
        exit 1
fi

if egrep "viruse|boot|suspicious" /var/log/fprot.log | grep -q No ; then 
	echo "Complete: No Email = No Virus" | /usr/bin/logger -t fprot_mail -p daemon.err	
else
	cat /var/log/fprot.log | mailx -s "F-Prot Scan Results" ${email}
	echo "Complete: F-Prot Email Sent" | /usr/bin/logger -t fprot_mail -p daemon.err
fi

exit 0

After adding the scripts to crontab. Contrab should look like this,

0 3 * * * /usr/local/f-prot/tools/check-updates.pl -cron -quiet
0 4 * * * /home/localuser/scripts/fprot_scan.sh /dev/null 2>&1
0 5 * * * /home/localuser/scripts/fprot_mail.sh /dev/null 2>&1

Rick Donato