FYI: AVG antivirus script

Support for the Debian/Ubuntu package, created by JCFP.
Forum rules
Help us help you:
  • Are you using the latest stable version of SABnzbd? Downloads page.
  • Tell us what system you run SABnzbd on.
  • Adhere to the forum rules.
  • Do you experience problems during downloading?
    Check your connection in Status and Interface settings window.
    Use Test Server in Config > Servers.
    We will probably ask you to do a test using only basic settings.
  • Do you experience problems during repair or unpacking?
    Enable +Debug logging in the Status and Interface settings window and share the relevant parts of the log here using [ code ] sections.
Post Reply
User avatar
sander
Release Testers
Release Testers
Posts: 9264
Joined: January 22nd, 2008, 2:22 pm

FYI: AVG antivirus script

Post 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
Post Reply