Medanese IT Geek, movie lover and (mostly) law-abiding citizen. Dreaming of cheap and easy access to ICT, healthcare and education in Indonesia.

Search:


13 August 2008

Downloading McAfee ViruScan Virus Definition using Batch script and Wget

Category: Tips and Tricks — kamaruddin @ 9:40 am

Have you encounter this situation in your office? You have to keep all workstations with McAfee ViruScan updated with latest definition but only the lucky few are entitled for web access. Unlike Avira Antivir, McAfee is not using static filename for its virus definition (ie. sdatXXXX.exe) and is incrementing everyday. Using a download manager won’t work since its dynamic naming nature.

Here’s where the good old buddy WGET and batch script come in rescue.


@echo off
set TargetPath=D:\Antivirus

IF EXIST "%TargetPath%\update.ini" del "%TargetPath%\update.ini"
wget ftp://ftp.nai.com/pub/datfiles/english/update.ini -O "%TargetPath%\update.ini"

FOR /f "tokens=2 delims==" %%a in ('type "%TargetPath%\update.ini" ^| find /i "datversion="') DO SET DatVersion=%%a

REM // If you can get it by FTP remove the REM otherwise use HTTP
REM wget ftp://ftp.nai.com/pub/antivirus/superdat/intel/sdat%DatVersion%.exe -O "%TargetPath%\sdat%DatVersion%.exe"

wget http://download.nai.com/products/licensed/superdat/english/intel/sdat%DatVersion%.exe -O "%TargetPath%\sdat%DatVersion%.exe"

IF EXIST "%TargetPath%\old.exe" del "%TargetPath%\old.exe"
REN %targetpath%\update.exe old.exe
REN %targetpath%\sdat%DatVersion%.exe update.exe

---

If you can’t download via FTP as some crappy ISP disabled it for reasons, you’ll have much luck with HTTP.

Scheduled it into your computer/server (Task Scheduler) and have it ready warm and fresh the next morning. Bye-bye manual downloading….


Tags:

• • •
Using modified "Sitepoint-like" Theme. kamaruddin [-at-] gmail *dot* com