#!/usr/bin/perl -w

#This script requires LWP to be installed.
use LWP::Simple;
#Who to send notices too
$to="phil\@altamente.com";
#who to send them from
$from="av\@altamente.com";
#You will have to change 345 to represent your Sophos version.
#Also change the paths to where to store the downloaded ide zip file.
$response=mirror('http://www.sophos.com/downloads/ide/345_ides.zip', '/var/virus_updates/345_ides.zip');
if (is_success($response)) {
#check the path to your copy of unzip and qmail-inject
	$done=qx!/usr/bin/unzip -u -o /var/virus_updates/345_ides.zip -d /usr/local/sav!;
	open (MAIL, "| /var/qmail/bin/qmail-inject -a -f$from $to");
	print MAIL "To: $to\n";
	print MAIL "From: $from\n";
	print MAIL "Subject: Virus IDE files Updated\n\n";
	print MAIL "$done";
	close MAIL;
	}
	
if ($response==RC_NOT_MODIFIED) {
	open (MAIL, "| /var/qmail/bin/qmail-inject -a -f$from $to");
	print MAIL "To: $to\n";
	print MAIL "From: $from\n";
	print MAIL "Subject: No Virus IDE Updates\n\n";
	print MAIL "Web Server Response = ", status_message($response), "\n";
	close MAIL;
	}
	
	
