Security Controls REST API

Home 

Exercise 3 - Perform a Patch Scan

Goal

Perform a patch scan of the machine group you created in Exercise 2.

Requirements

You will need to know the ID of the machine group and the ID of the patch scan template you want to use when performing the scan.

To determine the machine group ID, look in the output from Exercise 2

In the sample output in Exercise 2, the machine group ID is 1006.

To determine the IDs of the available patch scan templates, perform the following GET request:

https://localhost:3121/st/console/api/v1.0/patch/scantemplates

Try it yourself

Perform a patch scan of the machine group named Sample Group by submitting a POST request similar to the following:

Change the machineGroupIds and templateId values as needed.

Postman example

https://localhost:3121/st/console/api/v1.0/patch/scans

{

"machineGroupIds":["1006"],

"name":"Scan of Sample Group",

"templateId":"4c7069eb-6e1c-4352-91fc-04d4d8abc07b"

}

PowerShell script example

Invoke-RestMethod -Method Post -Credential $credential -URI $machineGroupUrl -Body $machineGroupBody -ContentType "application/json" | ConvertTo-Json -Depth 20

$patchTemplateId = "4c7069eb-6e1c-4352-91fc-04d4d8abc07b"

$machineGroupId = "1006"

$patchScanUrl = "https://localhost:3121/st/console/api/v1.0/patch/scans"

$patchScanBody =

@{

MachineGroupIds = @( $machineGroupId );

Name = "Scan of Sample Group";

TemplateId = $patchTemplateId;

} | ConvertTo-Json -Depth 99

Invoke-RestMethod -Method Post -Credential $credential -Uri $patchScanUrl -Body $patchScanBody -ContentType "application/json" | ConvertTo-Json -Depth 99

Output

The result is a JSON-formatted response similar to the following:

{

"id": "8bce9fdd-0cf8-40b0-8ecc-b0914a9c831a",

"isComplete": false,

"links": {

"self": {

"href": "https://device-name.fakedomain.com:3121/st/console/api/v1.0/patch/scans/8bce9fdd-0cf8-40b0-8ecc-b0914a9c831a"

}

},

"name": "Scan of Sample Group",

"scanType": "Patch",

"startedOn": "2018-07-17T15:15:10.7892367Z",

"updatedOn": "2018-07-17T15:15:10.7892367Z",

"user": "SYSTEM"

}

 


Was this article useful?    

The topic was:

Inaccurate

Incomplete

Not what I expected

Other