Using a shell script and cron to get the latest symantec anti-virus files
I need to be have the latest anti-virus files from symantec, rather than downloading them myself, I wrote the script below
#!/bin/sh
#
# by Michael Mayer-Oakes
# 2/2/2009
# get the latest files from norton, for antivirus
LOGNAME="/var/log/yourlogname.log"
AWK=`which awk` || AWK="/usr/bin/awk"
SED=`which sed` || SED="/usr/bin/sed"
LOGGER=`which logger` || LOGGER="/usr/bin/logger"
ECHO=`which echo` || ECHO="/bin/echo"
DATE=`which date` || DATE="/bin/date"
$LOGGER -t $0[$$] Start Symantec/Norton Anti-Virus Update
$ECHO " " >> $LOGNAME
$ECHO "Start Symantec/Norton Anti-Virus Update" >> $LOGNAME
$DATE >> $LOGNAME
# set to script working directory
cd "/path/to/script"
# get the latest listing
cat symantecinput | ftp -a > symantecoutput
# get unique list of x86.exe filename, I use 32 bit Windows systems
FILELIST="`grep 'x86.exe' symantecoutput | awk '// {print $9}'`"
$ECHO "Got list of files from Symantec" >> $LOGNAME
$DATE >> $LOGNAME
# build the FTP GET file
$ECHO "open ftp.symantec.com" > symantecget
# you may need to change this section if you are not using US English
$ECHO "cd public/english_international/antivirus_definitions/norton_antivirus/" >>symantecget
$ECHO "lcd /path/to/where/to/save/AntiVirus/" >> symantecget
$ECHO "bin" >> symantecget
for FILE in $FILELIST
do
$ECHO "get "$FILE >> symantecget
# log files to be retrieved
$ECHO "ftp file "$FILE >> $LOGNAME
done
$ECHO "quit" >> symantecget
$ECHO "Created list of files from Symantec" >> $LOGNAME
$DATE >> $LOGNAME
# get the files, listed above
cat symantecget | ftp -a > symantecgetoutput
$DATE >> $LOGNAME
$ECHO "End Symantec/Norton Anti-Virus Update" >> $LOGNAME
$LOGGER -t $0[$$] End Symantec/Norton Anti-Virus Update
# end of script
This along with the symantecinput file:
open ftp.symantec.com
cd public/english_international/antivirus_definitions/norton_antivirus/
ls -l
quit
And last but not least cron:
0 2 * * * /path/to/script/symantec.sh
And now you have an updated repository of symantec's anti-virus files.