Skip to content

Commit

Permalink
Crowdstrike OpenAPI: Fixed the the cs-download-sensor-installer-by-id…
Browse files Browse the repository at this point in the history
… command (#27655)

* Fixed an issue where the ***cs-download-sensor-installer-by-id*** command was not returned the file.

* update dockerimage

* changed the file name to be generic
  • Loading branch information
moishce authored and MosheEichler committed Jul 2, 2023
1 parent 4f28a77 commit 2c3360f
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def _error_handler(res: requests.Response):
raise DemistoException(err_msg)

def http_request(self, method, url_suffix, full_url=None, headers=None, json_data=None, params=None, data=None,
files=None, timeout=10, ok_codes=None, return_empty_response=False, auth=None):
files=None, timeout=10, ok_codes=None, return_empty_response=False, auth=None, resp_type='json'):
"""A wrapper for requests lib to send our requests and handle requests and responses better.
:type method: ``str``
Expand Down Expand Up @@ -107,7 +107,7 @@ def http_request(self, method, url_suffix, full_url=None, headers=None, json_dat
return super()._http_request(method=method, url_suffix=url_suffix, full_url=full_url, headers=headers,
json_data=json_data, params=params, data=data, files=files, timeout=req_timeout,
ok_codes=ok_codes, return_empty_response=return_empty_response, auth=auth,
error_handler=self._error_handler)
error_handler=self._error_handler, resp_type=resp_type)

def _get_token(self, force_gen_new_token=False):
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -840,7 +840,8 @@ def download_sensor_installer_by_id_request(self, id_):

headers = self.cs_client._headers

response = self.cs_client.http_request('get', 'sensors/entities/download-installer/v1', params=params, headers=headers)
response = self.cs_client.http_request('get', 'sensors/entities/download-installer/v1', params=params, headers=headers,
resp_type='response')

return response

Expand Down Expand Up @@ -4985,16 +4986,15 @@ def devices_ran_on_command(client, args):

def download_sensor_installer_by_id_command(client, args):
id_ = str(args.get('id_', ''))

response = client.download_sensor_installer_by_id_request(id_)
command_results = CommandResults(
outputs_prefix='CrowdStrike.domainDownloadItem',
outputs_key_field='',
outputs=response,
raw_response=response
)
data = response.content
try:
file_name = response.headers.get('Content-Disposition').split('attachment; filename=')[1]
except Exception as err:
demisto.debug(f'Failed extracting filename from response headers - [{str(err)}]')
file_name = f'cs_installer-id-{id_}'

return command_results
return fileResult(filename=file_name, data=data, file_type=EntryType.FILE)


def entitiesprocesses_command(client, args):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27274,7 +27274,7 @@ script:
- contextPath: CrowdStrike.deviceNetworkHistory.resources.history.timestamp
description: ''
type: String
dockerimage: demisto/python3:3.10.11.54132
dockerimage: demisto/python3:3.10.12.63474
feed: false
isfetch: false
longRunning: false
Expand Down
5 changes: 5 additions & 0 deletions Packs/CrowdStrikeOpenAPI/ReleaseNotes/1_0_16.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

#### Integrations
##### CrowdStrike OpenAPI (Beta)
- Fixed an issue where the ***cs-download-sensor-installer-by-id*** command failed.
- Updated the Docker image to: *demisto/python3:3.10.12.63474*.
2 changes: 1 addition & 1 deletion Packs/CrowdStrikeOpenAPI/pack_metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "CrowdStrike OpenAPI",
"description": "Use the CrowdStrike OpenAPI integration to interact with CrowdStrike APIs that do not have dedicated integrations in Cortex XSOAR, for example, CrowdStrike FalconX, etc.",
"support": "xsoar",
"currentVersion": "1.0.15",
"currentVersion": "1.0.16",
"author": "Cortex XSOAR",
"url": "https://www.paloaltonetworks.com/cortex",
"email": "",
Expand Down

0 comments on commit 2c3360f

Please sign in to comment.