cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Summary

This article teaches you how to read and work with the public member functions and attributes provided in the Flexera Software Package System of the Software Vulnerability Manager. This information is essential to understand how to script your custom packages and create advanced package designs that suit your general or more specific use-case needs. After going through this article, you should be able to understand the SPS scripts and modify them in your own advantage. 

Synopsis

The functions outlined below are useful as standard functions to log messages, get file names, calculate the Sha1sum (security), extract files from the SPS package to a location and report the number of files within a package.  The script contains Public member functions usable in Jscript, PowerShell and VBScript. The examples below show how to integrate them:

Discussion

server.

It can be defined as the machine where the package is executed and can also be the package itself.

Explanation:
server = Localhost.package

Public member functions:

logMessage ("Hello World") 

This will write Hello World to the log.

getFilename (1)

This function will derive the filename from the first file within the SPS package.

getSHA1Sum (1)

Returns the saved SHA1 sum of the first embedded file.

extractFile (1, "C:\\Windows")

Will extract file number 1 to the C:\\Windows\ path on the system

getSHA1Sum ("C\\Windows\testinstaller.exe")

Calculates the SHA1 sum of C\\Windows\testinstaller.exe

numberOfFiles

will return the number of files embedded in a package

LOG SPS.EXE
When creating an SPS file within the CSI console (Step 2 of the SPS Wizard) you can also create a log to s specific file. In order to do this, navigate (using CMD) to the location where the SPS.exe has been created and use the following command :

sps.exe -d debug.txt -v

This will create a custom log that can help you identify errors within the package execution flow script.

Additional Information

SPS SERVER CLASS REFERENCE

Public Member Functions

void

logMessage (string message)
Logs a message to the log file.

string

getFilename ()
Returns the name of the embedded file identified by the given index.

string

getSHA1Sum (int index)
Returns the saved SHA1 sum of the embedded file identified by the given index.

void

extractFile (int index, string destination)
Extracts the embedded file identified by the given index.

string

getSHA1Sum (string path)
Calculates the SHA1 sum of any file.

void

sleep (int millisecs)
Sleeps for the specified number of milliseconds.


Public Attributes

FastArray

args
Readonly. An array containing the command-line arguments to the program.

int

numberOfFiles
Readonly. The number of embedded files, including the controlling script.

Additional training video:

Secunia SPS Training: The Custom Package” is an older video that is still valid, however.
You can use it for mastering custom packages configuration in the current Software Vulnerability Manager and re-use some of its examples in the current SPS system successfully. 

 

Was this article helpful? Yes No
No ratings
Version history
Last update:
‎Sep 25, 2019 06:30 AM
Updated by: