Get Vulnerability Tests

Cortex Xpanse REST API

post /public_api/v1/assets/get_vulnerability_tests/

Get a complete or filtered list of vulnerability tests. Response include details about each test, including the number of services confirmed vulnerable.

To view vulnerability test results, use the Get All Services or Get Service Details endpoints.

Request headers
authorization String required

api-key

Example: {{api_key}}
x-xdr-auth-id String required

api-key-id

Example: {{api_key_id}}
CLIENT REQUEST
curl -X 'POST'
-H 'Accept: application/json'
-H 'Content-Type: application/json'
-H 'authorization: {{api_key}}' -H 'x-xdr-auth-id: {{api_key_id}}'
'https://api-}/public_api/v1/assets/get_vulnerability_tests/'
-d '{ "request_data" : { "search_from" : 0, "filters" : [ { "field" : "name", "value" : "VulnerabilityTestFilter_value", "operator" : "in" }, { "field" : "name", "value" : "VulnerabilityTestFilter_value", "operator" : "in" } ], "sort" : { "field" : "severity_score", "keyword" : "desc" }, "search_to" : 0 } }'
import http.client conn = http.client.HTTPSConnection("api-") payload = "{\"request_data\":{\"filters\":[{\"field\":\"name\",\"operator\":\"in\",\"value\":\"string\"}],\"search_from\":0,\"search_to\":500,\"sort\":{\"field\":\"severity_score\",\"keyword\":\"ASC\"}}}" headers = { 'authorization': "{{api_key}}", 'x-xdr-auth-id': "{{api_key_id}}", 'content-type': "application/json" } conn.request("POST", "%7B%7Bfqdn%7D%7D/public_api/v1/assets/get_vulnerability_tests/", payload, headers) res = conn.getresponse() data = res.read() print(data.decode("utf-8"))
require 'uri' require 'net/http' require 'openssl' url = URI("https://api-/%7B%7Bfqdn%7D%7D/public_api/v1/assets/get_vulnerability_tests/") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true http.verify_mode = OpenSSL::SSL::VERIFY_NONE request = Net::HTTP::Post.new(url) request["authorization"] = '{{api_key}}' request["x-xdr-auth-id"] = '{{api_key_id}}' request["content-type"] = 'application/json' request.body = "{\"request_data\":{\"filters\":[{\"field\":\"name\",\"operator\":\"in\",\"value\":\"string\"}],\"search_from\":0,\"search_to\":500,\"sort\":{\"field\":\"severity_score\",\"keyword\":\"ASC\"}}}" response = http.request(request) puts response.read_body
const data = JSON.stringify({ "request_data": { "filters": [ { "field": "name", "operator": "in", "value": "string" } ], "search_from": 0, "search_to": 500, "sort": { "field": "severity_score", "keyword": "ASC" } } }); const xhr = new XMLHttpRequest(); xhr.withCredentials = true; xhr.addEventListener("readystatechange", function () { if (this.readyState === this.DONE) { console.log(this.responseText); } }); xhr.open("POST", "https://api-/%7B%7Bfqdn%7D%7D/public_api/v1/assets/get_vulnerability_tests/"); xhr.setRequestHeader("authorization", "{{api_key}}"); xhr.setRequestHeader("x-xdr-auth-id", "{{api_key_id}}"); xhr.setRequestHeader("content-type", "application/json"); xhr.send(data);
HttpResponse<String> response = Unirest.post("https://api-/%7B%7Bfqdn%7D%7D/public_api/v1/assets/get_vulnerability_tests/") .header("authorization", "{{api_key}}") .header("x-xdr-auth-id", "{{api_key_id}}") .header("content-type", "application/json") .body("{\"request_data\":{\"filters\":[{\"field\":\"name\",\"operator\":\"in\",\"value\":\"string\"}],\"search_from\":0,\"search_to\":500,\"sort\":{\"field\":\"severity_score\",\"keyword\":\"ASC\"}}}") .asString();
import Foundation let headers = [ "authorization": "{{api_key}}", "x-xdr-auth-id": "{{api_key_id}}", "content-type": "application/json" ] let parameters = ["request_data": [ "filters": [ [ "field": "name", "operator": "in", "value": "string" ] ], "search_from": 0, "search_to": 500, "sort": [ "field": "severity_score", "keyword": "ASC" ] ]] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api-/%7B%7Bfqdn%7D%7D/public_api/v1/assets/get_vulnerability_tests/")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "POST" request.allHTTPHeaderFields = headers request.httpBody = postData as Data let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume()
<?php $curl = curl_init(); curl_setopt_array($curl, [ CURLOPT_URL => "https://api-/%7B%7Bfqdn%7D%7D/public_api/v1/assets/get_vulnerability_tests/", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 30, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "POST", CURLOPT_POSTFIELDS => "{\"request_data\":{\"filters\":[{\"field\":\"name\",\"operator\":\"in\",\"value\":\"string\"}],\"search_from\":0,\"search_to\":500,\"sort\":{\"field\":\"severity_score\",\"keyword\":\"ASC\"}}}", CURLOPT_HTTPHEADER => [ "authorization: {{api_key}}", "content-type: application/json", "x-xdr-auth-id: {{api_key_id}}" ], ]); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; }
CURL *hnd = curl_easy_init(); curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST"); curl_easy_setopt(hnd, CURLOPT_URL, "https://api-/%7B%7Bfqdn%7D%7D/public_api/v1/assets/get_vulnerability_tests/"); struct curl_slist *headers = NULL; headers = curl_slist_append(headers, "authorization: {{api_key}}"); headers = curl_slist_append(headers, "x-xdr-auth-id: {{api_key_id}}"); headers = curl_slist_append(headers, "content-type: application/json"); curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers); curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\"request_data\":{\"filters\":[{\"field\":\"name\",\"operator\":\"in\",\"value\":\"string\"}],\"search_from\":0,\"search_to\":500,\"sort\":{\"field\":\"severity_score\",\"keyword\":\"ASC\"}}}"); CURLcode ret = curl_easy_perform(hnd);
var client = new RestClient("https://api-/%7B%7Bfqdn%7D%7D/public_api/v1/assets/get_vulnerability_tests/"); var request = new RestRequest(Method.POST); request.AddHeader("authorization", "{{api_key}}"); request.AddHeader("x-xdr-auth-id", "{{api_key_id}}"); request.AddHeader("content-type", "application/json"); request.AddParameter("application/json", "{\"request_data\":{\"filters\":[{\"field\":\"name\",\"operator\":\"in\",\"value\":\"string\"}],\"search_from\":0,\"search_to\":500,\"sort\":{\"field\":\"severity_score\",\"keyword\":\"ASC\"}}}", ParameterType.RequestBody); IRestResponse response = client.Execute(request);
Body parameters
required
application/json
request_dataobject
filtersarray
[
fieldstring (Enum)
Allowed values:"name""test_names""vulnerability_ids""description""vendor_names""status""affected_software""severity_score""cwe_ids""epss_score""count_vulnerable_services"
operatorstring (Enum)

Identifies the comparison operator to use for this filter. The following list shows which operator can be used for each filter field:

  • name: contains, eq, neq
  • status: eq
  • vulnerability_ids: contains, not_contains
  • description: contains
  • affected_software: contains, not_contains
  • cwe_ids: contains, not_contains
  • vendor_names: contains, not_contains
  • severity_score: eq, neq, gte, lte
  • epss_score: eq, neq, gte, lte
  • count_vulnerable_services: eq, neq, gte, lte
Allowed values:"in""contains""neq""eq""lte""gte""not_contains"
valueobject

Value depends on the filter field used.

  • name: string e.g. apache
  • status: Enabled, Disabled
  • vulnerability_ids: strings in the form of CVE IDs, such as CVE-1, CVE-2
  • description: string e.g. apache
  • affected_software: strings
  • cwe_ids: strings in the form of CWE IDs such as CWE-20
  • vendor_names: strings such as Cisco, Siemens
  • severity_score: numbers, such as 2, 3.5
  • epss_score: numbers, such as 2, 3.5
  • count_vulnerable_services: integers, such as 1,2,5
string

Value depends on the filter field used.

  • name: string e.g. apache
  • status: Enabled, Disabled
  • vulnerability_ids: strings in the form of CVE IDs, such as CVE-1, CVE-2
  • description: string e.g. apache
  • affected_software: strings
  • cwe_ids: strings in the form of CWE IDs such as CWE-20
  • vendor_names: strings such as Cisco, Siemens
  • severity_score: numbers, such as 2, 3.5
  • epss_score: numbers, such as 2, 3.5
  • count_vulnerable_services: integers, such as 1,2,5
integer

Value depends on the filter field used.

  • name: string e.g. apache
  • status: Enabled, Disabled
  • vulnerability_ids: strings in the form of CVE IDs, such as CVE-1, CVE-2
  • description: string e.g. apache
  • affected_software: strings
  • cwe_ids: strings in the form of CWE IDs such as CWE-20
  • vendor_names: strings such as Cisco, Siemens
  • severity_score: numbers, such as 2, 3.5
  • epss_score: numbers, such as 2, 3.5
  • count_vulnerable_services: integers, such as 1,2,5
numberfloat

Value depends on the filter field used.

  • name: string e.g. apache
  • status: Enabled, Disabled
  • vulnerability_ids: strings in the form of CVE IDs, such as CVE-1, CVE-2
  • description: string e.g. apache
  • affected_software: strings
  • cwe_ids: strings in the form of CWE IDs such as CWE-20
  • vendor_names: strings such as Cisco, Siemens
  • severity_score: numbers, such as 2, 3.5
  • epss_score: numbers, such as 2, 3.5
  • count_vulnerable_services: integers, such as 1,2,5
Array
Array
Free-Form object
]
search_frominteger
search_tointeger
Default:500
sortobject
fieldstring (Enum)
Default:"severity_score"
Allowed values:"severity_score""created""first_published""status"
keywordstring (Enum)
Default:"desc"
Allowed values:"ASC""asc""DESC""desc"
Free-Form object
Free-Form object
Free-Form object
REQUEST
{ "request_data": { "filters": [ { "field": "name", "operator": "in", "value": "example" } ], "search_from": 0, "search_to": 0, "sort": { "field": "severity_score", "keyword": "ASC" } } }
Responses

OK

Body
application/json
replyobjectrequired
total_countinteger
result_countinteger
vulnerability_testsarray
[
idstring
namestring
vulnerability_idsarray[string]
descriptionstring
statusstring
vendor_namesarray[string]
affected_softwarearray
[
NAMEstring
VERSION_START_INCLUDINGstring
VERSION_START_EXCLUDINGstring
VERSION_END_INCLUDINGstring
VERSION_END_EXCLUDINGstring
VENDORstring
PRODUCTstring
VERSIONstring
Free-Form object
]
severity_scorenumber
cwe_idsarray[string]
epss_scorenumber
referencesarray[string]
remediation_guidancestring
first_publishedinteger
createdinteger
count_vulnerable_servicesinteger
Free-Form object
]
Free-Form object
Free-Form object
RESPONSE
{ "reply": { "total_count": 0, "result_count": 0, "vulnerability_tests": [ { "id": "example", "name": "example", "vulnerability_ids": [ "example" ], "description": "example", "status": "example", "vendor_names": [ "example" ], "affected_software": [ { "NAME": "example", "VERSION_START_INCLUDING": "example", "VERSION_START_EXCLUDING": "example", "VERSION_END_INCLUDING": "example", "VERSION_END_EXCLUDING": "example", "VENDOR": "example", "PRODUCT": "example", "VERSION": "example" } ], "severity_score": 0.1, "cwe_ids": [ "example" ], "epss_score": 0.1, "references": [ "example" ], "remediation_guidance": "example", "first_published": 0, "created": 0, "count_vulnerable_services": 0 } ] } }

Bad Request. Got an invalid JSON.

Body
application/json
replyobject

The query results upon error.

err_codestring

HTTP response code.

err_msgstring

Error message.

err_extrastring

Additional information describing the error.

Free-Form object
Free-Form object
RESPONSE
{ "reply": { "err_code": "example", "err_msg": "example", "err_extra": "example" } }

Unauthorized access. An issue occurred during authentication. This can indicate an incorrect key, id, or other invalid authentication parameters.

Body
application/json
replyobject

The query results upon error.

err_codestring

HTTP response code.

err_msgstring

Error message.

err_extrastring

Additional information describing the error.

Free-Form object
Free-Form object
RESPONSE
{ "reply": { "err_code": "example", "err_msg": "example", "err_extra": "example" } }

Unauthorized access. User does not have the required license type to run this API.

Body
application/json
replyobject

The query results upon error.

err_codestring

HTTP response code.

err_msgstring

Error message.

err_extrastring

Additional information describing the error.

Free-Form object
Free-Form object
RESPONSE
{ "reply": { "err_code": "example", "err_msg": "example", "err_extra": "example" } }

Forbidden access. The provided API Key does not have the required RBAC permissions to run this API.

Body
application/json
replyobject

The query results upon error.

err_codestring

HTTP response code.

err_msgstring

Error message.

err_extrastring

Additional information describing the error.

Free-Form object
Free-Form object
RESPONSE
{ "reply": { "err_code": "example", "err_msg": "example", "err_extra": "example" } }

Unprocessable Entity

Body
application/json
codeinteger

Error code

statusstring

Error name

messagestring

Error message

errorsobject

Errors

RESPONSE
{ "code": 0, "status": "example", "message": "example", "errors": {} }

Internal server error. A unified status for API communication type errors.

Body
application/json
replyobject

The query results upon error.

err_codestring

HTTP response code.

err_msgstring

Error message.

err_extrastring

Additional information describing the error.

Free-Form object
Free-Form object
RESPONSE
{ "reply": { "err_code": "example", "err_msg": "example", "err_extra": "example" } }