The Python program file ‘archive_scans.py’ retrieves and archives information on historical scans.
The program makes use of the Halo SDK which handles functions like making REST calls, creating and parsing JSON responses, authentication and error handling.
-
Requires Python 2.7.10 version or higher
-
Install the SDK
pip install cloudpassage -
Halo requires the script to pass both the key ID and secret key values for a valid Halo API key in order to make API calls.
-
Copy the API Key_id and Secret Key from your Halo account into
portal.ymllocated inconfigs/portal.ymlkey_id: 12345 secret_key: abcabcabcabcabc
Run the following command to see program usage:
python archive_scans.py -h
Output: usage: archive_scans.py [-h] [--since SINCE] [--until UNTIL]
Archive Scans
optional arguments:
-h, --help show this help message and exit
--since SINCE Only get historical scans after <when> (ISO-8601 format)
--until UNTIL Only get historical scans till <when> (ISO-8601 format)
Either since or until has to be a required flag.
After the program has run successfully, you will find a directory called “details” created under your current working directory under which the scan details will be archived.
To retrieve and archive scan data since, say January 1 of 2015, use the following command: python archive_scans.py --since=2015-01-01