Hello.
I'm currently working on a custom definition where both the detection and "patch install command" is a custom script that needs to download additional files in order to work.
Since I need the additional files for the detection part, the "Additional files" section in the "Patch installation & removal" section can't be used since those are not downloaded at that point, so I'm therefore making use of the built-in function named "DownloadFile"
boolSucceeded = DownloadFile(httpOrUNCPath, localPath, expectedMd5Hash)
I haven't been able to find these built-in functions documented anywhere (?) and even though they try to give some hints when the function is added, it's not always that useful and some "trial and error" is needed to get it working properly. I.e. with the DownloadFile function, the last parameter is named "expectedMd5Hash", but it's not a "real" MD5 hash that is needed - it's a "LANDesk hash". From reading How the hash for the file of a package is stored in the database? I can understand that the "LANDesk hash" is a normal MD5 hash stored in BASE64, but the LANDesk hash seems to be "shorter" than "standard 'base64' encoding".
Hash example for test file:
MD5 6e388b39ea781b8dd47e3abfa229f04d
Std. BASE64 NmUzODhiMzllYTc4MWI4ZGQ0N2UzYWJmYTIyOWYwNGQ=
LANDesk bjiLOep4G43Ufjq/oinwTQ==
The easiest way so far that I've found to calculate the hash value that LANDesk accepts is by using the GetFileHashLocal function in the custom definition as a test and then read the hash in the vulscan log file.
log "hash for file name" & " : " & GetFileHashLocal("c:\temp\file.txt")
While that works, it's a really clunky approach. Is there an easier way of doing it? Preferably a VBscript or something that can take a folder as input and then calculate the LANDesk hash for all files in the folder. Or perhaps some details on how that LANDesk hash really is calculated as I already have a script that will calculate the MD5 and standard BASE64 hash values.
Thanks in advance.