Les
(KiX Master)
2002-02-19 03:48 PM
NAV Pattern FTP Script RFC

It would appear that Symantec has changed their LiveUpdate to just once a week. Now anyone that wants more frequent pattern updates will have to manually (or script) FTP download.

I dug up the following article on Symantec's site on how to script the FTP download. http://service1.symantec.com/SUPPORT/ent-security.nsf/docid/2000010708230148

{edit} Flawed logic below.  Much wiser now.  Vpcur.lst still only reflects the LivUpdate version and not the most recent (Intelligent Updater) version.

It is very basic in that it doesn't check the pattern file version. On the same FTP site, there is a vpcur.lst file that is in an INI format as follows:

[patterns]
VD109E02.VDB=navup.exe

I was thinking that with KiX, this file could be downloaded and enumerated, then checked against the existing patttern to determine whether a newer one need be downloaded.

Has anyone done this already? Being as lazy as I am, I'd hate to reinvent the wheel.

[ 12. August 2002, 16:33: Message edited by: LLigetfa ]


Kdyer
(KiX Supporter)
2002-02-19 03:50 PM
Re: NAV Pattern FTP Script RFC

Les,

I have done a similar thing with Batch using McAfee. Check out the response I just gave at - http://kixtart.org/cgi-bin/ultimatebb.cgi?ubb=get_topic&f=1&t=004164

Thanks!

- Kent

cmarti
(Hey THIS is FUN)
2002-02-19 08:14 PM
Re: NAV Pattern FTP Script RFC

Symantec has started releasing liveupdate defs once a week because they've started releasing platinum certified defs once a day for platinum customers. The dumb thing is they're only available in the intelligent updater format mmddx86.exe or mmddi32.exe only. Which means that you can neither get these defs through liveupdate and your clients can't receive them through liveupdate file name changes daily. The changing date made it really hard to know which file to grab. I have a script, several actually that will parse the date and retrieve the daily certified defs from them if you'd like.

L8tr..

Les
(KiX Master)
2002-02-19 09:13 PM
Re: NAV Pattern FTP Script RFC

Interesting...
Thisis the very basic FTP script that is on Symantec's site as per the aforementioned link.
code:

open ftp.symantec.com
anonymous
les_ligetfalvy@abicon.com
cd public/english_us_canada/antivirus_definitions/norton_antivirus/static
lcd C:\temp
bin
hash
prompt
get symcdefsx86.exe
quit

As you can see, it is not in the date coded format. Are you saying these are not as stringently tested?

I would be interested in seeing what you've got.

Incidentally, they released a new pattern today.

bleonard
(Seasoned Scripter)
2002-02-19 09:30 PM
Re: NAV Pattern FTP Script RFC

Les -
Here is a KiX script I use to FTP into NAI daily, retreive SDAT/ZipDAT files, compare with local copies, then copy updated files to PDC's.
Here they are accessed via the login script. This may help you out.

Bill

code:

; #########################################################################################
; ### ###
; ### Script to copy latest NAI SuperDAT files to Netlogon Export directories on PDC's ###
; ### Created: 2001.08.24 Bill Leonard ###
; ### Domains included: Domain1, Domain2, Domain3 ###
; ### Revisions: ###
; ### ###
; #########################################################################################


; REM ** Variables in use by this script
$CR = CHR(13) + CHR(10) ; REM ** Carriage returns
$ArrErr = 0 ; REM ** Track errors encountered in Array process to exit loop
$BatchDir = "C:\SubDir" ; REM ** Where are batch files called from
$ChkVer = "" ; REM ** Track file version comparisons results
$DownDir = "C:\Temp\Nai" ; REM ** FTP Download directory
$Emailid1 = "admin1@@mycompany.com" ; REM ** Primary email Recipient for login script errors/warning messages
$Emailid2 = "admin2@@mycompany.com" ; REM ** Secondary email Recipient for login script errors/warning messages
$EmailSvr = "mailserver.mycompany.com" ; REM ** SMTP/POP3 mail server
$EmailUsr = $Emailid1 ; REM ** Needed Senders email address
$Exist = "No" ; REM ** Bucket if files exist on destination servers
$Err = 0 ; REM ** Track errors encountered in script to alert admin
$FtpChk = "nai_ftp_chk.cmd" ; REM ** FTP check file
$FtpFil = "nai_ftp_get.cmd" ; REM ** FTP file to build
$NAIPath = "\\AppServer\SoftLib" ; REM ** Top level source directory for NAI update files
$sDATDir = "$NAIPath\NAI\SDats"
$zDATDir = "$NAIPath\NAI\ZDats"
$Pdc = "" ; REM ** Variable to hold name of receiving Domain Controller
$DstDrv = "W:"
$DstDir = "Winnt\System32\Repl\Export\Scripts\NAI"
$LocalSvr = "AppServer"
$LogDir = "\\AppServer\Share$"
$LogDir = "$LogDir\NAI\Servers"
$LogFil = $LocalSvr + "_NAI_Sdat_Download.txt"


; REM ** Step 1 - Open Log File
$Time = "@DATE @TIME"
$Log = "$LogDir\$LogFil"
SELECT
CASE EXIST ($Log) = 0 ; REM ** Log not in existence
$wri - OPEN (1, $Log, 5)
$wri = WRITELINE (1, "$LocalSvr Log started: $TIME" + $CR)
$wri = WRITELINE (1, "Log Path: $LogDir" + $CR)
$wri = WRITELINE (1, " " + $CR)
CASE (1)
$wri = OPEN (1, $Log, 5)
ENDSELECT
$wri = WRITELINE (1, "Process started: $Time" + $CR)


; REM ** Step 2 - delete previous download files
$RC = DIR ("$DownDir\sdat4*.exe")
IF ($RC <> 0)
DEL "$DownDir\$RC"
IF (@ERROR = 0)
$wri = WRITELINE (1, " Success deleting $DownDir\$RC" + $CR)
ELSE
$Err = $Err+1
$wri = WRITELINE (1, " Error @ERROR deleting $DownDir\$RC (@SERROR)" + $CR)
ENDIF
ENDIF


$RC = DIR ("$DownDir\Dat*.zip")
IF ($RC <> 0)
DEL "$DownDir\$RC"
IF (@ERROR = 0)
$wri = WRITELINE (1, " Success deleting $DownDir\$RC" + $CR)
ELSE
$Err = $Err+1
$wri = WRITELINE (1, " Error @ERROR deleting $DownDir\$RC (@SERROR)" + $CR)
ENDIF
ENDIF


; REM ** Step 3 - build FTP download file
IF EXIST ("$BatchDir\$FtpFil") <> 0
DEL "$BatchDir\$FtpFil"
IF (@ERROR <> 0)
$Err = $Err+1
$wri = WRITELINE (1, " Error @ERROR deleting $BatchDir\$FtpFil (@SERROR)" + $CR)
GOTO EndScript
ENDIF
ENDIF
$con = OPEN (9, "$BatchDir\$FtpFil", 5)
$wri = WRITELINE (9, "open ftp.nai.com" + $CR)
$wri = WRITELINE (9, "user anonymous" + $CR)
$wri = WRITELINE (9, "someone@@mycompany.com" + $CR)
$wri = WRITELINE (9, "binary" + $CR)
$wri = WRITELINE (9, "cd /pub/antivirus/datfiles/4.x" + $CR)
$wri = WRITELINE (9, "lcd \Temp\Nai" + $CR)
$wri = WRITELINE (9, "mget dat-*.zip" + $CR)
$wri = WRITELINE (9, "mget sdat*.exe" + $CR)
$wri = WRITELINE (9, "close" + $CR)
$wri = WRITELINE (9, "quit" + $CR)
$con = CLOSE (9)


; REM ** Step 4 - Initiate FTP download, check file for errors
SHELL "cmd /c ftp -ins:$BatchDir\$FtpFil > $BatchDir\$FtpChk"
OPEN (9, "$BatchDir\$FtpChk", 2)
$x = 0
$Line = READLINE (9)
WHILE ((INSTR ($Line, "ftp> quit") = 0) AND ($x < 50))
SELECT
CASE ($Line = "cannot login")
$Err = $Err+1
$wri = WRITELINE (1, " FTP login error to NAI server" + $CR)
GOTO EndScript
CASE ($Line = "login incorrect")
$Err = $Err+1
$wri = WRITELINE (1, " FTP login error to NAI server" + $CR)
GOTO EndScript
CASE ($Line = "access denied")
$Err = $Err+1
$wri = WRITELINE (1, " FTP login error to NAI server" + $CR)
GOTO EndScript
ENDSELECT
$x = $x+1
$Line = READLINE (9)
LOOP
CLOSE (9)


; REM ** Step 5 - Determe the present SuperDAT/ZipDAT filename, parse the string for the 4-digit version number
$FileCurSdat = DIR ("$sDATDir\Current\sdat4*.exe")
$FileCurSver = SUBSTR ($FileCurSdat, 5, 4)
$FileCurZdat = DIR ("$zDATDir\Current\dat*.zip")
$FileCurZver = SUBSTR ($FileCurZdat, 5, 4)

$FileNewSdat = DIR ("$DownDir\sdat4*.exe")
$FileNewSver = SUBSTR ($FileNewSdat, 5, 4)
$FileNewZdat = DIR ("$DownDir\dat*.zip")
$FileNewZver = SUBSTR ($FileNewSdat, 5, 4)


; REM ** Step 6 - Compare versions to see if latest download matches current on server
SELECT
CASE (($FileNewSver > $FileCurSver) OR ($FileNewZver > $FileCurZver))
$wri = WRITELINE (1, " sDAT: $sDATDir\Current: $FileCurSver / $DownDir: $FileNewSver ($FileNewSdat)" + $CR)
$wri = WRITELINE (1, " zDAT: $zDATDir\Current: $FileCurZver / $DownDir: $FileNewZver ($FileNewZdat)" + $CR)
CASE (1)
$Update = "No"
$wri = WRITELINE (1, " sDAT OK: $sDATDir\Current: $FileCurSver / $DownDir: $FileNewSver ($FileNewSdat)" + $CR)
$wri = WRITELINE (1, " zDAT OK: $zDATDir\Current: $FileCurZver / $DownDir: $FileNewZver ($FileNewZdat)" + $CR)
GOTO UpdateServers
ENDSELECT


; REM ** Step 7 - Copy current local server versions to archive directory
$RC = DIR ("$sDATDir\Current\sdat4*.exe")
COPY "$sDATDir\Current\$RC" "$sDATDir\Archive\$RC"
IF (@ERROR = 0)
DEL "$sDATDir\Current\$RC"
IF (@ERROR <> 0)
$wri = WRITELINE (1, " Error @ERROR deleting $sDATDir\Current\$RC (@SERROR) (Step 7)" + $CR)
ENDIF
ENDIF


$RC = DIR ("$zDATDir\Current\*.zip")

COPY "$zDATDir\Current\$RC" "$zDATDir\Archive\$RC"
IF (@ERROR = 0)
DEL "$zDATDir\Current\$RC"
IF (@ERROR <> 0)
$wri = WRITELINE (1, " Error @ERROR deleting $zDATDir\Current\$RC (@SERROR) (Step 7)" + $CR)
ENDIF
ENDIF


; REM ** Step 8 - Retrieve current files to server local server (SDAT and ZIP files)
COPY "$DownDir\$FileNewZdat" "$zDATDir\Current\"
IF (@ERROR <> 0)
$Err = $Err+1
$wri = WRITELINE (1, "Error @ERROR copying $FileNewZdat to $LocalSvr (@SERROR) (Step 8)" + $CR)
ENDIF
COPY "$DownDir\$FileNewSdat" "$sDATDir\Current\"
IF (@ERROR <> 0)
$Err = $Err+1
$wri = WRITELINE (1, "Error @ERROR copying $FileNewSdat to $LocalSvr (@SERROR) (Step 8)" + $CR)
ENDIF


:UpdateServers
; REM ** Step 9 - Obtain new files size and time stamps for check process confirming copy process to clients
$FileNewSsize = GETFILESIZE ("$sDATDir\Current\$FileNewSdat")
$FileNewStime = GETFILETIME ("$sDATDir\Current\$FileNewSdat")
$wri = WRITELINE (1, " New SDAT size: $FileNewSsize / time: $FileNewStime (Step 9)" + $CR)


; REM ** Step 10 - Build array to update primary domain controllers in this and other offices
$x=0
DIM $DstDom[3]
DIM $DstPdc[3]
DIM $DstShr[3]

$DstDom[$x] = "Domain1" $DstPdc[$x] = "Pdc1" $DstShr[$x] = "\\Pdc1\C$" $x=$x+1
$DstDom[$x] = "Domain2" $DstPdc[$x] = "Pdc2" $DstShr[$x] = "\\Pdc2\D$" $x=$x+1
$DstDom[$x] = "Domain3" $DstPdc[$x] = "Pdc3" $DstShr[$x] = "\\Pdc3\E$" $x=$x+1

$x2=0
DO
$ArrErr = 0
$ChkVer = ""
$Pdc = $DstPdc[$x2]
$TmpEx = EXIST ("$DstDrv\*.")
IF ($TmpEx <> 0)
USE "$DstDrv" /DEL
IF (@ERROR = 0)
$wri = WRITELINE (1, " Success deleting drive mapping $DstDrv (pass $x2)" + $CR)
ELSE
$ArrErr = $ArrErr+1
$wri = WRITELINE (1, " Error @ERROR deleting drive mapping $DstDrv (@SERROR)" + $CR)
ENDIF
ELSE
$wri = WRITELINE (1, " Verified $DstDrv drive mapping does not exist (pass $x2)" + $CR)
ENDIF

IF ($ArrErr <> 0)
$Err = $Err+1
GOTO EndLoop
ENDIF

USE "$DstDrv" $DstShr[$x2]
IF (@ERROR <> 0)
$ArrErr = $ArrErr+1
$Msg = "Error @ERROR (@SERROR)"
ELSE
$Msg = "Success"
ENDIF
$wri = WRITELINE (1, " $Msg mapping $DstDrv to " + $DstShr[$x2] + " ($x2)" + $CR)

IF ($ArrErr <> 0)
$Err = $Err+1
GOTO EndLoop
ENDIF


; REM ** Step 11 - Confirm version of SDAT on PDC, compare with current download on Local Server
IF EXIST ("$DstDrv\$DstDir\sdat4*.exe") = 1 ; REM ** SDAT file exists on server
$Exist = "Yes"
$FilePdcSdat = DIR ("$DstDrv\$DstDir\sdat4*.exe")
$FilePdcSver = SUBSTR ($FilePdcSdat, 5, 4)
SELECT
CASE ($FilePdcSver < $FileNewSver) $ChkVer = "Older"
CASE ($FilePdcSver > $FileNewSver) $ChkVer = "Newer"
$ArrErr = $ArrErr+1
CASE (1) $ChkVer = "Current"
ENDSELECT
ELSE $ChkVer = "Missing"
ENDIF
$wri = WRITELINE (1, " $ChkVer SDAT: $Pdc: $FilePdcSver / $LocalSvr: $FileNewSver (Step 11)" + $CR)

IF ($ChkVer = "Current") OR ($ChkVer = "Newer")
GOTO EndLoop
ENDIF

IF ($ArrErr <> 0)
$Err = $Err+1
GOTO EndLoop
ENDIF


; REM ** Step 12 - Delete existing verion(s) on PDC to only have 1 SDAT in the DIR at any time
IF ($Exist = "Yes")
DEL "$DstDrv\$DstDir\$FilePdcSdat"
IF (@ERROR = 0)
$Msg = "Success"
ELSE
$ArrErr = $ArrErr+1
$Msg = "Error @ERROR (@SERROR)"
ENDIF
$wri = WRITELINE (1, " $Msg deleting $FilePdcSdat on $DstDrv\$DstDir (Step 12)" + $CR)
ENDIF

IF ($ArrErr <> 0)
$Err = $Err+1
GOTO EndLoop
ENDIF


; REM ** Step 13 - Copy updated SDAT files to the PDC
COPY "$sDATDir\Current\$FileNewSdat" "$DstDrv\$DstDir\$FileNewSdat"
IF (@ERROR <> 0)
$ArrErr = $ArrErr+1
$Msg = "Error @ERROR (@SERROR)"
ELSE
$FilePdcSsize = GETFILESIZE ("$DstDrv\$DstDir\$FileNewSdat")
$FilePdcStime = GETFILETIME ("$DstDrv\$DstDir\$FileNewSdat")
IF (($FileNewSsize <> $FilePdcSsize) OR ($FileNewStime <> $FilePdcStime))
$ArrErr = $ArrErr+1
$Msg = "Error in confirmation process"
$wri = WRITELINE (1, " $LocalSvr SDAT size: $FileNewSsize / time: $FileNewStime" + $CR)
$wri = WRITELINE (1, " $Pdc SDAT size: $FilePdcSsize / time: $FilePdcStime" + $CR)
ELSE
$Msg = "Confirmed successful"
ENDIF
ENDIF
$wri = WRITELINE (1, " $Msg copying $FileNewSdat to $DstDrv\$DstDir (Step 13)" + $CR)


IF ($ArrErr <> 0)
$Err = $Err+1
GOTO EndLoop
ENDIF


:EndLoop
$x2=$x2+1
UNTIL $x2=$x


; REM ** Confirm drive no longer mapped
$TmpEx = EXIST ("$DstDrv\*.")
IF ($TmpEx <> 0)
USE "$DstDrv" /DEL
IF (@ERROR = 0)
$wri = WRITELINE (1, " Success deleting drive mapping $DstDrv (pass $x2)" + $CR)
ELSE
$Err = $Err+1
$wri = WRITELINE (1, " Error @ERROR deleting drive mapping $DstDrv (@SERROR)" + $CR)
ENDIF
ENDIF


:EndScript
; REM ** Step 14 - Close log file and exit the script
USE "$DstDrv" /DEL
$wri = WRITELINE (1, "Process completed: @TIME" + $CR)
$wri = WRITELINE (1, " " + $CR)
$wri = CLOSE (1)

IF ($Err <> 0) RUN "POSTIE.exe -host:$EmailSvr -to:$Emailid1 -from:$EmailUsr -s:NAI_Update_Error_on_@WKSTA -msg:" + CHR(34) + "Error Count: $Err" + CHR(34) + " -q -a:$Log"
ENDIF
SLEEP 3
IF ($Err <> 0) RUN "POSTIE.exe -host:$EmailSvr -to:$Emailid2 -from:$EmailUsr -s:NAI_Update_Error_on_@WKSTA -msg:" + CHR(34) + "Error Count: $Err" + CHR(34) + " -q -a:$Log"
ENDIF
SLEEP 3
; IF ($Err = 0) RUN "POSTIE.exe -host:$EmailSvr -to:$Emailid1 -from:$EmailUsr -s:NAI_Update_Success_on_@WKSTA -msg:" + CHR(34) + "Error Count: $Err" + CHR(34) + " -q -a:$Log"
; ENDIF
; SLEEP 3
EXIT


[ 19 February 2002: Message edited by: bleonard ]

cmarti
(Hey THIS is FUN)
2002-02-20 08:01 PM
Re: NAV Pattern FTP Script RFC

There're releasing daily defs in the intelligent updater format only. The script/scripts I wrote to get this are at:
NAV Certified Intelligent Updater Defs

L8tr..

cmarti
(Hey THIS is FUN)
2002-02-20 08:05 PM
Re: NAV Pattern FTP Script RFC

I guess it'd help if I added the file names...

Here are the file names of the scripts in my last post.., they are in this order:
platdefs.bat
dates.txt
writeftp.scr
extract.scr
platlog.log (this is the output)


Les
(KiX Master)
2002-02-22 12:46 AM
Re: NAV Pattern FTP Script RFC

{edit}Update - Please see below for a newer version.

Thanks to all for your input. Well... being as I'm as lazy as I am...
too lazy to try and reverse engineer the scripts submitted...

I decided to write my own. It will run on the NAV Parent server as a Task Scheduler job. If anyone wants to adopt it, the first three vars need be set.
$TempDir is where the downloaded file gets extracted to. The script will delete everything in $TempDir once done.
$WorkDir is where the script runs from, creates FTP scripts to, downloads vpcur.lst and symcdefsx86.exe which all but the KiX script get deleted and recreated.
$VPHome is where NAV is installed to on the Parent server. In my case it is C:\Program Files\NAV.

If you want to test it, just create test folders to match and copy your VDB files to $VPHome.
code:
Break on
;========================================
; NAV pattern file version checker, downloader, and updater
; by les_ligetfalvy
;========================================
; First we determine current pattern file on NAV Parent server
;
$TempDir ="C:\Test\Temp" ; ###change to where your's will go###
$WorkDir ="C:\Test" ; ###change to where your's will go###
$VPHome ="C:\Test\NAV" ; ###change to where your NAV parent's .vdb files exist###
; code deleted, see new post below



[ 12. August 2002, 16:37: Message edited by: LLigetfa ]


Les
(KiX Master)
2002-03-20 04:24 AM
Re: NAV Pattern FTP Script RFC

So DOC,
Did I make this way more complicated than I needed to?

What are you doing for pattern updates?


NTDOCAdministrator
(KiX Master)
2002-03-20 04:42 AM
Re: NAV Pattern FTP Script RFC

No problem Les,

I'm sure everyone has their own ideas and methods. Symantec has pushed out too many bad defs that can/could hang or otherwise disable your desktops, so we always test their def files on a couple systems first before deploying.

So I manually launch the definition update from the console for one server in our Domain, which then automatically updates all the other servers which in turn updates all the clients.

That way it is fully automated except for the fact that we test first. If you trust Symantec you can simply have one server automatically update the def files every day through their LiveUpdate program and then have all of your other systems checking and updating from your one main server. It works, we just don't trust Symantec to get it right the first time every time. Most of the time they do, but that would be a real drag to have 1,000s of desktop dead to the point that it required "MANUAL" intervention to repair.


Les
(KiX Master)
2002-03-20 05:25 AM
Re: NAV Pattern FTP Script RFC

DOC,
I may have mentioned this once or twice. I'm divisional IT. Corporate IT is responsible for the FireWall and they use McAfee. They update their pattern once a week.
Being a belt & suspenders (& ductape) kinda guy, I also have InnoculateIT on my Notes server and NAV on my desktop. InnoculateIT catches a whole bunch that McAfee misses. There have been many times where NAV, (partly because of the daily updates) have caught viruses that the others have missed.
I've heard of bad patterns causing grief, but personally haven't encountered any from Symantec (well, a couple back on LANDesk VP abended my NetWare server). I've had my Notes server go south several times from bad patterns but NAV has been rock solid since 7.5 with every (4 times daily) update.


Les
(KiX Master)
2002-08-09 06:33 PM
Re: NAV Pattern FTP Script RFC

Here's an update on my NAV pattern downloader. Recently I put out a cry for help here but nobody replied. [Frown]

I deleted the previous two posts as they no longer apply.

Basically, to make a long story short, Symantec has once again changed how they post their latest pattern file.  Used to be, you could just download their vpcur.lst file and just rip the current filename from it.  Not so any more.  Vpcur.lst now often lags behind the most current.

What I do now is an ftp 'ls' command and redirect the output to a file, parse the file, and ascertain the newest.

code:
 Break on
;========================================
; NAV pattern file version checker, downloader, and updater
; by les_ligetfalvy
; updated August 9th, 2002
;========================================
; First we determine current pattern file on NAV Parent server
;
$Error =""
$WorkDir ="C:\NAVKiX"
$VPHome ="C:\Program Files\NAV"
$HKLMSILVP6CV = "HKEY_LOCAL_MACHINE\SOFTWARE\Intel\LANDesk\VirusProtect6\CurrentVersion"
$Newest = ReadValue($HKLMSILVP6CV,"CurrentPatternName")
$RC = WriteProfileString($WorkDir + "\PatternUpdater.ini","NAV","ExistingPattern",$Newest)
If Exist($WorkDir + "\" + $Newest) Del $WorkDir + "\" + $Newest EndIf

;========================================
; Then we FTP to get vpcur.txt
;
If Exist($WorkDir + "\vpcur.txt") Del $WorkDir + "\vpcur.txt" EndIf
$FTPScript = $WorkDir + "\CEGetCurrent.txt"
$ShellCMD ="ftp -s:" + $FTPScript
If Exist($FTPScript) Del '$FTPScript' Endif
If RedirectOutput($FTPScript) = 0
"open ftp.symantec.com" ?
"anonymous" ?
"myname@@mycompany.com" ?
"cd public/english_us_canada/antivirus_definitions/norton_antivirus/vdb" ?
"lcd " + $WorkDir ?
"bin" ?
"hash" ?
"prompt" ?
"ls *.vdb " + $WorkDir + "\vpcur.txt" ?
"quit" ?
$rc = RedirectOutput("")
Else
$Error ="Failed to create " + $FTPScript
GoTo Done
Endif
Shell '$ShellCMD'
;========================================
; Now we check vpcur.txt
;
$Index = 0
Dim $FNArray[10]
$FNewest = 0
If (Open(1,$WorkDir + "\vpcur.txt") = 0) And (GetFileSize($WorkDir + "\vpcur.txt") <> 0)
$Line = ReadLine(1)
While $Line <> "" And @Error = 0
If Val("&" + Substr($Line,3,6)) <> 0
$FNArray[$Index] = Val("&" + Substr($Line,3,6))
$Index = $Index + 1
EndIf
$Line = ReadLine(1)
Loop
For $X = 0 To $Index Step 1
If $FNArray[$X] > $FNewest
$FNewest = $FNArray[$X]
EndIf
Next
$vpcur = LCase("vd" + DectoHex($FNewest) + ".vdb")
If Val("&" + SubStr($vpcur,3,6)) <= Val("&" + SubStr($Newest,3,6))
$RC = WriteProfileString($WorkDir + "\PatternUpdater.ini","NAV","LastChecked",@Date + " - " + @Time)
GoTo Done
Else
;========================================
; Then we FTP to get latest pattern, same as for vpcur.txt only different
;
If Exist($WorkDir + "\*.vdb") Del $WorkDir + "\*.vdb" EndIf
$FTPScript = $WorkDir + "\CEGetPattern.txt"
$ShellCMD ="ftp -s:" + $FTPScript
If Exist($FTPScript) Del '$FTPScript' Endif
If RedirectOutput($FTPScript) = 0
"open ftp.symantec.com" ?
"anonymous" ?
"myname@@mycompany.com" ?
"cd public/english_us_canada/antivirus_definitions/norton_antivirus/vdb" ?
"lcd " + $WorkDir ?
"bin" ?
"hash" ?
"prompt" ?
"get " + $vpcur ?
"quit" ?
$rc = RedirectOutput("")
Else
$Error ="Failed to create " + $FTPScript
GoTo Done
Endif
Shell '$ShellCMD'
;========================================
; Now we see if $vpcur downloaded and if so, copy and cleanup
;
If GetFileSize($WorkDir + "\" + $vpcur) <> 0
$CopySource = $WorkDir + "\" + $vpcur
Copy $CopySource $VPHome
Else
$Error ="Download of $vpcur failed!"
GoTo Done
EndIf
;========================================
EndIf
Else
$Error = "Download of vpcur.txt failed!"
GoTo Done
EndIf
$RC = WriteProfileString($WorkDir + "\PatternUpdater.ini","NAV","LastDownloaded",$vpcur)
$RC = WriteProfileString($WorkDir + "\PatternUpdater.ini","NAV","LastUpdated",@Date + " - " + @Time)
$RC = WriteProfileString($WorkDir + "\PatternUpdater.ini","NAV","LastChecked","")
$RC = WriteProfileString($WorkDir + "\PatternUpdater.ini","NAV","ExistingPattern","")
:Done
$RC = WriteProfileString($WorkDir + "\PatternUpdater.ini","NAV","Error",$Error)

Exit 1

{edit} Fixed a couple of bugs.
1. If FTP failed, need to check for a zero-byte file.
2. Needed to convert filename to LC as FTP is case sensitive.

[ 20. January 2003, 16:19: Message edited by: LLigetfa ]


Les
(KiX Master)
2002-08-14 07:33 PM
Re: NAV Pattern FTP Script RFC

Fixed a couple of bugs. [Embarrassed]
1. If FTP failed, need to check for a zero-byte file.
2. Needed to convert filename to LC as FTP is case sensitive.


Les
(KiX Master)
2002-12-03 01:18 AM
Re: NAV Pattern FTP Script RFC

Help! Is anyone else using FTP for Intelligent Updater updates? Seems that Symantec has once again changed their FTP site or something. This script is no longer working. The site I would DL from is:
ftp://ftp.symantec.com/public/english_us_canada/antivirus_definitions/norton_antivirus/vdb

Can anyone see any VDB files at that site?


MightyR1
(MM club member)
2002-12-03 01:21 AM
Re: NAV Pattern FTP Script RFC

Found 3:

vd12f419.vdb
vd12f605.vdb
vd130405.vdb


LonkeroAdministrator
(KiX Master Guru)
2002-12-03 01:24 AM
Re: NAV Pattern FTP Script RFC

me found too.

les, I'm thinking of kicking your script to graveyard, may I?

have a better on plann...

just testing does it kick correctly.


Les
(KiX Master)
2002-12-03 01:33 AM
Re: NAV Pattern FTP Script RFC

Thanks Patrick. must have been one of their mirrors down. They have ftp1 ~ ftp8 as mirrors. Tried it again and it's DLing fine now.

Jooel,
Was thinking of maybe doing it with COM but up until now was working just fine. If it ain't broke, why fix it? What do you have in mind?


LonkeroAdministrator
(KiX Master Guru)
2002-12-03 01:36 AM
Re: NAV Pattern FTP Script RFC

shorter code ready for run (tested):
code:
$address="ftp://ftp.symantec.com/public/english_us_canada/antivirus_definitions/norton_antivirus/vdb/"
$savepath="c:\navfiles\"
$=createobject("microsoft.xmlhttp")
$.open("get",$address,not 1)
$.send
$files=split(split($.responsetext,"<pre>")[1],"</pre>")[0]
for each $file in $files
$file=split(split($file,'">')[1],'<')[0]
ftpget($address+$file,$savepath+$file)
next

anyway, for this you need the ftpGET() from udflib.


LonkeroAdministrator
(KiX Master Guru)
2002-12-03 01:40 AM
Re: NAV Pattern FTP Script RFC

btw, as I see you fighting with this, I see my f-secure in better light every day. runs like a train.
also, virus defs up to date and quicker sig updates.


Les
(KiX Master)
2002-12-03 01:40 AM
Re: NAV Pattern FTP Script RFC

Dang! CorpIT must be messing with the firewall/Proxy. Can no longer reach that site via proxy.

Thanks Jooel,
Can't test now as current connection is via proxy. [Mad]


cmarti
(Hey THIS is FUN)
2002-12-03 08:01 PM
Re: NAV Pattern FTP Script RFC

Here's what I use to download their daily certified defs through ftp..works like a charm...
code:
Echo y| del e:\platdefs\*.*
Echo y| del c:\vdb\*.*
ftp -s:platdefs.txt>c:\scripts\logs\platlog.log
E:\PLATDEFS\symcdefsx86.exe /q /extract /vdb "c:\vdb"

ECHO The attached file is the results of the ftp of the definitions from symantec. Below you will find the results of copying the extracted defs to ParentInFirstServerGroup and ParentInSecondServerGroup.>C:\SCRIPTS\LOGS\COPYDEFS.LOG
ECHO If these are NEW definitions, they will automatically be pushed out to client machines.>>C:\SCRIPTS\LOGS\COPYDEFS.LOG
ECHO.>>C:\SCRIPTS\LOGS\COPYDEFS.LOG

REM COPY DEFS TO PRIMARY ANTIVIRUS SERVER
COPY c:\vdb\*.* "c:\program files\nav\"
IF NOT '%ERRORLEVEL%' == '0' GOTO ERRORLU00
ECHO Definitions successfully copied to ParentInFirstServerGroup>>C:\SCRIPTS\LOGS\COPYDEFS.LOG

REM COPY DEFS TO PRIMARY ANTIVIRUS SERVER IN 2ND GROUP
COPY c:\vdb\*.* "\\ParentInSecondServerGroup\c$\program files\nav\"
IF NOT '%ERRORLEVEL%' == '0' GOTO ERRORLU01
ECHO Definitions successfully copied to ParentInSecondServerGroup>>C:\SCRIPTS\LOGS\COPYDEFS.LOG
GOTO THEEND

REM COPY DEFS TO PRIMARY ANTIVIRUS SERVER IN 3RD GROUP
REM COPY c:\vdb\*.* "\\ParentInThirdServerGroup\c$\program files\nav\"
REM IF NOT '%ERRORLEVEL%' == '0' GOTO ERRORLOD01
REM ECHO Definitions successfully copied to ParentInThirdServerGroup>>C:\SCRIPTS\LOGS\COPYDEFS.LOG
REM GOTO THEEND

:ERRORLU00
ECHO UNABLE TO COPY DEFINITIONS TO \\ParentInFirstServerGroup\C$\PROGRAM FILES\NAV!!!>>C:\SCRIPTS\LOGS\COPYDEFS.LOG
GOTO THEEND

:ERRORLU01
ECHO UNABLE TO COPY DEFINITIONS TO \\ParentInSecondServerGroup\C$\PROGRAM FILES\NAV!!!>>C:\SCRIPTS\LOGS\COPYDEFS.LOG
GOTO THEEND

:ERRORLOD01
ECHO UNABLE TO COPY DEFINITIONS TO \\ParentInThirdServerGroup\C$\PROGRAM FILES\NAV!!!>>C:\SCRIPTS\LOGS\COPYDEFS.LOG
GOTO THEEND

:THEEND
blat.exe C:\SCRIPTS\LOGS\COPYDEFS.LOG -attacht "c:\scripts\logs\platlog.log" -t me@mydomain.com -s "Platdefs on %computername%."

Here's my ftp script. I'm going into the static directory now and pulling the symcdefsx86.exe file. Symantec said (uh oh.. [Roll Eyes] ) That this file is the same file as their daily certified defs that have a file date as the name.
code:
 
open ftp.symantec.com
anonymous
nobody@spammer.com
cd public/english_us_canada/antivirus_definitions/norton_antivirus/static
lcd e:\platdefs
bin
hash
prompt
get symcdefsx86.exe
quit

That way all of the parent servers in my server groups get updated at the same time the primary does and I don't have to schedule them separately...

L8tr... [Big Grin]


LonkeroAdministrator
(KiX Master Guru)
2002-12-03 08:08 PM
Re: NAV Pattern FTP Script RFC

but, who's code is kix? [Wink]

thanks to kent again.


Les
(KiX Master)
2003-01-20 04:17 PM
Re: NAV Pattern FTP Script RFC

Dang! Lack of foresight on my part and more than 5 old patterns on Symantec's FTP site broke my script.

The following DIM is too conservative:
Dim $FNArray[5]

Should be more:
Dim $FNArray[10]

Script updated... my apologies.

[ 20. January 2003, 16:21: Message edited by: LLigetfa ]