Setting a script to automatically download a file from nai.com ftp site?
Hello, I want to be able to download my anti-virus weekly update files in the middle of the night through the use of a script and ftping??? I want to connect to ftp.nai.com and download the sdat weekly anti-virus update. Is this possible and if so can anybody point me in the right direction. Thanx in advance Damian Buckley
Good day Damian, Tirsdag den 7. oktober 2003 14:55 kvad Damian Buckley:
Hello, I want to be able to download my anti-virus weekly update files in the middle of the night through the use of a script and ftping??? I want to connect to ftp.nai.com and download the sdat weekly anti-virus update. Is this possible and if so can anybody point me in the right direction.
man cron man wget cron can be used to repeat execution of kommands at certain intervals. wget can fetch files from ftp sites. Best regards :o) Johnny :o)
Damian: On Tuesday 07 October 2003 08:15 am, Johnny Ernst Nielsen wrote:
Good day Damian,
Tirsdag den 7. oktober 2003 14:55 kvad Damian Buckley:
Hello, I want to be able to download my anti-virus weekly update files in the middle of the night through the use of a script and ftping??? I want to connect to ftp.nai.com and download the sdat weekly anti-virus update. Is this possible and if so can anybody point me in the right direction.
man cron man wget
cron can be used to repeat execution of kommands at certain intervals. wget can fetch files from ftp sites.
Best regards :o)
Johnny :o)
Try the following: cd /usr/local/uvscan # Remove old TAR files /bin/rm -f *.tar 2>&1 > /dev/null # Get updated files from nai.com /usr/bin/ncftpget -V ftp://ftp.nai.com/pub/antivirus/datfiles/4.x/*.tar 2>&1
/var/log/ncftp.log
# Unpack antivirus updates /bin/tar xvf *.tar 2>&1 > /dev/null Put this in a script and then run it from cron. (requires ncftp) -- --------------------------------------------------- Dave Grosvold dave@rcanyon.com ---------------------------------------------------
David C. Grosvold wrote:
Damian:
On Tuesday 07 October 2003 08:15 am, Johnny Ernst Nielsen wrote:
Good day Damian,
Tirsdag den 7. oktober 2003 14:55 kvad Damian Buckley:
Hello, I want to be able to download my anti-virus weekly update files
I wasn't even looking for this yet but it is something I want to do too.
/usr/bin/ncftpget -V ftp://ftp.nai.com/pub/antivirus/datfiles/4.x/*.tar 2>&1
/var/log/ncftp.log
That link seems to be stale. The files are old (August) Fortunately for me there is an internal company site that I can use instead but it might be nice to know where at nai I can get the latest Thanks for the info. I am going to try this Damon Register
Damon: On Tuesday 07 October 2003 12:09 pm, Damon Register wrote:
/usr/bin/ncftpget -V ftp://ftp.nai.com/pub/antivirus/datfiles/4.x/*.tar 2>&1
That link seems to be stale. The files are old (August) Fortunately for me there is an internal company site that I can use instead but it might be nice to know where at nai I can get the latest
Thanks for the info. I am going to try this
You're welcome. It's been a while since I used that script. Try this link: ftp://ftp.nai.com/pub/datfiles/english/*.tar BTW - I checked the earlier link & it has a tar file dated 2003-9-30, so it is up to date. This new link also contains the same file -- dat-4296.tar, which was issued last week. -- --------------------------------------------------- Dave Grosvold dave@rcanyon.com ---------------------------------------------------
Sorry for big message, but this script works very fine. You will need to put it in a script file and run it from cron. Best Regards, Vilmar Alves Toledo Junior CTO - Grupo Lates www.grupolates.com ---------------------------------------------CUTHERE------------------------------------------- #!/bin/bash # dat_update # Original por Jorge Becerra (jorge AT sodatec org) # # Recebido em versão alterada, e alterado mais um pouco por: # Augusto Campos (brain AT br-linux org) 07/2003 # # Comentário do autor original: # Feel free to use the script and distribute # if you found any mistake, please email the author # # A versão atual funciona para mim, mas se alguém acrescentar # características, ou limpar o código, favor me mandar uma cópia. # # proxy - descomente para configurar, se você precisar #http_proxy="http://proxy.foo.br:3128/" #ftp_proxy="http://proxy.foo.br:3128/" # Where to get the nai update from FTPDIR="ftp://ftp.nai.com/pub/datfiles/english/" MAILTO="root" # Location of uvscan files UVSCANDIR="/usr/local/uvscan" UVSCAN="$UVSCANDIR/uvscan" # Location of files (check on your distribution) LYNX="/usr/bin/lynx" GREP="/bin/grep" CUT="/usr/bin/cut" WGET="/usr/bin/wget" CP="/bin/cp" RM="/bin/rm" ECHO="/bin/echo" MKDIR="/bin/mkdir" CAT="/bin/cat" TAR="/bin/tar" MAIL="/bin/mail" # # You don't need to change from here # At least if you don' know exactly what means :-) # if [ ! -x $UVSCAN ] ; then $ECHO "uvscan not installed on: $UVSCAN" exit fi if [ ! -x $LYNX ] ; then $ECHO "lynx not installed on $LYNX " exit fi cd $UVSCANDIR if [ ! -d tmp ]; then $MKDIR tmp fi cd tmp # Get the page from nai echo "Retrieving update list" $LYNX -dump "$FTPDIR" > nai.ls echo "Done" # Extract filename of last version $CAT nai.ls | $GREP 'ftp://ftp.nai.com' nai.ls | $GREP .tar | $CUT -c 7- | head -1 >nai.fn # Get current version VERSION_CURRENT=`cut -d - -f 2 nai.fn | cut -d . -f 1` if [ -z "$VERSION_CURRENT" ] ; then $ECHO "cant get uvscan current version" exit fi # Get version installed VERSION_USED=`$UVSCAN --version | $GREP "Virus data file" | $CUT -d" " -f4 | $CUT -c2-` $ECHO "Version - current : $VERSION_CURRENT" $ECHO "Version - used : $VERSION_USED" if [ -z "$VERSION_USED" ] ; then $ECHO "could not get version from $UVSCAN" exit fi if [ "$VERSION_USED" -ge "$VERSION_CURRENT" ] ; then $ECHO "Viruscan is up to date" exit fi $ECHO "Viruscan needs to be updated" DATNAME="dat-${VERSION_CURRENT}.tar" echo "downloading $FTPDIR$DATNAME - please wait" $WGET -c -o wupdate.log $FTPDIR$DATNAME if [ $? -eq 0 ]; then echo "downloaded ok" if [ ! -d extract ] ; then $MKDIR extract fi $RM -f extract/* $TAR --extract --directory extract < $DATNAME if [ ! $? -eq 0 ]; then $ECHO "ERROR extracting" exit fi $RM -f extract/*.exe $CP -f extract/* $UVSCANDIR/ $RM -f extract/* $MAIL -s "uvscan dat updated to version: ${VERSION_CURRENT}" $MAILTO < wupdate.log else $ECHO "error downloading" fi $RM -f wupdate.log ---------------------------------------------CUTHERE------------------------------------------- Damian Buckley wrote:
Hello, I want to be able to download my anti-virus weekly update files in the middle of the night through the use of a script and ftping??? I want to connect to ftp.nai.com and download the sdat weekly anti-virus update. Is this possible and if so can anybody point me in the right direction.
Thanx in advance
Damian Buckley
participants (5)
-
Damian Buckley
-
Damon Register
-
David C. Grosvold
-
Johnny Ernst Nielsen
-
Vilmar Alves Toledo Junior