Jump to content

Symantec Available Updates Listing UDF


 Share

Recommended Posts

  • Retrieves the list of update files available
  • Array First row gives the number of files and starting path
  • The information is retrieved from FTP Location but the files can be downloaded from HTTP location
  • File name mask and File type mask can be given, default retireves all exe files (example explains it)
  • Error handling still being worked on. at the moment the udf just works great if internet is availabel and symantec is reachable!
  • Comments pls...

;~ #cs Example
#include <Array.au3>



ConsoleWrite("Retrieving information..."&  @CRLF )
Local $array = _GetSymantecFileList(@YEAR, "exe")
If Not @ERROR Then 
    ConsoleWrite("Operation Completed, Listing goes here...."& @CRLF &@CRLF)
Else
    ConsoleWrite(@EXTENDED)
EndIf

_ArrayDisplay($array)

Local $OutputString = ""

$OutputString &= @CRLF & " Total File(s) found : " & $array[0][0] 
$OutputString &= @CRLF & " File Names are relative to : " & $array[0][1] & @CRLF 
$OutputString &= @CRLF & "Sl " & @TAB  & "File Name{Output[Sl][0]}" & @TAB & "  File MD5{Output[Sl][1]} " & @TAB & @TAB & @TAB & "Download path " 

For $i = 1 to $array[0][0]
;~  $OutputString &= @CRLF & "File " & $i & " File Name: " & $array[$i][0] & " File MD5 Hash: " & $array[$i][1] & @CR & @TaB  & " Download from  : " & $array[0][1] & "/" & $array[$i][0]
    $OutputString &= @CRLF & $i & @TAB & $array[$i][0] & @TAB & $array[$i][1] &  @TaB & $array[0][1] & $array[$i][0]
Next 
ConsoleWrite($OutputString & @CRLF )


;~ #ce 

Func _GetSymantecFileList($Mask = " ", $Type = "exe")
    ; Author: Rajesh V R
    ; Last Modified : 29 Apr 2009
    
    If StringLen($Mask) = 0 Then $Mask = " "
    If StringLen($Type) = 0 Then $Type = " "
    
    Local $FileDir = _CreateFilesDirectory()
    Local $md5File_remote = "ftp://anonymous:@ftp.symantec.com/public/english_international/antivirus_definitions/norton_antivirus/md5-hash.txt"
    Local $md5File_local = $FileDir & "md5-hash.txt"
    Local $retArr[1][2], $tmpArr
    
    
    If InetGetSize($md5File_remote) == FileGetSize($md5File_local) Then
        ; Local file is of same size as latest file, so it can be used.
    Else
        InetGet($md5File_remote, $md5File_local, 1, 1)
    EndIf

    $FileHandle = FileOpen($md5File_local, 0)
    
    If @error Then SetError(@error, "Error opening file " & $md5File_local) ; -1 if file could not be opened
    
    While 1
        $Line = FileReadLine($FileHandle)
        If @error = -1 Then ExitLoop
            
        ; Check if the line contains space , i.e., is in required 'FileName<Space>MD5Value' or '#<space>Comment' format
        If StringInStr($Line, " ") = 0 Then ContinueLoop
        
        ; Check for comment
        If StringMid($Line, 1, 1) = "#" Then
            ; save the remote folder location
            ConsoleWrite(@TAB & StringMid($Line, StringInStr($Line, "Paths relative to ") + 18, StringLen($Line) - StringInStr($Line, "Paths relative to ")))
            $retArr[0][1] = StringMid($Line, StringInStr($Line, "Paths relative to ") + 18, StringLen($Line) - StringInStr($Line, "Paths relative to "))
            ContinueLoop
        EndIf
        
        ; Filter the results using the searchmask specified (" " if none)
        If StringInStr($Line, $Mask) = 0 Then ContinueLoop
        
        ; Filter the results using the filetypemask specified (" " if none)
        If StringInStr($Line, $Type) = 0 Then ContinueLoop
        
        
        $tmpArr = StringSplit($Line, " ")
        ReDim $retArr[UBound($retArr) + 1][2]
        
        $retArr[UBound($retArr) - 1][0] = $tmpArr[2]
        $retArr[UBound($retArr) - 1][1] = $tmpArr[1]
        $retArr[0][0] = UBound($retArr) - 1
    WEnd
    
    SetError(0, "Operation Completed Successfully")
    Return $retArr
    
    
EndFunc   ;==>_GetSymantecFileList

Func _CreateFilesDirectory()
    Local $retDir
    If DirCreate(@ScriptDir & "\Files") Then
        $retDir = @ScriptDir & "\Files\"
    Else ; there was an error creating directory
        $retDir = @ScriptDir & "\"
    EndIf
    Return $retDir
    
EndFunc   ;==>_CreateFilesDirectory

<edit> 03 May 2009 : Just example modified...

Edited by rajeshontheweb
Link to comment
Share on other sites

*Sigh*

I went to my tech guy the other day with mum to replace some faulty components, and he started it up to show us it was working. So we sat there, and then hes like... ohh I know why... *Taps the norton icon*

But this is pretty good looking netherless.

^_^

Edited by BrettF
Link to comment
Share on other sites

i do understand 100% if people complain a lot about symantec. i personally do it, too. but our corporate environment has symantec AV installed (many companies do!) and i'm working on an easier life with it... ^_^

If I am using symantec endpoint protection, which packages should I use from the downloaded file?

Link to comment
Share on other sites

You can solve #5 with

If Ping("ftp://symantec.com") Then
    Local $array = _GetSymantecFileList(@YEAR, "exe")
    _ArrayDisplay($array)
EndIf

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

its the v5i32.exe for symantec end point protection. (use v5i32 as the file mask, you will get the required files listing u can choose from)

i am working on another script for my network colleagues who will access the update file based on the installed symantec version..

Edited by rajeshontheweb
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...