Compare
Compare CLI
This CLI feature allows you to compare two .csv, .xls, or .xlsx files and a RegScale assessment will be created with the comparison results.
compare_files
- Compares the two provided files and will create an assessment in RegScale of the results.
init.yaml Configuration
assessmentDays
- Number of days to add to today for the planned finish date for an assessment in RegScale
Compare Files Workflow
- Update your assessmentDays in the
init.yaml
file with your desired # of days. - Execute the command to compare the files and create an assessment in RegScale.
Purpose
The comparison CLI is used for detecting changes between multiple files to support audits. For example, you may have a requirement to review audit logs and ensure that the privileged user list is accurate. This CLI would allow you to compare changes between this month's list and last month's list to simplify this type of audit. It also helps with finding "poison pill" combinations where a user should not exist in two different lists for segregation of duties.
Example Commands
Log into RegScale to set the token, which is good for 24 hours, and will secure all future RegScale API calls. (NOTE: You can skip this step if you are using a RegScale Service Account.)
regscale login
Enter the parameters below with your information
regscale compare compare_files
--most_recent_in_file_path
The file path to grab the 2 most recently modified files--most_recent_file_type
The type of files to look for in the--most_recent_in_file_path
, can either be .csv or .xlsx--old_file
- The file path to the old file, not required if--most_recent_in_file_path
is used--new_file
- The file path to the new file, not required if--most_recent_in_file_path
is used--key
- The column you would like to use to compare the files--regscale_module_name
- The name of the RegScale module, this is for the parent item for the new assessment in RegScale, please view RegScale Modules for options.--regscale_parent_id
- The ID of the item from the provided module to use as a parent item
init.yaml Example
The following init.yaml
structure is necessary (example/notional key structure shown below, replace with actual customer keys):
domain: https://mycompany.regscale.com
token: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCIsImN0eSI6IkpXVCJ9.eyJzdWIiOiJhYmVsYXJkbyJ9.b-ao0bpoc6CiJ3ygG8-XOk_gwn8BehAcuLGaPB6rlu8
assessmentDays: 10
Building a Bash Script to Execute the CLI
You can execute RegScale CLI commands using scripts. These scripts could be in Bash, Python, PowerShell, etc. Below is an example Bash file (named compare_csvs.sh
) in Ubuntu for executing the CLI to compare two files.
#!/bin/sh
# Compare two csv files and make an assessment with specific security control implementation
regscale compare compare_files --old_file ../original.csv --new_file ../data/updated.csv --key ID --regscale_module_name controls --regscale_parent_id 1025
Updated about 1 year ago