Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crowdstrike OpenAPI: Fixed the the cs-download-sensor-installer-by-id command #27655

Merged
merged 3 commits into from
Jun 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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