Virus update script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Virus update script
# 1  
Old 04-05-2010
Virus update script

Hello everyone, this is my first post in the forum. I have antivirus update script but for some reason it is not running for some time.
I am getting this message everytime i try to run the updates.
Code:
"1 at /usr/local/bin/update-uvscan.pl line 22.
Update file could not be downloaded!"

The script is below. Please help
thanks is advance!
Khan

Code:
#!/usr/bin/perl
# written by fox
# to update the virus scanner
# Now includes a rate limit of 2mbit/s (250kbyte/s)

# tmp dir to use (it creates and deletes it. parent directory should exist) no trailing slash
$tmpdir="/tmp/update-virus-scanner";

# ftp site and location of dat files. no trailing slash
$ftpsite="ftp://ftp.mcafee.com/pub/antivirus/datfiles/4.x";
#$ftpsite="http://download.nai.com/products/datfiles/4.x/nai";

# location of the av scanner. no trailing slash
$avscanner="/usr/local/uvscan";

system("rm -rf $tmpdir");
system("mkdir $tmpdir");
system("wget -t2 -T60 --limit-rate=250k --passive-ftp -q -P$tmpdir $ftpsite/update.ini");

open(FILE, "$tmp/dat-update") || die print "Update file could not be downloaded!\n";

$line=<FILE>;
while ($line) {
 if ($line =~ "DATVersion") {
  ($junk, $datversion) = split('=', $line);
 }
$line=<FILE>;
}
close(FILE);
$datversion=~s/\cM\n//g;
chomp($datversion);
#print $datversion, "\n";
system("$avscanner/uvscan --version >$tmpdir/ourversion");
open(FILE, "$tmpdir/ourversion") || die print "Could not find current dat version\n";
$line=<FILE>;
while ($line) {
 if ($line =~ "Virus data file") {
  ($junk, $bottom) = split(" v", $line);
  ($ourversion, $junk) = split(" c", $bottom);
 }
$line=<FILE>;
}
close(FILE);
chomp($ourversion);
#print $ourversion, "\n";
if ($datversion > $ourversion) {
 system("wget --passive-ftp -q -P$tmpdir $ftpsite/dat-$datversion.zip");
 system("unzip -qq $tmpdir/dat-$datversion.zip -d $tmpdir");
 system("mv $tmpdir/*.dat $avscanner/");
 system("chmod 644 $avscanner/*.dat");
}
system("rm -rf $tmpdir");


Last edited by Franklin52; 04-05-2010 at 04:45 PM.. Reason: Please use code tags, thank you
# 2  
Old 04-05-2010
Most likely you need to use '$tmpdir' not '$tmp':

Code:
open(FILE, "$tmpdir/dat-update") || die print "Update file could not be downloaded!\n";

# 3  
Old 04-05-2010
no affect

Thanks Soleil4716

Same thing:
I changed it from tmp to tmpdir but it getting the same error.
# 4  
Old 04-05-2010
Most likely the following command is not getting the virus update file:

Code:
system("wget -t2 -T60 --limit-rate=250k --passive-ftp -q -P$tmpdir $ftpsite/update.ini");

Can you run the wget command by hand and check to see if you get the 'dat-update'
file under /tmp/update-virus-scanner
# 5  
Old 04-05-2010
How will i use this script

I am sorry but never used 'wget' before where will i ad this line in the file?
# 6  
Old 04-05-2010
Well, this line is already in your script. I am just asking you to type this at the UNIX command prompt.
# 7  
Old 04-05-2010
i am sorry

Please ignore my early message!

---------- Post updated at 04:57 PM ---------- Previous update was at 04:56 PM ----------

No it would not run on shell.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Solaris

BASH shell script for Sophos Anti-virus

Hi, I'm Lotus Notes Administrator who was roped into installing Sophos Anti-Virus software on a Sun Solaris 10 server. After installing it I found that I needed to configure it with a BASH script, which I have no idea how to create. Does anyone in here haev any examples I can look at? Any... (2 Replies)
Discussion started by: UKYank
2 Replies

2. Shell Programming and Scripting

Shell Script: want to insert values in database when update script runs

Hi , I am new to linux and also also to shell scripting. I have one shell script which unpacks .tgz file and install software on machine. When this script runs I want to insert id,filename,description(which will be in readme file),log(which will be in log file) and name of unpacked folder... (1 Reply)
Discussion started by: ring
1 Replies

3. Windows & DOS: Issues & Discussions

virus help:

:confused: folder option is dissapiaring in tool menu iam formatting c drive after removal of this virus & also regedit is also not opening the messerge say's administrater disabled with out formattiung how ican solve this problem i.e iwant to get folder options& regedit (2 Replies)
Discussion started by: seshumohan
2 Replies

4. UNIX for Dummies Questions & Answers

unix and virus

why one normally hears tht virus has stuck windows and one does not hear that unix has been stuck by virus...wht make unix so powerfull tht virus does not stuck it. (9 Replies)
Discussion started by: taurian1234
9 Replies

5. UNIX for Dummies Questions & Answers

Virus Software

I'm trying to find out what kind of virus software UNIX has, if any. Please let me know and please inform me of the prefered types. Thanks (1 Reply)
Discussion started by: GlockCW
1 Replies

6. UNIX for Dummies Questions & Answers

Worm Virus

I am running Unix SCO and have discovered the worm virus. It is enabled through a BIOS connections, I am able to get around it using telnet, believe it or not. - Can anyone recommend a virus scan software? - Has anyone successfully used a virus scan software on unix without a problem? ... (2 Replies)
Discussion started by: ana_cr32
2 Replies

7. UNIX for Dummies Questions & Answers

Virus !!!!!!!!!!!!!!!!!!!

can linux get a virus on the boot sec from windows? becuse my buddys computer micro trend cmos virus keeps telling him that there is a boot sec virus on my hdd is that possable or is the box being dumb and looking at the linux boot as a virus? it was set up as a windows box not a linux... (4 Replies)
Discussion started by: amicrawler2000
4 Replies

8. UNIX for Dummies Questions & Answers

virus????????

i tought you can;t get virus in unix ? i have some admins buddys that work in bsd all he time and they sayed you can;t get viurs in unix is that true? download.com is putting virux updates out for mac OS X ................ (7 Replies)
Discussion started by: amicrawler
7 Replies

9. Cybersecurity

do i have a virus???

nice board, makes interesting reading! glad to know im not the only one to have problems!! :D :D last week, our database started to crash (run on unix / solaris) for no apparant reason. the problem seems to be intermiant which lead us to believe it may be a hardware problem causing the... (2 Replies)
Discussion started by: mdma
2 Replies
Login or Register to Ask a Question