ListUsedDockerImages
List all Docker images that are in use by the installed integrations and automations.
python · Common Scripts
Details
| ID | ListUsedDockerImages |
|---|---|
| Language | python |
| From Version | 6.1.0 |
| Docker Image | demisto/python3:3.12.13.10404775 |
| Tags | Utility Dockers General |
README
List all Docker images that are in use by the installed integrations and automations.
Script Data
| Name | Description |
|---|---|
| Script Type | python3 |
| Tags | Utility, Dockers, General |
| Cortex XSOAR Version | 6.1.0 |
Inputs
| Argument Name | Description |
|---|---|
| export_to_context | Whether to export the result to context. Possible values: “true” and “false”. Default is “true”. |
Outputs
| Path | Description | Type |
|---|---|---|
| UsedDockerImages.DockerImage | The Docker image name. | String |
| UsedDockerImages.ContentItem | The integration or automation name that used the specific Docker image. | String |
Script Example
## Context Example
```json
{
"UsedDockerImages": [
{
"ContentItem": [
"Active Directory Query v2"
],
"DockerImage": "demisto/ldap:1.0.0.23980"
},
{
"ContentItem": [
"AutoFocus Daily Feed",
"McAfee ePO",
"ServiceNow CMDB",
"ServiceNow IAM",
"ServiceNow v2"
],
"DockerImage": "demisto/python3:3.9.6.22912"
},
{
"ContentItem": [
"AutoFocus Feed",
"GitLab (Community Contribution)",
"Palo Alto Networks AutoFocus v2",
"ExtractEmailV2",
"GetIndicatorDBotScoreFromCache"
],
"DockerImage": "demisto/python3:3.9.6.24019"
}
]
}
Human Readable Output
Docker Images In use
| Docker Image | Content Item |
|---|---|
| demisto/ldap:1.0.0.23980 | Active Directory Query v2 |
| demisto/python3:3.9.6.22912 | AutoFocus Daily Feed, McAfee ePO, ServiceNow CMDB, ServiceNow IAM, ServiceNow v2 |
| demisto/python3:3.9.6.24019 | AutoFocus Feed, GitLab (Community Contribution), Palo Alto Networks AutoFocus v2, ExtractEmailV2, GetIndicatorDBotScoreFromCache |
"""ListUsedDockersImages for Cortex XSOAR - Unit Tests file Pytest Unit Tests: all functions names must start with "test_" More details: https://xsoar.pan.dev/docs/integrations/unit-testing """ INTEGRATION = """ { "configurations":[ { "brand": "", "id": "no-integration-script-conf", "display": "no-integration-script-conf", "integrationScript": null }, { "brand": "", "id": "integration-script-java", "display": "integration-script-java", "integrationScript": { "subtype": "", "type": "java" } }, { "brand": "", "id": "integration-script-python", "display": "integration-script-python", "integrationScript": { "subtype": "", "type": "python", "dockerImage": "demisto/python3:3.9.7.12345" } }, { "brand": "", "id": "integration-script-powershell", "display": "integration-script-powershell", "integrationScript": { "subtype": "", "type": "python", "dockerImage": "demisto/powershell:3.9.7.12345" } }, { "brand": "", "id": "no-integration-script", "display": "no-integration-script", "integrationScript": { "subtype": "", "type": "powershell" } } ], "instances":[ { "brand": "not-enbaled-instance", "enabled": "false" }, { "brand": "instance-integration-script-false", "enabled": "true", "isIntegrationScript": false }, { "brand": "no-integration-script-conf", "enabled": "true", "isIntegrationScript": true }, { "brand": "integration-script-java", "enabled": "true", "isIntegrationScript": true }, { "brand": "integration-script-python", "enabled": "true", "isIntegrationScript": true }, { "brand": "inst5", "enabled": "true", "isIntegrationScript": true } ] }""" AUTOMATIONS = """{ "scripts": [ { "id": "AddDBotScoreToContext", "version": 1, "name": "AddDBotScoreToContext", "type": "python", "tags": [], "contextKeys": [], "enabled": true, "system": true, "detached": false, "locked": false, "user": "", "dockerImage": "demisto/python3:3.9.5.20070", "modified": "2021-10-07T12:29:40.415069382Z", "scriptTarget": 0, "runAs": "DBotWeakRole", "roles": [], "permitted": true, "propagationLabels": null }, { "id": "AddEvidence", "version": 1, "name": "AddEvidence", "type": "javascript", "tags": [ "Utility" ], "contextKeys": [], "enabled": true, "system": true, "detached": false, "locked": false, "user": "", "dockerImage": "", "modified": "2021-10-07T12:29:40.414798295Z", "scriptTarget": 0, "runAs": "DBotWeakRole", "roles": [], "permitted": true, "propagationLabels": null }, { "id": "AddKeyToList", "version": 1, "name": "AddKeyToList", "type": "python", "tags": [], "contextKeys": [], "enabled": false, "hidden": true, "system": true, "detached": false, "locked": false, "user": "", "dockerImage": "demisto/python3:3.8.6.13358", "modified": "2021-10-07T12:29:40.412254289Z", "scriptTarget": 0, "runAs": "DBotWeakRole", "roles": [], "permitted": true, "propagationLabels": null }, { "id": "DBotMLFetchData", "version": 1, "name": "DBotMLFetchData", "type": "python", "tags": [ "ml" ], "contextKeys": [], "enabled": false, "hidden": true, "system": true, "detached": false, "locked": false, "user": "", "dockerImage": "demisto/fetch-data:1.0.0.22177", "modified": "2021-10-07T12:29:40.406291219Z", "scriptTarget": 0, "deprecated": true, "runAs": "DBotWeakRole", "roles": [], "permitted": true, "propagationLabels": null }, { "id": "DemistoUploadFile", "version": 1, "name": "DemistoUploadFile", "type": "javascript", "tags": [ "DemistoAPI" ], "contextKeys": [], "enabled": true, "system": true, "detached": false, "locked": false, "user": "", "dockerImage": "", "modified": "2021-10-07T12:29:40.416194161Z", "scriptTarget": 0, "dependsOn": { "must": [ "core-api-multipart" ] }, "deprecated": true, "runAs": "DBotWeakRole", "roles": [], "permitted": true, "propagationLabels": null }, { "id": "DBotPredictPhishingWords", "version": 1, "name": "DBotPredictPhishingWords", "type": "python", "tags": [ "ml", "phishing" ], "contextKeys": [], "enabled": false, "hidden": true, "system": true, "detached": false, "locked": false, "user": "", "dockerImage": "demisto/ml:1.0.0.23334", "modified": "2021-10-07T12:29:40.406051138Z", "scriptTarget": 0, "runAs": "DBotWeakRole", "roles": [], "permitted": true, "propagationLabels": null } ], "selectedScript": null, "suggestions": [ "Condition", "DBot", "DemistoAPI", "Enrichment", "IAM", "JSON", "Threat Intel Management", "UrlScan", "Utilities", "Utility", "active directory", "autoextract", "basescript", "campaign", "carbon-black" ], "pythonEnabled": true }""" def test_api_response_parsing(): """ Tests REST API responses parsing content. """ from ListUsedDockerImages import ( extract_dockers_from_automation_search_result, extract_dockers_from_integration_search_result, format_result_for_markdown, merge_result, ) integration_response = extract_dockers_from_integration_search_result(INTEGRATION, False, True) automation_response = extract_dockers_from_automation_search_result(AUTOMATIONS) assert len(integration_response) == 1 or len(automation_response) == 1 result_dict = {} result_dict = merge_result(integration_response, result_dict) result_dict = merge_result(automation_response, result_dict) assert len(result_dict) == 2 result_str = format_result_for_markdown(result_dict) assert len(result_dict) == len(result_str)