Skip to content

Instantly share code, notes, and snippets.

@cmcdevitt
Last active January 25, 2024 18:40
Show Gist options
  • Save cmcdevitt/83b51ad7183c8b3c8f2f481a06331568 to your computer and use it in GitHub Desktop.
Save cmcdevitt/83b51ad7183c8b3c8f2f481a06331568 to your computer and use it in GitHub Desktop.
Recalculate Risk Score for Vulnerable items
/*
If you need to force a recalcuation on a VIT (or set of VITS) then place this script in a Fix Script and execute.
Note: The Fix Script should be in the Vulnerability Response Application Scope
Use Case:
-- Force a change on VIT to test a change in *DEV*
-- Force a change to existing data becouse your model changed
****TEST**** then ****RETEST*** AND ***VALIDATE*** before proceding off your DEV enviroment with this script. There is no undo button.
*/
var vit = new GlideRecord('sn_vul_vulnerable_item');
/*
A. Before updating everything **consider** using an ->encoded query<- and ->setLimit()<- in DEV to replace addQuery() in TEST the results
-- Example vit.addEncodedQuery('active=true^vulnerability=90243e92db9873005daef4eabf9619a3');
B. You can change vit.addQuery('active', true); --> to vit.addQuery('active', false); to update Closed VITS
*/
vit.addQuery('active', true);
vit.setLimit(1);// Remove before flight. A safty for people who don't read directions. ;)
vit.query();
while (vit.next()) {
var securityCalc = new sn_vul.VulnerabilityCalculator(vit, true, true, "sn_vul_calculator_group", "sn_vul_calculator");
securityCalc.calculate();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment