Generating API Key + Customer ID: (apikey.json)
{ "items": [ { "hostName": "jenkins-master", "id": "b532244b-2f5e-4350-81b6-4f05483f6395", "os": "Alpine Linux", "osFlavor": "debian", "osqueryVersion": "5.7.0.23-Uptycs", "osVersion": " v3.17", "status": "active", "live": true } ] } |
The items json array would contain zero rows if host is not found, one entry if host is found. So read output['items'][0]['id'] to get the assetId to be used in subsequent and relevant API calls.
{ "id": "abc96dd7-893a-4594-a12c-6e0c374571a0", "name": "78353296ca08c120a5369eef28233a96", "status": "QUEUED", "links": [ { "rel": "self", "title": "Query job information", "href": "/api/customers/6dedb183-57df-47bb-aec2-2fc338553d71/vulnerabilities/details/abc96dd7-893a-4594-a12c-6e0c374571a0" }, { "rel": "parent", "title": "Query jobs information", "href": "/api/customers/6dedb183-57df-47bb-aec2-2fc338553d71/vulnerabilities/details" } ], "startTime": null, "endTime": null, "error": null } |
{ "items":[], "links":[ { "rel":"self", "title":"Query job results information", "href":"/api/customers/6dedb183-57df-47bb-aec2-2fc338553d71/vulnerabilities/details"}, { "rel":"parent", "title":"Query job information", "href":"/api/customers/6dedb183-57df-47bb-aec2-2fc338553d71/vulnerabilities"} ],"status":"RUNNING", "id":"abc96dd7-893a-4594-a12c-6e0c374571a0", "error":null, "endTime":null, "startTime":"2023-03-15T09:26:18.468Z", "rowCount":null, "offset":0, "limit":50000 } |
{ "items": [ { "createdAt": "2023-03-15", "rowDataHash": "3ac0e533-78ed-351d-8e72-2588dc2b3cca", "customerId": "6dedb183-57df-47bb-aec2-2fc338553d71", "rowData": { "severity": "critical", "affectedPackageCount": 7, "fixAvailable": true, "advisoryAttackVector": null, "isCustomVulnerability": false, "os": "Ubuntu", "affectedPackages": "[\"linux-headers-4.15.0-142\",\"linux-modules-4.15.0-142-generic\",\"linux-headers-4.15.0-142-generic\",\"linux-modules-extra-4.15.0-142-generic\",\"linux-headers-4.15.0-140-generic\",\"linux-headers-4.15.0-140\",\"linux-libc-dev\"]", "references": "", "os_version": "16.04", "indicator_type": "Uptycs", "package_type": "deb", "fixVersion": "4.4.0-236.270", "maxCvssScore": "10.0", "cve_list": "CVE-2022-3643", "indicator_version": "4.4.0-236.270", "package_version": "4.4.0-210.242", "exploitTitle": "", "system_type": "host", "indicator_operator": "lt", "nvdAttackVector": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H", "package_name": "linux-modules-extra-4.15.0-142-generic", "package_arch": "amd64", "exploitAvailable": false, "uptycs_score": "10.0" }, "rowNumber": 1, "queryJobId": "abc96dd7-893a-4594-a12c-6e0c374571a0" } ], "name": "a40277a2359df0bd9acecf61d95d07ad", "endTime": "2023-03-15T09:41:12.596Z", "startTime": "2023-03-15T09:41:10.120Z", "error": null, "rowCount": 2559, "resultStore": "cache", "offset": null, "limit": null } |
Step1: This API is asynchronous, once submitted it returns a “QueryJobId” indicating that query is submitted to the cloud. Then keeps calling “QueryJob” API (Step2) periodically (say every second) to figure out the status of the Job. When the status of the job is finished, it calls the “QueryJobResults” API (Step3) to fetch the results, the list of hosts affected by a given CVE.
Follow Step2, “QueryJob” API to get the status of asynchronous API and Step3, “QueryJobResults” API to fetch the results, the list of hosts affected by a given CVE.
{ "items": [ { "createdAt": "2023-03-10", "rowDataHash": "ef5f1f1e-2b94-3a6f-b398-53969f9063bf", "customerId": "6dedb183-57df-47bb-aec2-2fc338553d71", "rowData": { "high": 0, "lastSeen": "2023-03-10 13:37:00.0", "critical": 2, "upt_hostname": "vul-docker-repo", "low": 0, "firstSeen": "2023-03-10 13:37:00.0", "agentless": false, "medium": 0, "upt_asset_id": "1b146a2a-36f3-45a0-9f8b-75b65b2a4d19", "packagesAffected": 1, "maxCvss_score": "9.8" }, "rowNumber": 1, "queryJobId": "a6246a03-bcdf-4ada-a2df-4ddc06ed8747" } ] } |
{ "id": "5549f040-0769-484b-9735-3d2fd2fa0387", "name": "e778b1b2e8242105a9cdc4178fd8d8eb", "status": "RUNNING", "links": [ { "rel": "self", "title": "Query job information", "href": "/api/customers/6dedb183-57df-47bb-aec2-2fc338553d71/vulnerabilities/details/5549f040-0769-484b-9735-3d2fd2fa0387" }, { "rel": "parent", "title": "Query jobs information", "href": "/api/customers/6dedb183-57df-47bb-aec2-2fc338553d71/vulnerabilities/details" } ], "startTime": "2023-03-10T15:16:56.949Z", "endTime": null, "error": null } |
Follow Step2, “QueryJob” API to get the status of asynchronous API and Step3, “QueryJobResults” API to fetch the results, the list of CVEs for a given Package_Name and Package_Version.
{ "items": [ { "createdAt": "2023-03-10", "rowDataHash": "9e61f6bf-bd0e-3e87-ae44-976dfe863cd7", "customerId": "6dedb183-57df-47bb-aec2-2fc338553d71", "rowData": { "severity": "medium", "cve_list": "CVE-2022-3821", "fixAvailable": true, "reliable": true, "isCustomVulnerability": false, "end_of_life": false, "advisory_severity": "medium", "confidence": true, "exploitAvailable": false, "uptycs_score": "5.5", "maxCvssScore": "5.5" }, "rowNumber": 1, "queryJobId": "5549f040-0769-484b-9735-3d2fd2fa0387" }, { "createdAt": "2023-03-10", "rowDataHash": "5ed1784c-df9b-36ca-a230-1211f3998ad5", "customerId": "6dedb183-57df-47bb-aec2-2fc338553d71", "rowData": { "severity": "unknown", "cve_list": "CVE-2023-26604", "fixAvailable": false, "reliable": true, "isCustomVulnerability": false, "end_of_life": false, "advisory_severity": "medium", "confidence": true, "exploitAvailable": true, "uptycs_score": "6", "maxCvssScore": null }, "rowNumber": 2, "queryJobId": "5549f040-0769-484b-9735-3d2fd2fa0387" } ] } |
Step1: This API is asynchronous, once submitted it returns a “QueryJobId” indicating that query is submitted to the cloud. Then keeps calling “QueryJob” API (Step2) periodically (say every second) to figure out the status of the Job. When the status of the job is finished, it calls the “QueryJobResults” API (Step3) to fetch the results, the list of hosts affected for a given Package_Name and Package_Version.
{ "id": "13796585-8dae-4c5a-99f3-f04af6d2bcb6", "name": "49fab4442ad00109c5559d8181cbd326", "status": "QUEUED", "links": [ { "rel": "self", "title": "Query job information", "href": "/api/customers/6dedb183-57df-47bb-aec2-2fc338553d71/vulnerabilities/details/13796585-8dae-4c5a-99f3-f04af6d2bcb6" }, { "rel": "parent", "title": "Query jobs information", "href": "/api/customers/6dedb183-57df-47bb-aec2-2fc338553d71/vulnerabilities/details" } ], "startTime": null, "endTime": null, "error": null } |
Follow Step2, “QueryJob” API to get the status of asynchronous API and Step3, “QueryJobResults” API to fetch the results, the list of hosts affected for a given Package_Name and Package_Version.
{ "items": [ { "createdAt": "2023-03-10", "rowDataHash": "6d5b7fc5-6e5b-33b3-94b0-93bc14bdec48", "customerId": "6dedb183-57df-47bb-aec2-2fc338553d71", "rowData": { "hostName": "local", "package_version": "237-3ubuntu10.56", "firstSeen": "2023-03-08 09:09:41.0", "agentless": false, "package_name": "systemd", "upt_asset_id": "3e350c8f-4b04-4ec2-b487-c4c62fc5cf89" }, "rowNumber": 1, "queryJobId": "13796585-8dae-4c5a-99f3-f04af6d2bcb6" }, { "createdAt": "2023-03-10", "rowDataHash": "204f9a3e-d46f-34fe-a995-511123676b20", "customerId": "6dedb183-57df-47bb-aec2-2fc338553d71", "rowData": { "hostName": "jenkins-master", "package_version": "237-3ubuntu10.56", "firstSeen": "2023-03-08 04:20:25.0", "agentless": false, "package_name": "systemd", "upt_asset_id": "b532244b-2f5e-4350-81b6-4f05483f6395" }, "rowNumber": 2, "queryJobId": "13796585-8dae-4c5a-99f3-f04af6d2bcb6" } ] } |