Page 1 of 2 12>
Topic Options
#63236 - 2002-02-19 03:48 PM NAV Pattern FTP Script RFC
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
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 ]
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#63237 - 2002-02-19 03:50 PM Re: NAV Pattern FTP Script RFC
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
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

_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#63238 - 2002-02-19 08:14 PM Re: NAV Pattern FTP Script RFC
cmarti Offline
Hey THIS is FUN

Registered: 2001-02-26
Posts: 297
Loc: Little Rock, AR
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..

Top
#63239 - 2002-02-19 09:13 PM Re: NAV Pattern FTP Script RFC
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
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.

_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#63240 - 2002-02-19 09:30 PM Re: NAV Pattern FTP Script RFC
bleonard Offline
Seasoned Scripter
*****

Registered: 2001-01-19
Posts: 581
Loc: Chicago, IL
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 ]

Top
#63241 - 2002-02-20 08:01 PM Re: NAV Pattern FTP Script RFC
cmarti Offline
Hey THIS is FUN

Registered: 2001-02-26
Posts: 297
Loc: Little Rock, AR
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..

Top
#63242 - 2002-02-20 08:05 PM Re: NAV Pattern FTP Script RFC
cmarti Offline
Hey THIS is FUN

Registered: 2001-02-26
Posts: 297
Loc: Little Rock, AR
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)

Top
#63243 - 2002-02-22 12:46 AM Re: NAV Pattern FTP Script RFC
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
{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 ]
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#63244 - 2002-03-20 04:24 AM Re: NAV Pattern FTP Script RFC
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
So DOC,
Did I make this way more complicated than I needed to?

What are you doing for pattern updates?
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#63245 - 2002-03-20 04:42 AM Re: NAV Pattern FTP Script RFC
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11623
Loc: CA
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.

Top
#63246 - 2002-03-20 05:25 AM Re: NAV Pattern FTP Script RFC
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
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.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#63247 - 2002-08-09 06:33 PM Re: NAV Pattern FTP Script RFC
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
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 ]
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#63248 - 2002-08-14 07:33 PM Re: NAV Pattern FTP Script RFC
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
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.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#63249 - 2002-12-03 01:18 AM Re: NAV Pattern FTP Script RFC
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
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?
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#63250 - 2002-12-03 01:21 AM Re: NAV Pattern FTP Script RFC
MightyR1 Offline
MM club member
*****

Registered: 1999-09-09
Posts: 1264
Loc: The Netherlands
Found 3:

vd12f419.vdb
vd12f605.vdb
vd130405.vdb
_________________________
Greetz,
Patrick Rutten

- We'll either find a way or make one...
- Knowledge is power; knowing how to find it is more powerful...
- Problems don't exist; they are challenges...

Top
#63251 - 2002-12-03 01:24 AM Re: NAV Pattern FTP Script RFC
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
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.
_________________________
!

download KiXnet

Top
#63252 - 2002-12-03 01:33 AM Re: NAV Pattern FTP Script RFC
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
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?
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#63253 - 2002-12-03 01:36 AM Re: NAV Pattern FTP Script RFC
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
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.
_________________________
!

download KiXnet

Top
#63254 - 2002-12-03 01:40 AM Re: NAV Pattern FTP Script RFC
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
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.
_________________________
!

download KiXnet

Top
#63255 - 2002-12-03 01:40 AM Re: NAV Pattern FTP Script RFC
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
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]
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
Page 1 of 2 12>


Moderator:  Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
2 registered (morganw, mole) and 414 anonymous users online.
Newest Members
gespanntleuchten, DaveatAdvanced, Paulo_Alves, UsTaaa, xxJJxx
17864 Registered Users

Generated in 0.064 seconds in which 0.021 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org