Page 1 of 1

FYI: AVG antivirus script

Posted: December 7th, 2014, 5:46 pm
by sander
As a FYI:

I downloaded AVG for Linux (AVG Free Edition for Linux, tar.gz version) from http://free.avg.com/eu-en/download-free-all-product . I installed it and now "avgscan . " scans my current directory and subdirectories. Good.

I then created a SABnzd post-processing script:

Code: Select all

#!/bin/sh
echo "\n"
avgscan "$1" -r /tmp/avgscan-$$ > /dev/null
RETVAL=$?
cat /tmp/avgscan-$$ | tail -n+8 | grep -B100 -m1 -e "----------"	# throw away first 8 lines, then find up to first "----"
cat /tmp/avgscan-$$ | grep "Infections found"
exit $RETVAL
... which seems to work:
Exit(5) Infections found : 2(2) (More)
with in the details:

Code: Select all

/home/sander/Downloads/complete/eicar/eicar/eicar.com  Virus identified EICAR_Test
/home/sander/Downloads/complete/eicar/eicar/eicar.com.txt  Virus identified EICAR_Test
------------------------------------------------------------------------------
Infections found  :  2(2)
FWIW: I also tried clamAV / clamscan, but it has a horrible detection rate. AVGscan is much better.

HTH

EDIT:

Maybe this is better (only output if there is a virus found):

Code: Select all

#!/bin/sh

echo "\n"
avgscan "$1" -r /tmp/avgscan-$$ > /dev/null

#RETVAL=$?

if [ "$?" -ne "0" ]; then
	#cat /tmp/avgscan-$$  | tail -n+8 | head -n -5
	cat /tmp/avgscan-$$ | tail -n+8 | grep -B100 -m1 -e "----------"  # throw away first 8 lines, then find up to first "----"
	cat /tmp/avgscan-$$ | grep "Infections found"
	exit 1
fi
exit 0