From 0c8bd66d324d2b1f0b1f41638a915d9999e8a250 Mon Sep 17 00:00:00 2001 From: Ko Ga <85439776+kgal-pan@users.noreply.github.com> Date: Sun, 11 Aug 2024 11:26:51 +0300 Subject: [PATCH] Remove `mypy` Global Ignores (#35643) * Remove mypy global ignores * update docker images * update docker images p2 * update rn * update rn p2 * add rn to gcp iam * Bump pack from version CommonScripts to 1.15.40. * install missing my dep types-request * update mispv3 docker image add missing mypy deps * revert mispv3 docker image * Bump pack from version CommonScripts to 1.15.41. * Bump pack from version Base to 1.34.32. * add missing type hints * Bump pack from version CommonScripts to 1.15.42. * Bump pack from version Base to 1.34.33. * revert precommit template * Bump pack from version Base to 1.34.34. * Bump pack from version CommonScripts to 1.15.43. * Bump pack from version CommonScripts to 1.15.44. * fix rn * Bump pack from version CommonScripts to 1.15.45. * Bump pack from version AzureDataExplorer to 1.3.2. * Bump pack from version AzureDevOps to 1.4.2. * Bump pack from version CommonScripts to 1.15.46. * Bump pack from version CommonScripts to 1.15.47. * Bump pack from version CommonScripts to 1.15.48. --------- Co-authored-by: Content Bot --- .../AzureDataExplorer/AzureDataExplorer.py | 32 +- Packs/AzureDataExplorer/ReleaseNotes/1_3_2.md | 6 + Packs/AzureDataExplorer/pack_metadata.json | 2 +- .../Integrations/AzureDevOps/AzureDevOps.py | 2 +- Packs/AzureDevOps/ReleaseNotes/1_4_2.md | 6 + Packs/AzureDevOps/pack_metadata.json | 2 +- Packs/Base/ReleaseNotes/1_34_31.md | 2 +- Packs/Base/ReleaseNotes/1_34_34.md | 6 + .../FindSimilarIncidentsByText.py | 1 - Packs/Base/pack_metadata.json | 2 +- Packs/BmcITSM/Integrations/BmcITSM/BmcITSM.py | 651 +++++++++--------- Packs/BmcITSM/ReleaseNotes/1_0_24.md | 6 + Packs/BmcITSM/pack_metadata.json | 2 +- .../CheckPointDome9/CheckPointDome9.py | 296 ++++---- .../CheckPointDome9/CheckPointDome9.yml | 2 +- .../CheckPointDome9/CheckPointDome9_test.py | 3 +- Packs/CheckPointDome9/ReleaseNotes/1_0_17.md | 6 + Packs/CheckPointDome9/pack_metadata.json | 2 +- Packs/CommonScripts/ReleaseNotes/1_15_48.md | 6 + .../FindSimilarIncidentsV2.py | 2 - Packs/CommonScripts/pack_metadata.json | 2 +- .../CyrenInboxSecurity/ReleaseNotes/1_1_13.md | 9 + .../CyrenFindSimilarIncidents.py | 3 - .../CyrenShowThreatIndicators.py | 3 - Packs/CyrenInboxSecurity/pack_metadata.json | 2 +- .../ForescoutEyeInspect.py | 197 +++--- .../ForescoutEyeInspect.yml | 2 +- .../ReleaseNotes/1_0_22.md | 6 + Packs/ForescoutEyeInspect/pack_metadata.json | 2 +- .../Integrations/FortiSIEMV2/FortiSIEMV2.py | 176 ++--- .../Integrations/FortiSIEMV2/FortiSIEMV2.yml | 2 +- Packs/FortiSIEM/ReleaseNotes/2_0_36.md | 6 + Packs/FortiSIEM/pack_metadata.json | 2 +- Packs/GCP-IAM/Integrations/GCPIAM/GCPIAM.py | 2 +- Packs/GCP-IAM/Integrations/GCPIAM/GCPIAM.yml | 2 +- Packs/GCP-IAM/ReleaseNotes/1_0_26.md | 6 + Packs/GCP-IAM/pack_metadata.json | 2 +- .../IronDefense/IronDefense_test.py | 65 +- Packs/MISP/Integrations/MISPV3/MISPV3.py | 9 +- Packs/MISP/Integrations/MISPV3/MISPV3_test.py | 2 +- Packs/MISP/Integrations/MISP_V2/MISP_V2.py | 2 - Packs/MISP/ReleaseNotes/2_1_44.md | 9 + Packs/MISP/pack_metadata.json | 2 +- .../NetskopeAPIv1/NetskopeAPIv1.py | 112 +-- .../NetskopeAPIv1/NetskopeAPIv1.yml | 2 +- Packs/Netskope/ReleaseNotes/3_3_11.md | 6 + Packs/Netskope/pack_metadata.json | 2 +- .../Tenable_io/Tenable_io_test.py | 1 - 48 files changed, 876 insertions(+), 797 deletions(-) create mode 100644 Packs/AzureDataExplorer/ReleaseNotes/1_3_2.md create mode 100644 Packs/AzureDevOps/ReleaseNotes/1_4_2.md create mode 100644 Packs/Base/ReleaseNotes/1_34_34.md create mode 100644 Packs/BmcITSM/ReleaseNotes/1_0_24.md create mode 100644 Packs/CheckPointDome9/ReleaseNotes/1_0_17.md create mode 100644 Packs/CommonScripts/ReleaseNotes/1_15_48.md create mode 100644 Packs/CyrenInboxSecurity/ReleaseNotes/1_1_13.md create mode 100644 Packs/ForescoutEyeInspect/ReleaseNotes/1_0_22.md create mode 100644 Packs/FortiSIEM/ReleaseNotes/2_0_36.md create mode 100644 Packs/GCP-IAM/ReleaseNotes/1_0_26.md create mode 100644 Packs/MISP/ReleaseNotes/2_1_44.md create mode 100644 Packs/Netskope/ReleaseNotes/3_3_11.md diff --git a/Packs/AzureDataExplorer/Integrations/AzureDataExplorer/AzureDataExplorer.py b/Packs/AzureDataExplorer/Integrations/AzureDataExplorer/AzureDataExplorer.py index 2742c91d99c..5f8c310408a 100644 --- a/Packs/AzureDataExplorer/Integrations/AzureDataExplorer/AzureDataExplorer.py +++ b/Packs/AzureDataExplorer/Integrations/AzureDataExplorer/AzureDataExplorer.py @@ -1,5 +1,3 @@ -# type: ignore -# Disable insecure warnings from CommonServerPython import * ''' IMPORTS ''' @@ -257,12 +255,18 @@ def search_queries_list_command(client: DataExplorerClient, args: dict[str, Any] page_size = arg_to_number(args.get('page_size')) limit = arg_to_number(args.get('limit', DEFAULT_LIMIT)) client_activity_id = str(args.get('client_activity_id', '')) - validate_list_command_arguments(page, page_size, limit) + validate_list_command_arguments(page, page_size, limit) # type: ignore[arg-type] response = client.search_queries_list_request( database_name, client_activity_id) - return retrieve_command_results_of_list_commands(response, 'List of Completed Search Queries', - page, page_size, limit, 'AzureDataExplorer.SearchQuery') + return retrieve_command_results_of_list_commands( + response, + 'List of Completed Search Queries', + page, # type: ignore[arg-type] + page_size, # type: ignore[arg-type] + limit, # type: ignore[arg-type] + 'AzureDataExplorer.SearchQuery' + ) def running_search_queries_list_command(client: DataExplorerClient, args: dict[str, Any]) -> CommandResults: @@ -281,12 +285,18 @@ def running_search_queries_list_command(client: DataExplorerClient, args: dict[s limit = arg_to_number(args.get('limit', DEFAULT_LIMIT)) client_activity_id = str(args.get('client_activity_id', '')) - validate_list_command_arguments(page, page_size, limit) + validate_list_command_arguments(page, page_size, limit) # type: ignore[arg-type] response = client.running_search_queries_list_request( database_name, client_activity_id) - return retrieve_command_results_of_list_commands(response, 'List of Currently running Search Queries', - page, page_size, limit, 'AzureDataExplorer.RunningSearchQuery') + return retrieve_command_results_of_list_commands( + response, + 'List of Currently running Search Queries', + page, # type: ignore[arg-type] + page_size, # type: ignore[arg-type] + limit, # type: ignore[arg-type] + 'AzureDataExplorer.RunningSearchQuery' + ) def running_search_query_cancel_command(client: DataExplorerClient, args: dict[str, Any]) -> \ @@ -461,7 +471,7 @@ def retrieve_common_request_body(database_name: str, query: str, "csl": query } if properties: - data['properties'] = properties + data['properties'] = properties # type: ignore[assignment] return data @@ -587,8 +597,8 @@ def main() -> None: demisto.debug(f'Command being called is {command}') try: - requests.packages.urllib3.disable_warnings() - client: DataExplorerClient = DataExplorerClient(cluster_url, client_id, client_activity_prefix, + requests.packages.urllib3.disable_warnings() # type: ignore[attr-defined] + client: DataExplorerClient = DataExplorerClient(cluster_url, client_id, client_activity_prefix, # type: ignore[arg-type] verify_certificate, proxy, connection_type, tenant_id, enc_key, auth_code, redirect_uri) diff --git a/Packs/AzureDataExplorer/ReleaseNotes/1_3_2.md b/Packs/AzureDataExplorer/ReleaseNotes/1_3_2.md new file mode 100644 index 00000000000..61d7022c3a3 --- /dev/null +++ b/Packs/AzureDataExplorer/ReleaseNotes/1_3_2.md @@ -0,0 +1,6 @@ + +#### Integrations + +##### Azure Data Explorer + +- Maintenance and stability enhancements. diff --git a/Packs/AzureDataExplorer/pack_metadata.json b/Packs/AzureDataExplorer/pack_metadata.json index e72012f2dbc..991f98e41ca 100644 --- a/Packs/AzureDataExplorer/pack_metadata.json +++ b/Packs/AzureDataExplorer/pack_metadata.json @@ -2,7 +2,7 @@ "name": "Azure Data Explorer", "description": "Use Azure Data Explorer integration to collect and analyze data inside clusters of Azure Data Explorer and manage search queries.", "support": "xsoar", - "currentVersion": "1.3.1", + "currentVersion": "1.3.2", "author": "Cortex XSOAR", "url": "https://www.paloaltonetworks.com/cortex", "email": "", diff --git a/Packs/AzureDevOps/Integrations/AzureDevOps/AzureDevOps.py b/Packs/AzureDevOps/Integrations/AzureDevOps/AzureDevOps.py index a673ec52170..ec398207286 100644 --- a/Packs/AzureDevOps/Integrations/AzureDevOps/AzureDevOps.py +++ b/Packs/AzureDevOps/Integrations/AzureDevOps/AzureDevOps.py @@ -3,7 +3,7 @@ import demistomock as demisto # noqa: F401 from CommonServerPython import * # noqa: F401 -# type: ignore + from MicrosoftApiModule import * # noqa: E402 import copy from requests import Response diff --git a/Packs/AzureDevOps/ReleaseNotes/1_4_2.md b/Packs/AzureDevOps/ReleaseNotes/1_4_2.md new file mode 100644 index 00000000000..b604c1ed06b --- /dev/null +++ b/Packs/AzureDevOps/ReleaseNotes/1_4_2.md @@ -0,0 +1,6 @@ + +#### Integrations + +##### AzureDevOps + +- Maintenance and stability enhancements. diff --git a/Packs/AzureDevOps/pack_metadata.json b/Packs/AzureDevOps/pack_metadata.json index e15d328afd4..9b3d4e3e91b 100644 --- a/Packs/AzureDevOps/pack_metadata.json +++ b/Packs/AzureDevOps/pack_metadata.json @@ -2,7 +2,7 @@ "name": "AzureDevOps", "description": "Create and manage Git repositories in Azure DevOps Services.", "support": "xsoar", - "currentVersion": "1.4.1", + "currentVersion": "1.4.2", "author": "Cortex XSOAR", "url": "https://www.paloaltonetworks.com/cortex", "email": "", diff --git a/Packs/Base/ReleaseNotes/1_34_31.md b/Packs/Base/ReleaseNotes/1_34_31.md index 41ae70613f9..fa06a17c3fa 100644 --- a/Packs/Base/ReleaseNotes/1_34_31.md +++ b/Packs/Base/ReleaseNotes/1_34_31.md @@ -18,4 +18,4 @@ - Updated the Docker image to: *demisto/ml:1.0.0.105874*. ##### DBotPreProcessTextData -- Updated the Docker image to: *demisto/ml:1.0.0.105874*. \ No newline at end of file +- Updated the Docker image to: *demisto/ml:1.0.0.105874*. diff --git a/Packs/Base/ReleaseNotes/1_34_34.md b/Packs/Base/ReleaseNotes/1_34_34.md new file mode 100644 index 00000000000..6b166caea02 --- /dev/null +++ b/Packs/Base/ReleaseNotes/1_34_34.md @@ -0,0 +1,6 @@ + +#### Scripts + +##### FindSimilarIncidentsByText + +- Maintenance and stability enhancements. diff --git a/Packs/Base/Scripts/FindSimilarIncidentsByText/FindSimilarIncidentsByText.py b/Packs/Base/Scripts/FindSimilarIncidentsByText/FindSimilarIncidentsByText.py index 4d381231df4..56661c2f14d 100644 --- a/Packs/Base/Scripts/FindSimilarIncidentsByText/FindSimilarIncidentsByText.py +++ b/Packs/Base/Scripts/FindSimilarIncidentsByText/FindSimilarIncidentsByText.py @@ -1,4 +1,3 @@ -# type: ignore import dateutil.parser from sklearn.feature_extraction.text import TfidfVectorizer from sklearn.metrics.pairwise import linear_kernel diff --git a/Packs/Base/pack_metadata.json b/Packs/Base/pack_metadata.json index 9d147bce86b..ec6704e5d62 100644 --- a/Packs/Base/pack_metadata.json +++ b/Packs/Base/pack_metadata.json @@ -2,7 +2,7 @@ "name": "Base", "description": "The base pack for Cortex XSOAR.", "support": "xsoar", - "currentVersion": "1.34.33", + "currentVersion": "1.34.34", "author": "Cortex XSOAR", "serverMinVersion": "6.0.0", "url": "https://www.paloaltonetworks.com/cortex", diff --git a/Packs/BmcITSM/Integrations/BmcITSM/BmcITSM.py b/Packs/BmcITSM/Integrations/BmcITSM/BmcITSM.py index 29690795fd9..830f929b785 100644 --- a/Packs/BmcITSM/Integrations/BmcITSM/BmcITSM.py +++ b/Packs/BmcITSM/Integrations/BmcITSM/BmcITSM.py @@ -1,7 +1,6 @@ import demistomock as demisto # noqa: F401 from CommonServerPython import * # noqa: F401 -# type: ignore -# mypy: ignore-errors + from copy import deepcopy from collections.abc import Callable @@ -281,7 +280,7 @@ TICKET_INCIDENT_TYPES = [ "BMC Change-Request", "BMC Incident", - "BMC Problem – Known Error", + "BMC Problem - Known Error", "BMC Problem Investigation incident", "BMC Service Request", "BMC Task", @@ -293,7 +292,7 @@ CHANGE_REQUEST: "BMC Change-Request", INCIDENT: "BMC Incident", PROBLEM_INVESTIGATION: "BMC Problem Investigation incident", - KNOWN_ERROR: "BMC Problem – Known Error", + KNOWN_ERROR: "BMC Problem - Known Error", TASK: "BMC Task", WORK_ORDER: "BMC Work Order", } @@ -1478,7 +1477,7 @@ def list_command( Returns: CommandResults: Command reuslts. """ - query: str = args.get("query") + query: str = args.get("query") # type: ignore[assignment] page = arg_to_number(args.get("page")) page_size = arg_to_number(args.get("page_size")) limit = arg_to_number(args.get("limit")) @@ -1490,7 +1489,7 @@ def list_command( response = client.list_request(form_name, query_with_filtering if query_with_filtering else None) - relevant_records, header_suffix = get_paginated_records_with_hr(response.get("entries"), limit, + relevant_records, header_suffix = get_paginated_records_with_hr(response.get("entries"), limit, # type: ignore[arg-type] page, page_size) outputs = format_command_output(relevant_records, context_output_mapper, arranger) readable_output = tableToMarkdown( @@ -1781,30 +1780,30 @@ def service_request_create_command(client: Client, args: Dict[str, Any]) -> Comm last_name = args.get("last_name") login_id = args.get("login_id") - additional_fields = extract_args_from_additional_fields_arg(args.get("additional_fields"), + additional_fields = extract_args_from_additional_fields_arg(args.get("additional_fields"), # type: ignore[arg-type] "additional_fields") service_request_definition_params = extract_args_from_additional_fields_arg( - args.get("service_request_definition_params"), + args.get("service_request_definition_params"), # type: ignore[arg-type] "service_request_definition_params", ) validate_related_arguments_provided(first_name=first_name, last_name=last_name, login_id=login_id) - response = client.create_service_request_request( + response = client.create_service_request_request( # type: ignore[arg-type,call-arg] srd_instance_id, - summary, - urgency, - impact, - first_name, - last_name, - login_id, - status, + summary, # type: ignore[arg-type] + urgency, # type: ignore[arg-type] + impact, # type: ignore[arg-type] + first_name, # type: ignore[arg-type] + last_name, # type: ignore[arg-type] + login_id, # type: ignore[arg-type] + status, # type: ignore[arg-type] **additional_fields, **service_request_definition_params, ) - outputs = format_create_ticket_outputs(response.get("values")) + outputs = format_create_ticket_outputs(response.get("values")) # type: ignore[arg-type] readable_output = tableToMarkdown("Service Request successfully Created", outputs, headerTransform=pascalToSpace) @@ -1843,28 +1842,28 @@ def service_request_update_command(client: Client, args: Dict[str, Any]) -> Comm site_group = args.get("site_group") region = args.get("region") site = args.get("site") - additional_fields = extract_args_from_additional_fields_arg(args.get("additional_fields"), + additional_fields = extract_args_from_additional_fields_arg(args.get("additional_fields"), # type: ignore[arg-type] "additional_fields") - formatted_service_request_id = format_ticket_request_id(service_request_id) + formatted_service_request_id = format_ticket_request_id(service_request_id) # type: ignore[arg-type] validate_related_arguments_provided(status=status, status_reason=status_reason) validate_related_arguments_provided(customer_first_name=customer_first_name, customer_last_name=customer_last_name) - client.service_request_update_request( + client.service_request_update_request( # type: ignore[arg-type,call-arg] formatted_service_request_id, summary, - status, - urgency, - impact, - customer_first_name, - customer_last_name, + status, # type: ignore[arg-type] + urgency, # type: ignore[arg-type] + impact, # type: ignore[arg-type] + customer_first_name, # type: ignore[arg-type] + customer_last_name, # type: ignore[arg-type] location_company, - site_group, - region, - site, - assignee, - status_reason, + site_group, # type: ignore[arg-type] + region, # type: ignore[arg-type] + site, # type: ignore[arg-type] + assignee, # type: ignore[arg-type] + status_reason, # type: ignore[arg-type] **additional_fields, ) command_results = CommandResults( @@ -1903,7 +1902,7 @@ def incident_create_command(client: Client, args: Dict[str, Any]) -> CommandResu site = args.get("site") region = args.get("region") - additional_fields = extract_args_from_additional_fields_arg(args.get("additional_fields"), + additional_fields = extract_args_from_additional_fields_arg(args.get("additional_fields"), # type: ignore[arg-type] "additional_fields") validate_related_arguments_provided(assignee_login_id=assignee_login_id, assignee=assignee) @@ -1912,32 +1911,32 @@ def incident_create_command(client: Client, args: Dict[str, Any]) -> CommandResu service_type=service_type, reported_source=reported_source) - response = client.create_incident_request( - template_id, - first_name, - last_name, - summary, - urgency=urgency, - impact=impact, - status=status, - service_type=service_type, - reported_source=reported_source, - details=details, - company=company, - assigned_support_organization=assigned_support_organization, - assigned_support_company=assigned_support_company, - assigned_support_group_name=assigned_support_group_name, - assignee=assignee, - assignee_login_id=assignee_login_id, - site_group=site_group, - site=site, - region=region, + response = client.create_incident_request( # type: ignore[arg-type,call-arg] + template_id, # type: ignore[arg-type] + first_name, # type: ignore[arg-type] + last_name, # type: ignore[arg-type] + summary, # type: ignore[arg-type] + urgency=urgency, # type: ignore[arg-type] + impact=impact, # type: ignore[arg-type] + status=status, # type: ignore[arg-type] + service_type=service_type, # type: ignore[arg-type] + reported_source=reported_source, # type: ignore[arg-type] + details=details, # type: ignore[arg-type] + company=company, # type: ignore[arg-type] + assigned_support_organization=assigned_support_organization, # type: ignore[arg-type] + assigned_support_company=assigned_support_company, # type: ignore[arg-type] + assigned_support_group_name=assigned_support_group_name, # type: ignore[arg-type] + assignee=assignee, # type: ignore[arg-type] + assignee_login_id=assignee_login_id, # type: ignore[arg-type] + site_group=site_group, # type: ignore[arg-type] + site=site, # type: ignore[arg-type] + region=region, # type: ignore[arg-type] **additional_fields, ) incident_request_id = extract_ticket_request_id_following_create( client, INCIDENT, response) # The right request ID is not retrieved by the create endpoint. - outputs = format_create_ticket_outputs(response.get("values")) + outputs = format_create_ticket_outputs(response.get("values")) # type: ignore[arg-type] outputs["RequestID"] = incident_request_id readable_output = tableToMarkdown("Incident ticket successfully Created", @@ -1988,7 +1987,7 @@ def incident_update_command(client: Client, args: Dict[str, Any]) -> CommandResu resolution = args.get("resolution") status_reason = args.get("status_reason") - additional_fields = extract_args_from_additional_fields_arg(args.get("additional_fields"), + additional_fields = extract_args_from_additional_fields_arg(args.get("additional_fields"), # type: ignore[arg-type] "additional_fields") validate_related_arguments_provided(first_name=first_name, last_name=last_name) @@ -1997,28 +1996,28 @@ def incident_update_command(client: Client, args: Dict[str, Any]) -> CommandResu status_reason=status_reason, resolution=resolution) - client.update_incident_request( - format_ticket_request_id(incident_request_id), - first_name, - last_name, - summary, - urgency=urgency, - impact=impact, - status=status, - service_type=service_type, - reported_source=reported_source, - details=details, - company=company, - assigned_support_organization=assigned_support_organization, - assigned_support_company=assigned_support_company, - assigned_support_group_name=assigned_support_group_name, - assignee=assignee, - assignee_login_id=assignee_login_id, - site_group=site_group, - site=site, - region=region, - status_reason=status_reason, - resolution=resolution, + client.update_incident_request( # type: ignore[arg-type,call-arg] + format_ticket_request_id(incident_request_id), # type: ignore[arg-type] + first_name, # type: ignore[arg-type] + last_name, # type: ignore[arg-type] + summary, # type: ignore[arg-type] + urgency=urgency, # type: ignore[arg-type] + impact=impact, # type: ignore[arg-type] + status=status, # type: ignore[arg-type] + service_type=service_type, # type: ignore[arg-type] + reported_source=reported_source, # type: ignore[arg-type] + details=details, # type: ignore[arg-type] + company=company, # type: ignore[arg-type] + assigned_support_organization=assigned_support_organization, # type: ignore[arg-type] + assigned_support_company=assigned_support_company, # type: ignore[arg-type] + assigned_support_group_name=assigned_support_group_name, # type: ignore[arg-type] + assignee=assignee, # type: ignore[arg-type] + assignee_login_id=assignee_login_id, # type: ignore[arg-type] + site_group=site_group, # type: ignore[arg-type] + site=site, # type: ignore[arg-type] + region=region, # type: ignore[arg-type] + status_reason=status_reason, # type: ignore[arg-type] + resolution=resolution, # type: ignore[arg-type] **additional_fields, ) @@ -2051,7 +2050,7 @@ def change_request_create_command(client: Client, args: Dict[str, Any]) -> Comma risk_level = args.get("risk_level") change_type = args.get("change_type") location_company = args.get("location_company") - additional_fields = extract_args_from_additional_fields_arg(args.get("additional_fields"), + additional_fields = extract_args_from_additional_fields_arg(args.get("additional_fields"), # type: ignore[arg-type] "additional_fields") if not template_id: validate_related_arguments_provided( @@ -2061,24 +2060,24 @@ def change_request_create_command(client: Client, args: Dict[str, Any]) -> Comma location_company=location_company, ) - response = client.change_request_create_request( - template_id, - first_name, - last_name, - summary, - location_company, - urgency=urgency, - impact=impact, - status=status, - risk_level=risk_level, - change_type=change_type, - customer_first_name=customer_first_name, - customer_last_name=customer_last_name, - priority=priority, + response = client.change_request_create_request( # type: ignore[arg-type,call-arg] + template_id, # type: ignore[arg-type] + first_name, # type: ignore[arg-type] + last_name, # type: ignore[arg-type] + summary, # type: ignore[arg-type] + location_company, # type: ignore[arg-type] + urgency=urgency, # type: ignore[arg-type] + impact=impact, # type: ignore[arg-type] + status=status, # type: ignore[arg-type] + risk_level=risk_level, # type: ignore[arg-type] + change_type=change_type, # type: ignore[arg-type] + customer_first_name=customer_first_name, # type: ignore[arg-type] + customer_last_name=customer_last_name, # type: ignore[arg-type] + priority=priority, # type: ignore[arg-type] **additional_fields, ) - outputs = format_create_ticket_outputs(response.get("values")) + outputs = format_create_ticket_outputs(response.get("values")) # type: ignore[arg-type] readable_output = tableToMarkdown( "Change Request ticket successfully Created", @@ -2130,37 +2129,37 @@ def change_request_update_command(client: Client, args: Dict[str, Any]) -> Comma company = args.get("company") region = args.get("region") - additional_fields = extract_args_from_additional_fields_arg(args.get("additional_fields"), + additional_fields = extract_args_from_additional_fields_arg(args.get("additional_fields"), # type: ignore[arg-type] "additional_fields") validate_related_arguments_provided(first_name=first_name, last_name=last_name) validate_related_arguments_provided(status=status, status_reason=status_reason) - client.change_request_update_request( - format_ticket_request_id(change_request_id), - first_name, - last_name, - summary, - location_company, - urgency=urgency, - impact=impact, - status=status, - risk_level=risk_level, - change_type=change_type, - customer_first_name=customer_first_name, - customer_last_name=customer_last_name, - priority=priority, - details=details, - status_reason=status_reason, - organization=organization, - department=department, - site_group=site_group, - site=site, - support_organization=support_organization, - support_group_name=support_group_name, - company=company, - region=region, + client.change_request_update_request( # type: ignore[arg-type,call-arg] + format_ticket_request_id(change_request_id), # type: ignore[arg-type] + first_name, # type: ignore[arg-type] + last_name, # type: ignore[arg-type] + summary, # type: ignore[arg-type] + location_company, # type: ignore[arg-type] + urgency=urgency, # type: ignore[arg-type] + impact=impact, # type: ignore[arg-type] + status=status, # type: ignore[arg-type] + risk_level=risk_level, # type: ignore[arg-type] + change_type=change_type, # type: ignore[arg-type] + customer_first_name=customer_first_name, # type: ignore[arg-type] + customer_last_name=customer_last_name, # type: ignore[arg-type] + priority=priority, # type: ignore[arg-type] + details=details, # type: ignore[arg-type] + status_reason=status_reason, # type: ignore[arg-type] + organization=organization, # type: ignore[arg-type] + department=department, # type: ignore[arg-type] + site_group=site_group, # type: ignore[arg-type] + site=site, # type: ignore[arg-type] + support_organization=support_organization, # type: ignore[arg-type] + support_group_name=support_group_name, # type: ignore[arg-type] + company=company, # type: ignore[arg-type] + region=region, # type: ignore[arg-type] **additional_fields, ) @@ -2200,40 +2199,40 @@ def task_create_command(client: Client, args: Dict[str, Any]) -> CommandResults: assigned_support_group_name = args.get("assigned_support_group") assignee = args.get("assignee") company = args.get("location_company") - root_ticket_type = TICKET_TYPE_TO_DELETE_FORM[args.get("root_ticket_type")] - scedulded_start_date: datetime = arg_to_datetime(args.get("scedulded_start_date")) - scedulded_end_date: datetime = arg_to_datetime(args.get("scedulded_end_date")) + root_ticket_type = TICKET_TYPE_TO_DELETE_FORM[args.get("root_ticket_type")] # type: ignore[index] + scedulded_start_date: datetime = arg_to_datetime(args.get("scedulded_start_date")) # type: ignore[assignment] + scedulded_end_date: datetime = arg_to_datetime(args.get("scedulded_end_date")) # type: ignore[assignment] - additional_fields = extract_args_from_additional_fields_arg(args.get("additional_fields"), + additional_fields = extract_args_from_additional_fields_arg(args.get("additional_fields"), # type: ignore[arg-type] "additional_fields") - parent_ticket = get_ticket(client, args.get("root_ticket_type"), root_request_id) - response = client.create_task_request( - template_id, - parent_ticket.get("InstanceId"), - root_request_name or parent_ticket.get("DisplayID"), - parent_ticket.get("DisplayID"), - first_name, - last_name, - summary, - status=status, - impact=impact, - urgency=urgency, - priority=priority, - details=details, - task_type=task_type, - support_company=support_company, - assignee=assignee, - location_company=company, - root_request_mode=root_request_mode, + parent_ticket = get_ticket(client, args.get("root_ticket_type"), root_request_id) # type: ignore[arg-type] + response = client.create_task_request( # type: ignore[arg-type,call-arg] + template_id, # type: ignore[arg-type] + parent_ticket.get("InstanceId"), # type: ignore[arg-type] + root_request_name or parent_ticket.get("DisplayID"), # type: ignore[arg-type] + parent_ticket.get("DisplayID"), # type: ignore[arg-type] + first_name, # type: ignore[arg-type] + last_name, # type: ignore[arg-type] + summary, # type: ignore[arg-type] + status=status, # type: ignore[arg-type] + impact=impact, # type: ignore[arg-type] + urgency=urgency, # type: ignore[arg-type] + priority=priority, # type: ignore[arg-type] + details=details, # type: ignore[arg-type] + task_type=task_type, # type: ignore[arg-type] + support_company=support_company, # type: ignore[arg-type] + assignee=assignee, # type: ignore[arg-type] + location_company=company, # type: ignore[arg-type] + root_request_mode=root_request_mode, # type: ignore[arg-type] root_ticket_type=root_ticket_type, - assigned_support_group_name=assigned_support_group_name, - assigned_support_organization=assigned_support_organization, - scedulded_start_date=scedulded_start_date.isoformat() if scedulded_start_date else None, - scedulded_end_date=scedulded_end_date.isoformat() if scedulded_end_date else None, + assigned_support_group_name=assigned_support_group_name, # type: ignore[arg-type] + assigned_support_organization=assigned_support_organization, # type: ignore[arg-type] + scedulded_start_date=scedulded_start_date.isoformat() if scedulded_start_date else None, # type: ignore[arg-type] + scedulded_end_date=scedulded_end_date.isoformat() if scedulded_end_date else None, # type: ignore[arg-type] **additional_fields, ) - outputs = format_create_ticket_outputs(response.get("values")) + outputs = format_create_ticket_outputs(response.get("values")) # type: ignore[arg-type] outputs["RequestID"] = outputs["DisplayID"] readable_output = tableToMarkdown("Task ticket successfully Created.", outputs, @@ -2281,32 +2280,32 @@ def task_update_command(client: Client, args: Dict[str, Any]) -> CommandResults: assigned_support_organization = args.get("assigned_support_organization") assigned_support_group_name = args.get("assigned_group") assignee = args.get("assignee") - scedulded_start_date: datetime = arg_to_datetime(args.get("scedulded_start_date")) - schedulded_end_date: datetime = arg_to_datetime(args.get("schedulded_end_date")) + scedulded_start_date: datetime = arg_to_datetime(args.get("scedulded_start_date")) # type: ignore[assignment] + schedulded_end_date: datetime = arg_to_datetime(args.get("schedulded_end_date")) # type: ignore[assignment] - additional_fields = extract_args_from_additional_fields_arg(args.get("additional_fields"), + additional_fields = extract_args_from_additional_fields_arg(args.get("additional_fields"), # type: ignore[arg-type] "additional_fields") - client.update_task_request( - format_ticket_request_id(task_id), - root_request_name, - summary=summary, - status=status, - priority=priority, - details=details, - task_type=task_type, + client.update_task_request( # type: ignore[arg-type,call-arg] + format_ticket_request_id(task_id), # type: ignore[arg-type] + root_request_name, # type: ignore[arg-type] + summary=summary, # type: ignore[arg-type] + status=status, # type: ignore[arg-type] + priority=priority, # type: ignore[arg-type] + details=details, # type: ignore[arg-type] + task_type=task_type, # type: ignore[arg-type] organization=organization, department=department, site_group=site_group, site=site, - assigned_support_company=support_company, - assignee=assignee, - company=company, - location_company=location_company, - status_reason=status_reason, - assigned_support_organization=assigned_support_organization, - assigned_support_group_name=assigned_support_group_name, - scedulded_start_date=scedulded_start_date.isoformat() if scedulded_start_date else None, - schedulded_end_date=schedulded_end_date.isoformat if schedulded_end_date else None, + assigned_support_company=support_company, # type: ignore[arg-type] + assignee=assignee, # type: ignore[arg-type] + company=company, # type: ignore[arg-type] + location_company=location_company, # type: ignore[arg-type] + status_reason=status_reason, # type: ignore[arg-type] + assigned_support_organization=assigned_support_organization, # type: ignore[arg-type] + assigned_support_group_name=assigned_support_group_name, # type: ignore[arg-type] + scedulded_start_date=scedulded_start_date.isoformat() if scedulded_start_date else None, # type: ignore[arg-type] + schedulded_end_date=schedulded_end_date.isoformat if schedulded_end_date else None, # type: ignore[arg-type] **additional_fields, ) @@ -2345,11 +2344,11 @@ def problem_investigation_create_command(client: Client, args: Dict[str, Any]) - support_organization_pbm_mgr = args.get("support_organization_pbm_mgr") assignee_pbm_mgr = args.get("assignee_pbm_mgr") temporary_workaround = args.get("temporary_workaround") - target_resolution_date: datetime = arg_to_datetime(args.get("target_resolution_date")) + target_resolution_date: datetime = arg_to_datetime(args.get("target_resolution_date")) # type: ignore[assignment] resolution = args.get("resolution") investigation_justification = args.get("investigation_justification") investigation_driver = args.get("investigation_driver") - additional_fields = extract_args_from_additional_fields_arg(args.get("additional_fields"), + additional_fields = extract_args_from_additional_fields_arg(args.get("additional_fields"), # type: ignore[arg-type] "additional_fields") validate_related_arguments_provided(company=company, @@ -2368,33 +2367,33 @@ def problem_investigation_create_command(client: Client, args: Dict[str, Any]) - support_organization_pbm_mgr=support_organization_pbm_mgr, ) - response = client.create_problem_investigation_request( + response = client.create_problem_investigation_request( # type: ignore[arg-type] PROBLEM_INVESTIGATION, - summary, + summary, # type: ignore[arg-type] first_name=first_name, last_name=last_name, - urgency=urgency, - impact=impact, - status=status, - details=details, - company=company, - assigned_support_organization=assigned_support_organization, - assigned_support_company=assigned_support_company, - assigned_support_group_name=assigned_support_group_name, - assignee=assignee, - site_group=site_group, - site=site, - region=region, - assigned_group_pbm_mgr=assigned_group_pbm_mgr, - support_company_pbm_mgr=support_company_pbm_mgr, - support_organization_pbm_mgr=support_organization_pbm_mgr, - temporary_workaround=temporary_workaround, - target_resolution_date=target_resolution_date.isoformat() + urgency=urgency, # type: ignore[arg-type] + impact=impact, # type: ignore[arg-type] + status=status, # type: ignore[arg-type] + details=details, # type: ignore[arg-type] + company=company, # type: ignore[arg-type] + assigned_support_organization=assigned_support_organization, # type: ignore[arg-type] + assigned_support_company=assigned_support_company, # type: ignore[arg-type] + assigned_support_group_name=assigned_support_group_name, # type: ignore[arg-type] + assignee=assignee, # type: ignore[arg-type] + site_group=site_group, # type: ignore[arg-type] + site=site, # type: ignore[arg-type] + region=region, # type: ignore[arg-type] + assigned_group_pbm_mgr=assigned_group_pbm_mgr, # type: ignore[arg-type] + support_company_pbm_mgr=support_company_pbm_mgr, # type: ignore[arg-type] + support_organization_pbm_mgr=support_organization_pbm_mgr, # type: ignore[arg-type] + temporary_workaround=temporary_workaround, # type: ignore[arg-type] + target_resolution_date=target_resolution_date.isoformat() # type: ignore[arg-type] if target_resolution_date else None, investigation_justification=investigation_justification, investigation_driver=investigation_driver, resolution=resolution, - assignee_pbm_mgr=assignee_pbm_mgr, + assignee_pbm_mgr=assignee_pbm_mgr, # type: ignore[arg-type] **additional_fields, ) @@ -2454,10 +2453,10 @@ def problem_investigation_update_command(client: Client, args: Dict[str, Any]) - assignee_pbm_mgr = args.get("assignee_pbm_mgr") temporary_workaround = args.get("temporary_workaround") resolution = args.get("resolution") - target_resolution_date: datetime = arg_to_datetime(args.get("target_resolution_date")) + target_resolution_date: datetime = arg_to_datetime(args.get("target_resolution_date")) # type: ignore[assignment] investigation_justification = args.get("investigation_justification") investigation_driver = args.get("investigation_driver") - additional_fields = extract_args_from_additional_fields_arg(args.get("additional_fields"), + additional_fields = extract_args_from_additional_fields_arg(args.get("additional_fields"), # type: ignore[arg-type] "additional_fields") validate_related_arguments_provided(company=company, @@ -2476,34 +2475,34 @@ def problem_investigation_update_command(client: Client, args: Dict[str, Any]) - support_organization_pbm_mgr=support_organization_pbm_mgr, ) - client.update_problem_investigation_request( - format_ticket_request_id(problem_investigation_id), - first_name, - last_name, - summary, - urgency=urgency, - impact=impact, - status=status, - status_reason=status_reason, - details=details, - company=company, - assigned_support_organization=assigned_support_organization, - assigned_support_company=assigned_support_company, - assigned_support_group_name=assigned_support_group_name, - assignee=assignee, - assignee_login_id=assignee_login_id, - site_group=site_group, - site=site, - region=region, - assigned_group_pbm_mgr=assigned_group_pbm_mgr, - support_company_pbm_mgr=support_company_pbm_mgr, - support_organization_pbm_mgr=support_organization_pbm_mgr, - temporary_workaround=temporary_workaround, - resolution=resolution, - target_resolution_date=target_resolution_date.isoformat() + client.update_problem_investigation_request( # type: ignore[arg-type,call-arg] + format_ticket_request_id(problem_investigation_id), # type: ignore[arg-type] + first_name, # type: ignore[arg-type] + last_name, # type: ignore[arg-type] + summary, # type: ignore[arg-type] + urgency=urgency, # type: ignore[arg-type] + impact=impact, # type: ignore[arg-type] + status=status, # type: ignore[arg-type] + status_reason=status_reason, # type: ignore[arg-type] + details=details, # type: ignore[arg-type] + company=company, # type: ignore[arg-type] + assigned_support_organization=assigned_support_organization, # type: ignore[arg-type] + assigned_support_company=assigned_support_company, # type: ignore[arg-type] + assigned_support_group_name=assigned_support_group_name, # type: ignore[arg-type] + assignee=assignee, # type: ignore[arg-type] + assignee_login_id=assignee_login_id, # type: ignore[arg-type] + site_group=site_group, # type: ignore[arg-type] + site=site, # type: ignore[arg-type] + region=region, # type: ignore[arg-type] + assigned_group_pbm_mgr=assigned_group_pbm_mgr, # type: ignore[arg-type] + support_company_pbm_mgr=support_company_pbm_mgr, # type: ignore[arg-type] + support_organization_pbm_mgr=support_organization_pbm_mgr, # type: ignore[arg-type] + temporary_workaround=temporary_workaround, # type: ignore[arg-type] + resolution=resolution, # type: ignore[arg-type] + target_resolution_date=target_resolution_date.isoformat() # type: ignore[arg-type] if target_resolution_date else None, - investigation_justification=investigation_justification, - investigation_driver=investigation_driver, + investigation_justification=investigation_justification, # type: ignore[arg-type] + investigation_driver=investigation_driver, # type: ignore[arg-type] assignee_pbm_mgr=assignee_pbm_mgr, **additional_fields, ) @@ -2541,9 +2540,9 @@ def known_error_create_command(client: Client, args: Dict[str, Any]) -> CommandR assignee_pbm_mgr = args.get("assignee_pbm_mgr") temporary_workaround = args.get("temporary_workaround") resolution = args.get("resolution") - target_resolution_date = arg_to_datetime(args.get("target_resolution_date")).isoformat() + target_resolution_date = arg_to_datetime(args.get("target_resolution_date")).isoformat() # type: ignore[union-attr] view_access = args.get("view_access") - additional_fields = extract_args_from_additional_fields_arg(args.get("additional_fields"), + additional_fields = extract_args_from_additional_fields_arg(args.get("additional_fields"), # type: ignore[arg-type] "additional_fields") validate_related_arguments_provided( @@ -2557,29 +2556,29 @@ def known_error_create_command(client: Client, args: Dict[str, Any]) -> CommandR support_company_pbm_mgr=support_company_pbm_mgr, support_organization_pbm_mgr=support_organization_pbm_mgr, ) - response = client.create_problem_investigation_request( + response = client.create_problem_investigation_request( # type: ignore[arg-type] KNOWN_ERROR, - summary, - urgency=urgency, - impact=impact, - status=status, - details=details, - company=company, - assigned_support_organization=assigned_support_organization, - assigned_support_company=assigned_support_company, - assigned_support_group_name=assigned_support_group_name, - assignee=assignee, - site_group=site_group, - site=site, - region=region, - assigned_group_pbm_mgr=assigned_group_pbm_mgr, - support_company_pbm_mgr=support_company_pbm_mgr, - support_organization_pbm_mgr=support_organization_pbm_mgr, - temporary_workaround=temporary_workaround, + summary, # type: ignore[arg-type] + urgency=urgency, # type: ignore[arg-type] + impact=impact, # type: ignore[arg-type] + status=status, # type: ignore[arg-type] + details=details, # type: ignore[arg-type] + company=company, # type: ignore[arg-type] + assigned_support_organization=assigned_support_organization, # type: ignore[arg-type] + assigned_support_company=assigned_support_company, # type: ignore[arg-type] + assigned_support_group_name=assigned_support_group_name, # type: ignore[arg-type] + assignee=assignee, # type: ignore[arg-type] + site_group=site_group, # type: ignore[arg-type] + site=site, # type: ignore[arg-type] + region=region, # type: ignore[arg-type] + assigned_group_pbm_mgr=assigned_group_pbm_mgr, # type: ignore[arg-type] + support_company_pbm_mgr=support_company_pbm_mgr, # type: ignore[arg-type] + support_organization_pbm_mgr=support_organization_pbm_mgr, # type: ignore[arg-type] + temporary_workaround=temporary_workaround, # type: ignore[arg-type] resolution=resolution, target_resolution_date=target_resolution_date, view_access=view_access, - assignee_pbm_mgr=assignee_pbm_mgr, + assignee_pbm_mgr=assignee_pbm_mgr, # type: ignore[arg-type] **additional_fields, ) @@ -2635,8 +2634,8 @@ def known_error_update_command(client: Client, args: Dict[str, Any]) -> CommandR target_resolution_date = arg_to_datetime(args.get("target_resolution_date")) view_access = args.get("view_access") - target_resolution_date: datetime = arg_to_datetime(args.get("target_resolution_date")) - additional_fields = extract_args_from_additional_fields_arg(args.get("additional_fields"), + target_resolution_date: datetime = arg_to_datetime(args.get("target_resolution_date")) # type: ignore[no-redef] + additional_fields = extract_args_from_additional_fields_arg(args.get("additional_fields"), # type: ignore[arg-type] "additional_fields") validate_related_arguments_provided( @@ -2653,27 +2652,27 @@ def known_error_update_command(client: Client, args: Dict[str, Any]) -> CommandR validate_related_arguments_provided(status=status, status_reason=status_reason) - client.update_known_error_request( - format_ticket_request_id(known_error_id), - summary, - urgency=urgency, - impact=impact, - status=status, - details=details, - assigned_support_organization=assigned_support_organization, - assigned_support_company=assigned_support_company, - assigned_support_group_name=assigned_support_group_name, - assignee=assignee, - assigned_group_pbm_mgr=assigned_group_pbm_mgr, - support_company_pbm_mgr=support_company_pbm_mgr, - support_organization_pbm_mgr=support_organization_pbm_mgr, - target_resolution_date=target_resolution_date.isoformat() + client.update_known_error_request( # type: ignore[arg-type,call-arg] + format_ticket_request_id(known_error_id), # type: ignore[arg-type] + summary, # type: ignore[arg-type] + urgency=urgency, # type: ignore[arg-type] + impact=impact, # type: ignore[arg-type] + status=status, # type: ignore[arg-type] + details=details, # type: ignore[arg-type] + assigned_support_organization=assigned_support_organization, # type: ignore[arg-type] + assigned_support_company=assigned_support_company, # type: ignore[arg-type] + assigned_support_group_name=assigned_support_group_name, # type: ignore[arg-type] + assignee=assignee, # type: ignore[arg-type] + assigned_group_pbm_mgr=assigned_group_pbm_mgr, # type: ignore[arg-type] + support_company_pbm_mgr=support_company_pbm_mgr, # type: ignore[arg-type] + support_organization_pbm_mgr=support_organization_pbm_mgr, # type: ignore[arg-type] + target_resolution_date=target_resolution_date.isoformat() # type: ignore[arg-type] if target_resolution_date else None, - status_reason=status_reason, - assignee_pbm_mgr=assignee_pbm_mgr, - temporary_workaround=temporary_workaround, - resolution=resolution, - view_access=view_access, + status_reason=status_reason, # type: ignore[arg-type] + assignee_pbm_mgr=assignee_pbm_mgr, # type: ignore[arg-type] + temporary_workaround=temporary_workaround, # type: ignore[arg-type] + resolution=resolution, # type: ignore[arg-type] + view_access=view_access, # type: ignore[arg-type] **additional_fields, ) @@ -2767,31 +2766,31 @@ def work_order_create_command(client: Client, args: Dict[str, Any]) -> CommandRe priority = args.get("priority") work_order_type = args.get("work_order_type") location_company = args.get("location_company") - scedulded_start_date: datetime = arg_to_datetime(args.get("scedulded_start_date")) - scedulded_end_date: datetime = arg_to_datetime(args.get("scedulded_end_date")) + scedulded_start_date: datetime = arg_to_datetime(args.get("scedulded_start_date")) # type: ignore[assignment] + scedulded_end_date: datetime = arg_to_datetime(args.get("scedulded_end_date")) # type: ignore[assignment] - additional_fields = extract_args_from_additional_fields_arg(args.get("additional_fields"), + additional_fields = extract_args_from_additional_fields_arg(args.get("additional_fields"), # type: ignore[arg-type] "additional_fields") - response = client.create_work_order_request( - template_guid, - first_name, - last_name, - customer_person_id, - customer_first_name, - customer_last_name, - customer_company, - summary, - detailed_description, - status, - priority, - work_order_type, - location_company, - scedulded_start_date=scedulded_start_date.isoformat() if scedulded_start_date else None, - scedulded_end_date=scedulded_end_date.isoformat() if scedulded_end_date else None, + response = client.create_work_order_request( # type: ignore[arg-type,call-arg] + template_guid, # type: ignore[arg-type] + first_name, # type: ignore[arg-type] + last_name, # type: ignore[arg-type] + customer_person_id, # type: ignore[arg-type] + customer_first_name, # type: ignore[arg-type] + customer_last_name, # type: ignore[arg-type] + customer_company, # type: ignore[arg-type] + summary, # type: ignore[arg-type] + detailed_description, # type: ignore[arg-type] + status, # type: ignore[arg-type] + priority, # type: ignore[arg-type] + work_order_type, # type: ignore[arg-type] + location_company, # type: ignore[arg-type] + scedulded_start_date=scedulded_start_date.isoformat() if scedulded_start_date else None, # type: ignore[arg-type] + scedulded_end_date=scedulded_end_date.isoformat() if scedulded_end_date else None, # type: ignore[arg-type] **additional_fields, ) - outputs = format_create_ticket_outputs(response.get("values")) + outputs = format_create_ticket_outputs(response.get("values")) # type: ignore[arg-type] # Fixing API returning RequestID in form 000...NNN instead of WO0...NNN outputs["RequestID"] = "WO0" + outputs["RequestID"][3:] readable_output = tableToMarkdown("Work order ticket successfully created.", @@ -2832,29 +2831,29 @@ def work_order_update_command(client: Client, args: Dict[str, Any]) -> CommandRe support_organization = args.get("support_organization") support_group = args.get("support_group") location_company = args.get("location_company") - scedulded_start_date: datetime = arg_to_datetime(args.get("scedulded_start_date")) - schedulded_end_date: datetime = arg_to_datetime(args.get("schedulded_end_date")) + scedulded_start_date: datetime = arg_to_datetime(args.get("scedulded_start_date")) # type: ignore[assignment] + schedulded_end_date: datetime = arg_to_datetime(args.get("schedulded_end_date")) # type: ignore[assignment] - additional_fields = extract_args_from_additional_fields_arg(args.get("additional_fields"), + additional_fields = extract_args_from_additional_fields_arg(args.get("additional_fields"), # type: ignore[arg-type] "additional_fields") validate_related_arguments_provided(support_organization=support_organization, support_group=support_group) - client.update_work_order_request( - request_id, - summary=summary, - detailed_description=detailed_description, - status=status, - status_reason=status_reason, - priority=priority, - work_order_type=work_order_type, - company=company, - assignee=assignee, - support_organization=support_organization, - support_group_name=support_group, - location_company=location_company, - scedulded_start_date=scedulded_start_date.isoformat() if scedulded_start_date else None, - schedulded_end_date=schedulded_end_date.isoformat if schedulded_end_date else None, + client.update_work_order_request( # type: ignore[arg-type,call-arg] + request_id, # type: ignore[arg-type] + summary=summary, # type: ignore[arg-type] + detailed_description=detailed_description, # type: ignore[arg-type] + status=status, # type: ignore[arg-type] + status_reason=status_reason, # type: ignore[arg-type] + priority=priority, # type: ignore[arg-type] + work_order_type=work_order_type, # type: ignore[arg-type] + company=company, # type: ignore[arg-type] + assignee=assignee, # type: ignore[arg-type] + support_organization=support_organization, # type: ignore[arg-type] + support_group_name=support_group, # type: ignore[arg-type] + location_company=location_company, # type: ignore[arg-type] + scedulded_start_date=scedulded_start_date.isoformat() if scedulded_start_date else None, # type: ignore[arg-type] + schedulded_end_date=schedulded_end_date.isoformat if schedulded_end_date else None, # type: ignore[arg-type] **additional_fields, ) @@ -2886,26 +2885,26 @@ def format_command_output(records: List[dict], record_attributes = record.get("values") for origin_attrib_name, formatted_attrib_name in mapper.items(): - if origin_attrib_name in record_attributes: + if origin_attrib_name in record_attributes: # type: ignore[operator] if formatted_attrib_name in ( "RequestID", "ID", ): # extract request ID out of pattern: -> id formatted_record[formatted_attrib_name] = extract_ticket_request_id( - record_attributes[origin_attrib_name]) + record_attributes[origin_attrib_name]) # type: ignore[index] - elif ("Date" in formatted_attrib_name and record_attributes[origin_attrib_name]): + elif ("Date" in formatted_attrib_name and record_attributes[origin_attrib_name]): # type: ignore[index] formatted_record[formatted_attrib_name] = FormatIso8601( - arg_to_datetime(record_attributes[origin_attrib_name])) + arg_to_datetime(record_attributes[origin_attrib_name])) # type: ignore[index] else: - formatted_record[formatted_attrib_name] = record_attributes[origin_attrib_name] + formatted_record[formatted_attrib_name] = record_attributes[origin_attrib_name] # type: ignore[index] if context_data_arranger: context_data_arranger(formatted_record) outputs.append(formatted_record) - return outputs + return outputs # type: ignore[return-value] def get_paginated_records_with_hr( @@ -2937,7 +2936,7 @@ def get_paginated_records_with_hr( header = (f"Showing page {page} out of {total_pages} total pages." f" Current page size: {page_size}.") else: - relevant_raw_data = raw_data[:min(rows_count, limit)] + relevant_raw_data = raw_data[:min(rows_count, limit)] # type: ignore[type-var] header = f"Showing {len(relevant_raw_data)} records out of {rows_count}." return relevant_raw_data, header if relevant_raw_data else "" @@ -3011,7 +3010,7 @@ def extract_args_from_additional_fields_arg(additional_fields: str, formatted_additional_fields = {} if not additional_fields: - return {} + return {} # type: ignore[return-value] try: fields = additional_fields.split(FIELD_DELIMITER) for each_field in fields: @@ -3022,7 +3021,7 @@ def extract_args_from_additional_fields_arg(additional_fields: str, raise ValueError( f'Please validate the format of the argument: {field_name}. For example: "fieldname1=value;fieldname2=value". ' ) from error - return formatted_additional_fields + return formatted_additional_fields # type: ignore[return-value] def arrange_ticket_context_data(ticket: Dict[str, Any]) -> Dict[str, Any]: @@ -3162,8 +3161,8 @@ def generate_query_filter_mapper_by_args(args: Dict[str, Any], record_id_key: Op """ ids_filter_mapper = {record_id_key: args.get("ids")} - status_key = TICKET_TYPE_TO_STATUS_FIELD.get(ticket_type, "Status") - summary = TICKET_TYPE_TO_SUMMARY_KEY.get(ticket_type, "Summary") + status_key = TICKET_TYPE_TO_STATUS_FIELD.get(ticket_type, "Status") # type: ignore[arg-type] + summary = TICKET_TYPE_TO_SUMMARY_KEY.get(ticket_type, "Summary") # type: ignore[arg-type] equal_filter_mapper = { status_key: args.get("status"), "Impact": args.get("impact"), @@ -3210,7 +3209,7 @@ def generate_query_with_filtering(custom_query: str, filter_mapper: Dict[str, An records_id_name = next(iter(ids_filter), None) records_ids = ids_filter.get(records_id_name) or [] - ids_query = gen_single_filters_statement(records_id_name, records_ids, "=", " OR ") + ids_query = gen_single_filters_statement(records_id_name, records_ids, "=", " OR ") # type: ignore[arg-type] equal_oper_filter_query = gen_multi_filters_statement(equal_oper_filters, "=", " AND ") @@ -3389,8 +3388,8 @@ def fetch_relevant_tickets_by_ticket_type( ) response = client.list_request(ticket_form, fetch_query) - relevant_records, _ = get_paginated_records_with_hr(response.get("entries"), max_fetch) - outputs: List[dict] = format_command_output( + relevant_records, _ = get_paginated_records_with_hr(response.get("entries"), max_fetch) # type: ignore[arg-type] + outputs: List[dict] = format_command_output( # type: ignore[assignment] deepcopy(relevant_records), generate_ticket_context_data_mapper(ticket_type), arrange_ticket_context_data, @@ -3655,7 +3654,7 @@ def get_ticket(client: Client, if not outputs: raise ValueError( f"The ticket type: {ticket_type} with request ID: {root_request_id} does not exist.") - return next(iter(outputs)) + return next(iter(outputs)) # type: ignore[call-overload] def get_remote_data_command(client: Client, args: Dict[str, Any], @@ -3708,7 +3707,7 @@ def get_modified_remote_data(client: Client, args: Dict[str, Any]) -> GetModifie last_update_utc = date_to_epoch_for_fetch( arg_to_datetime(last_update)) # converts to a UTC timestamp - modified_tickets = [] + modified_tickets = [] # type: ignore[var-annotated] modified_ticket_ids = [] for ticket_type in ALL_TICKETS: @@ -3722,7 +3721,7 @@ def get_modified_remote_data(client: Client, args: Dict[str, Any]) -> GetModifie }, ).outputs if modified_tickets_by_type: - modified_tickets += modified_tickets_by_type + modified_tickets += modified_tickets_by_type # type: ignore[arg-type] for raw_ticket in modified_tickets: ticket_id = raw_ticket.get("RequestID") @@ -3829,8 +3828,8 @@ def get_mapping_fields_command() -> GetMappingFieldsResponse: mapping_response = GetMappingFieldsResponse() for ticket_type, incident_type in TICKET_TYPE_TO_INCIDENT_TYPE.items(): incident_type_scheme = SchemeTypeMapping(type_name=incident_type) - outgoing_fields = MIRRORING_COMMON_FIELDS + TICKET_TYPE_TO_ADDITIONAL_MIRRORING_FIELDS[ - ticket_type] + outgoing_fields = MIRRORING_COMMON_FIELDS + \ + TICKET_TYPE_TO_ADDITIONAL_MIRRORING_FIELDS[ticket_type] # type: ignore[union-attr,operator] for field in outgoing_fields: incident_type_scheme.add_field(field) @@ -3883,8 +3882,8 @@ def main() -> None: verify_certificate: bool = not params.get("insecure", False) proxy = params.get("proxy", False) credentials = params.get("credentials") - username = credentials.get("identifier") - password = credentials.get("password") + username = credentials.get("identifier") # type: ignore[union-attr] + password = credentials.get("password") # type: ignore[union-attr] max_fetch = arg_to_number(params.get("max_fetch", DEFAULT_MAX_FETCH)) first_fetch = params.get("first_fetch") @@ -3893,7 +3892,7 @@ def main() -> None: ticket_impacts = argToList(params.get("ticket_impact")) ticket_urgencies = argToList(params.get("ticket_urgency")) ticket_custom_query = params.get("query") - mirror_direction = MIRROR_DIRECTION_MAPPING[params.get("mirror_direction")] + mirror_direction = MIRROR_DIRECTION_MAPPING[params.get("mirror_direction")] # type: ignore[index] close_incident = params.get("close_incident") close_ticket = params.get("close_ticket") @@ -3905,8 +3904,8 @@ def main() -> None: demisto.debug(f"Command being called is {command}") try: - requests.packages.urllib3.disable_warnings() - client: Client = Client(url, username, password, verify=verify_certificate, proxy=proxy) + requests.packages.urllib3.disable_warnings() # type: ignore[attr-defined] + client: Client = Client(url, username, password, verify=verify_certificate, proxy=proxy) # type: ignore[arg-type] commands = { "bmc-itsm-ticket-list": ticket_list_command, @@ -3940,25 +3939,25 @@ def main() -> None: elif command == "fetch-incidents": incidents, last_run = fetch_incidents( client, - max_fetch, - first_fetch, + max_fetch, # type: ignore[arg-type] + first_fetch, # type: ignore[arg-type] demisto.getLastRun(), ticket_type_filter, ticket_status_filter, ticket_impact_filter, ticket_urgency_filter, - ticket_custom_query, - mirror_direction, + ticket_custom_query, # type: ignore[arg-type] + mirror_direction, # type: ignore[arg-type] ) demisto.setLastRun(last_run) demisto.incidents(incidents) elif command == "get-remote-data": - return_results(get_remote_data_command(client, args, close_incident)) + return_results(get_remote_data_command(client, args, close_incident)) # type: ignore[arg-type] elif command == "get-modified-remote-data": return_results(get_modified_remote_data(client, args)) elif command == "update-remote-system": - return_results(update_remote_system(client, args, close_ticket)) + return_results(update_remote_system(client, args, close_ticket)) # type: ignore[arg-type] elif command == "get-mapping-fields": return_results(get_mapping_fields_command()) elif command in commands: diff --git a/Packs/BmcITSM/ReleaseNotes/1_0_24.md b/Packs/BmcITSM/ReleaseNotes/1_0_24.md new file mode 100644 index 00000000000..34cb12f1f05 --- /dev/null +++ b/Packs/BmcITSM/ReleaseNotes/1_0_24.md @@ -0,0 +1,6 @@ + +#### Integrations + +##### BMC Helix ITSM + +- Maintenance and stability enhancements. diff --git a/Packs/BmcITSM/pack_metadata.json b/Packs/BmcITSM/pack_metadata.json index 66cfdbd1955..d4c7bae1259 100644 --- a/Packs/BmcITSM/pack_metadata.json +++ b/Packs/BmcITSM/pack_metadata.json @@ -2,7 +2,7 @@ "name": "BMC Helix ITSM", "description": "BMC Helix ITSM allows customers to manage service request, incident, change request, task, problem investigation, known error and work order tickets.", "support": "xsoar", - "currentVersion": "1.0.23", + "currentVersion": "1.0.24", "author": "Cortex XSOAR", "url": "https://www.paloaltonetworks.com/cortex", "email": "", diff --git a/Packs/CheckPointDome9/Integrations/CheckPointDome9/CheckPointDome9.py b/Packs/CheckPointDome9/Integrations/CheckPointDome9/CheckPointDome9.py index bc4d118a4a4..328ed9982e2 100644 --- a/Packs/CheckPointDome9/Integrations/CheckPointDome9/CheckPointDome9.py +++ b/Packs/CheckPointDome9/Integrations/CheckPointDome9/CheckPointDome9.py @@ -1,8 +1,7 @@ import demistomock as demisto # noqa: F401 from CommonServerPython import * # noqa: F401 -# type: ignore -# mypy: ignore-errors -from typing import Any, Dict, Tuple + +from typing import Any TIME_FORMAT = '%Y-%m-%dT%H:%M:%S.%fZ' @@ -15,7 +14,7 @@ def __init__(self, base_url: str, key_id: str, key_secret: str, proxy: bool, ver auth = (key_id, key_secret) super().__init__(base_url=base_url, auth=auth, verify=verify, headers=headers, proxy=proxy) - def access_lease_list_request(self) -> Dict[str, Any]: + def access_lease_list_request(self) -> dict[str, Any]: """ Get Access lease list. Returns: @@ -34,13 +33,13 @@ def access_lease_delete_request(self, lease_id: str) -> str: """ return self._http_request('DELETE', f'AccessLease/{lease_id}', resp_type='text') - def access_lease_invitation_list_request(self, invitation_id: str = None) -> Dict[str, Any]: + def access_lease_invitation_list_request(self, invitation_id: str = None) -> dict[str, Any]: """ Get Access lease invitation list. Returns: Dict[str, Any]: API response from Dome9. """ - url_prefix = create_url_prefix(invitation_id) + url_prefix = create_url_prefix(invitation_id) # type: ignore[arg-type] response = self._http_request('GET', f'AccessLeaseInvitation{url_prefix}') @@ -64,7 +63,7 @@ def findings_search_request(self, alert_severity: List[str] = None, alert_region: List[str] = None, alert_entity_type: List[str] = None, - alert_acknowledged: bool = None) -> Dict[str, Any]: + alert_acknowledged: bool = None) -> dict[str, Any]: """ Search findings. Filter findings by account, region, VPC, IP, or instance name. @@ -82,7 +81,7 @@ def findings_search_request(self, fields.append({"name": "entityTypeByEnvironmentType", "value": entity_type}) if alert_acknowledged: - fields.append({"name": "acknowledged", "value": alert_acknowledged}) + fields.append({"name": "acknowledged", "value": alert_acknowledged}) # type: ignore[dict-item] data = { "pageSize": max_fetch, @@ -101,7 +100,7 @@ def findings_search_request(self, def ip_list_create_request(self, name: str, description: str, - items: List[Dict[str, Any]] = None) -> Dict[str, Any]: + items: List[dict[str, Any]] = None) -> dict[str, Any]: """ Create a new IP list. Args: @@ -119,7 +118,7 @@ def ip_list_create_request(self, def ip_list_update_request(self, list_id: str, description: str, - items: List[Dict[str, Any]] = None) -> str: + items: List[dict[str, Any]] = None) -> str: """ Update exist IP list. Args: @@ -134,7 +133,7 @@ def ip_list_update_request(self, response = self._http_request('PUT', f'IpList/{list_id}', json_data=data, resp_type='text') return response - def ip_list_get_request(self, list_id: str) -> Dict[str, Any]: + def ip_list_get_request(self, list_id: str) -> dict[str, Any]: """ Get an IP List by ID. Args: @@ -159,7 +158,7 @@ def ip_list_delete_request(self, list_id: str) -> str: return self._http_request('DELETE', f'IpList/{list_id}', resp_type='text') - def ip_list_metadata_list_request(self) -> Dict[str, Any]: + def ip_list_metadata_list_request(self) -> dict[str, Any]: """ Get all IP addresses metadata. Returns: @@ -172,7 +171,7 @@ def ip_list_metadata_create_request( cidr: str, name: str, classification: str, - ) -> Dict[str, Any]: + ) -> dict[str, Any]: """ Add a new IP address metadata. An Ip Address metadata must contain CIDR, Name and Classification. Classification can be External or Unsafe or Dmz or InternalVpc or InternalDc or NoClassification. @@ -195,7 +194,7 @@ def ip_list_metadata_update_request( list_id: str, classification: str, name: str, - ) -> Dict[str, Any]: + ) -> dict[str, Any]: """ Update an existing IP address metadata. Classification can only be External or Unsafe or Dmz or InternalVpc or InternalDc or NoClassification. @@ -237,7 +236,7 @@ def ip_list_metadata_delete_request( return response - def compliance_remediation_get_request(self) -> Dict[str, Any]: + def compliance_remediation_get_request(self) -> dict[str, Any]: """ Get a list of remediation for the account. Returns: @@ -247,7 +246,7 @@ def compliance_remediation_get_request(self) -> Dict[str, Any]: return self._http_request('GET', 'ComplianceRemediation') def compliance_remediation_create_request(self, ruleset_id: str, rule_logic_hash: str, - comment: str, cloudbots: list) -> Dict[str, Any]: + comment: str, cloudbots: list) -> dict[str, Any]: """ Add a new remediation. Args: @@ -275,7 +274,7 @@ def compliance_remediation_update_request( rule_logic_hash: str, comment: str, cloudbots: list, - ) -> Dict[str, Any]: + ) -> dict[str, Any]: """ Update a remediation. Args: @@ -313,7 +312,7 @@ def compliance_remediation_delete_request(self, remediation_id: str) -> str: f'ComplianceRemediation/{remediation_id}', resp_type='text') - def compliance_ruleset_list_request(self) -> Dict[str, Any]: + def compliance_ruleset_list_request(self) -> dict[str, Any]: """ Get all rulesets for the account. Returns: @@ -321,7 +320,7 @@ def compliance_ruleset_list_request(self) -> Dict[str, Any]: """ return self._http_request('GET', 'Compliance/Ruleset/view') - def compliance_ruleset_rule_list_request(self, rule_id: int) -> Dict[str, Any]: + def compliance_ruleset_rule_list_request(self, rule_id: int) -> dict[str, Any]: """ Get rule details (get rule logic hash). Args: @@ -337,7 +336,7 @@ def security_group_attach_request( instance_id: str, sg_id: str, nic_name: str, - ) -> Dict[str, Any]: + ) -> dict[str, Any]: """ Attach security Group to an AWS EC2 Instance. Args: @@ -356,7 +355,7 @@ def security_group_attach_request( return response - def instance_list_request(self, instance_id: str) -> Dict[str, Any]: + def instance_list_request(self, instance_id: str) -> dict[str, Any]: """ Get an AWS EC2 Instances list. Args: @@ -387,7 +386,7 @@ def security_group_service_delete_request(self, sg_id: str, service_id: str) -> return response def security_group_tags_update_request(self, sg_id: str, key: str, - value: str) -> Dict[str, Any]: + value: str) -> dict[str, Any]: """ Create and Update a security group tag. Args: @@ -420,7 +419,7 @@ def security_group_service_create_request( inbound: bool = None, icmptype: str = None, icmpv6type: str = None, - ) -> Dict[str, Any]: + ) -> dict[str, Any]: """ Create new security group service. Args: @@ -488,7 +487,7 @@ def security_group_service_update_request( inbound: bool = None, icmptype: str = None, icmpv6type: str = None, - ) -> Dict[str, Any]: + ) -> dict[str, Any]: """ Update security group service. Args: @@ -548,7 +547,7 @@ def security_group_instance_detach_request( instance_id: str, sg_id: str, nic_name: str, - ) -> Dict[str, Any]: + ) -> dict[str, Any]: """ Detach security Group from an AWS EC2 Instance. Args: @@ -567,7 +566,7 @@ def security_group_instance_detach_request( return response - def protection_mode_update_request(self, sg_id: str, protection_mode: str) -> Dict[str, Any]: + def protection_mode_update_request(self, sg_id: str, protection_mode: str) -> dict[str, Any]: """ Change the protection mode for an AWS security group (FullManage or ReadOnly). Args: @@ -585,30 +584,30 @@ def protection_mode_update_request(self, sg_id: str, protection_mode: str) -> Di return response - def cloud_accounts_list_request(self, account_id: str = None) -> Dict[str, Any]: + def cloud_accounts_list_request(self, account_id: str = None) -> dict[str, Any]: """ Get cloud accounts list. Returns: Dict[str, Any]: API response from Dome9. """ - url_prefix = create_url_prefix(account_id) + url_prefix = create_url_prefix(account_id) # type: ignore[arg-type] response = self._http_request('GET', f'CloudAccounts{url_prefix}') return response - def check_ip_list_security_group_attach_request(self, sg_id: str = None) -> Dict[str, Any]: + def check_ip_list_security_group_attach_request(self, sg_id: str = None) -> dict[str, Any]: """ Get AWS cloud accounts for a specific security group and region and check if there is an IP-list that attach to a security group. Returns: Dict[str, Any]: API response from Dome9. """ - url_prefix = create_url_prefix(sg_id) + url_prefix = create_url_prefix(sg_id) # type: ignore[arg-type] response = self._http_request('GET', f'CloudSecurityGroup{url_prefix}') return response - def security_group_list_request(self) -> Dict[str, Any]: + def security_group_list_request(self) -> dict[str, Any]: """ Get security group list. Returns: @@ -618,7 +617,7 @@ def security_group_list_request(self) -> Dict[str, Any]: return response - def global_search_get_request(self) -> Dict[str, Any]: + def global_search_get_request(self) -> dict[str, Any]: """ Get top results for each service. Returns: @@ -629,7 +628,7 @@ def global_search_get_request(self) -> Dict[str, Any]: return response - def cloud_trail_get_request(self) -> Dict[str, Any]: + def cloud_trail_get_request(self) -> dict[str, Any]: """ Get Cloud Trail events for a Dome9 user. Returns: @@ -639,7 +638,7 @@ def cloud_trail_get_request(self) -> Dict[str, Any]: return response - def findings_bundle_get_request(self, bundle_id: str, rule_logic_hash: str) -> Dict[str, Any]: + def findings_bundle_get_request(self, bundle_id: str, rule_logic_hash: str) -> dict[str, Any]: """ Get the findings for a specific rule in a bundle, for all of the user's accounts. Args: @@ -655,7 +654,7 @@ def findings_bundle_get_request(self, bundle_id: str, rule_logic_hash: str) -> D params=params) return response - def finding_get_request(self, finding_id: str) -> Dict[str, Any]: + def finding_get_request(self, finding_id: str) -> dict[str, Any]: """ Get a findings by its ID. Args: @@ -667,7 +666,7 @@ def finding_get_request(self, finding_id: str) -> Dict[str, Any]: response = self._http_request('GET', f'Compliance/Finding/{finding_id}') return response - def organizational_unit_view_get_request(self) -> Dict[str, Any]: + def organizational_unit_view_get_request(self) -> dict[str, Any]: """ Get organizational unit view entities. Returns: @@ -676,7 +675,7 @@ def organizational_unit_view_get_request(self) -> Dict[str, Any]: response = self._http_request('GET', 'organizationalunit/view') return response - def organizational_unit_flat_get_request(self) -> Dict[str, Any]: + def organizational_unit_flat_get_request(self) -> dict[str, Any]: """ Get all organizational units flat. Returns: @@ -685,7 +684,7 @@ def organizational_unit_flat_get_request(self) -> Dict[str, Any]: response = self._http_request('GET', 'organizationalunit/GetFlatOrganizationalUnits') return response - def organizational_unit_get_request(self, unit_id: str) -> Dict[str, Any]: + def organizational_unit_get_request(self, unit_id: str) -> dict[str, Any]: """ Get an organizational unit by its ID. Args: @@ -741,20 +740,17 @@ def validate_pagination_arguments(page: int = None, page_size: int = None, limit Raises: ValueError: Appropriate error message. """ - if page_size: - if page_size < 1 or page_size > 50: - raise ValueError('page size argument must be greater than 1 and smaller than 50.') + if page_size and (page_size < 1 or page_size > 50): + raise ValueError('page size argument must be greater than 1 and smaller than 50.') - if page: - if page < 1: - raise ValueError('page argument must be greater than 0.') + if page and page < 1: + raise ValueError('page argument must be greater than 0.') - if limit: - if limit < 1 or limit > 50: - raise ValueError('limit argument must be greater than 1.') + if limit and (limit < 1 or limit > 50): + raise ValueError('limit argument must be greater than 1.') -def pagination(response: dict, args: Dict[str, Any]) -> Tuple: +def pagination(response: dict, args: dict[str, Any]) -> tuple: """ Executing Manual Pagination (using the page and page size arguments) or Automatic Pagination (display a number of total results). @@ -771,7 +767,7 @@ def pagination(response: dict, args: Dict[str, Any]) -> Tuple: page_size = arg_to_number(args.get('page_size')) limit = arg_to_number(args.get('limit')) - validate_pagination_arguments(page, page_size, limit) + validate_pagination_arguments(page, page_size, limit) # type: ignore[arg-type] output = response @@ -814,10 +810,10 @@ def get_service_type_and_data(service: list) -> list: if service: service_scope = service[0]['scope'] if service_scope: - service_type = service_scope[0]['type'] - service_data = service_scope[0]['data'] + service_type = service_scope[0]['type'] # type: ignore[index] + service_data = service_scope[0]['data'] # type: ignore[index] - return service_type, service_data + return service_type, service_data # type: ignore[return-value] def create_url_prefix(path_variable: str) -> str: @@ -870,7 +866,7 @@ def create_sg_list(fix_output: list) -> list: return security_group_list -def access_lease_list_command(client: Client, args: Dict[str, Any]) -> CommandResults: +def access_lease_list_command(client: Client, args: dict[str, Any]) -> CommandResults: """ Get a access lease list. Args: @@ -901,7 +897,7 @@ def access_lease_list_command(client: Client, args: Dict[str, Any]) -> CommandRe return command_results -def access_lease_delete_command(client: Client, args: Dict[str, Any]) -> CommandResults: +def access_lease_delete_command(client: Client, args: dict[str, Any]) -> CommandResults: """ Delete access lease by ID. Args: @@ -912,7 +908,7 @@ def access_lease_delete_command(client: Client, args: Dict[str, Any]) -> Command CommandResults: outputs, readable outputs and raw response for XSOAR. """ lease_id = args.get('lease_id') - response = client.access_lease_delete_request(lease_id) + response = client.access_lease_delete_request(lease_id) # type: ignore[arg-type] command_results = CommandResults(readable_output="Access Lease Deleted successfully", outputs_prefix='CheckPointDome9.AccessLease', outputs_key_field='', @@ -922,7 +918,7 @@ def access_lease_delete_command(client: Client, args: Dict[str, Any]) -> Command return command_results -def access_lease_invitation_list_command(client: Client, args: Dict[str, Any]) -> CommandResults: +def access_lease_invitation_list_command(client: Client, args: dict[str, Any]) -> CommandResults: """ Get a specific lease invitation. Args: @@ -933,7 +929,7 @@ def access_lease_invitation_list_command(client: Client, args: Dict[str, Any]) - CommandResults: outputs, readable outputs and raw response for XSOAR. """ invitation_id = args.get('invitation_id') - response = client.access_lease_invitation_list_request(invitation_id) + response = client.access_lease_invitation_list_request(invitation_id) # type: ignore[arg-type] fix_output, pagination_message = pagination(response, args) readable_output = tableToMarkdown( @@ -952,7 +948,7 @@ def access_lease_invitation_list_command(client: Client, args: Dict[str, Any]) - return command_results -def access_lease_invitation_delete_command(client: Client, args: Dict[str, Any]) -> CommandResults: +def access_lease_invitation_delete_command(client: Client, args: dict[str, Any]) -> CommandResults: """ Delete a lease invitation. Args: @@ -963,7 +959,7 @@ def access_lease_invitation_delete_command(client: Client, args: Dict[str, Any]) CommandResults: outputs, readable outputs and raw response for XSOAR. """ invitation_id = args.get('invitation_id') - response = client.access_lease_invitation_delete_request(invitation_id) + response = client.access_lease_invitation_delete_request(invitation_id) # type: ignore[arg-type] command_results = CommandResults(readable_output="Access Lease Invitation Deleted successfully", outputs_prefix='CheckPointDome9.AccessLease.Invitation', outputs_key_field='', @@ -973,7 +969,7 @@ def access_lease_invitation_delete_command(client: Client, args: Dict[str, Any]) return command_results -def findings_search_command(client: Client, args: Dict[str, Any]) -> CommandResults: +def findings_search_command(client: Client, args: dict[str, Any]) -> CommandResults: """ Search findings for the account. Args: @@ -984,13 +980,13 @@ def findings_search_command(client: Client, args: Dict[str, Any]) -> CommandResu CommandResults: outputs, readable outputs and raw response for XSOAR. """ severity = argToList(args.get('severity')) - acknowledged = arg_to_boolean(args.get('acknowledged')) + acknowledged = arg_to_boolean(args.get('acknowledged')) # type: ignore[arg-type] entity_type = argToList(args.get('entity_type')) region = argToList(args.get('region')) page_size = arg_to_number(args.get('limit')) - response = client.findings_search_request(page_size, severity, region, entity_type, - acknowledged) + response = client.findings_search_request(page_size, severity, region, entity_type, # type: ignore[arg-type] + acknowledged) # type: ignore[arg-type] output = response['findings'] fix_output, pagination_message = pagination(output, args) @@ -1013,7 +1009,7 @@ def findings_search_command(client: Client, args: Dict[str, Any]) -> CommandResu return command_results -def ip_list_create_command(client: Client, args: Dict[str, Any]) -> CommandResults: +def ip_list_create_command(client: Client, args: dict[str, Any]) -> CommandResults: """ Create a new IP-list. Args: @@ -1029,9 +1025,9 @@ def ip_list_create_command(client: Client, args: Dict[str, Any]) -> CommandResul comment_list = argToList(args.get('comment')) # insure comment_list has the same length as ip_list - items = attach_comment_to_ip(ip_list, comment_list, description) + items = attach_comment_to_ip(ip_list, comment_list, description) # type: ignore[arg-type] - response = client.ip_list_create_request(name, description, items) + response = client.ip_list_create_request(name, description, items) # type: ignore[arg-type] command_results = CommandResults(readable_output="IP list created successfully", outputs_prefix='CheckPointDome9.IpList', outputs_key_field='id', @@ -1041,7 +1037,7 @@ def ip_list_create_command(client: Client, args: Dict[str, Any]) -> CommandResul return command_results -def ip_list_update_command(client: Client, args: Dict[str, Any]) -> CommandResults: +def ip_list_update_command(client: Client, args: dict[str, Any]) -> CommandResults: """ Update IP list (description or items). Args: @@ -1058,15 +1054,15 @@ def ip_list_update_command(client: Client, args: Dict[str, Any]) -> CommandResul comment_list = argToList(args.get('comment')) # insure comment_list has the same length as ip_list - items = attach_comment_to_ip(ip_list, comment_list, description) + items = attach_comment_to_ip(ip_list, comment_list, description) # type: ignore[arg-type] # This command replace items. To make the command update the list # we first get the old items if update_mode == 'add_new_items': - old_items = client.ip_list_get_request(list_id=list_id) - items += old_items.get('items') + old_items = client.ip_list_get_request(list_id=list_id) # type: ignore[arg-type] + items += old_items.get('items') # type: ignore[arg-type] - response = client.ip_list_update_request(list_id, description, items) + response = client.ip_list_update_request(list_id, description, items) # type: ignore[arg-type] command_results = CommandResults(readable_output="IP list updated successfully", outputs_prefix='CheckPointDome9.IpList', @@ -1077,7 +1073,7 @@ def ip_list_update_command(client: Client, args: Dict[str, Any]) -> CommandResul return command_results -def ip_list_get_command(client: Client, args: Dict[str, Any]) -> CommandResults: +def ip_list_get_command(client: Client, args: dict[str, Any]) -> CommandResults: """ List all IP Lists or Get individual by list ID. Args: client (Client): Dome9 API client. @@ -1088,7 +1084,7 @@ def ip_list_get_command(client: Client, args: Dict[str, Any]) -> CommandResults: """ list_id = args.get('list_id') - response = client.ip_list_get_request(list_id) + response = client.ip_list_get_request(list_id) # type: ignore[arg-type] if isinstance(response, dict): response = [response] # type: ignore @@ -1096,12 +1092,12 @@ def ip_list_get_command(client: Client, args: Dict[str, Any]) -> CommandResults: ip_lists = [] for ip_list in response: - items = [item['ip'] for item in ip_list['items']] + items = [item['ip'] for item in ip_list['items']] # type: ignore[index] item = { - 'id': ip_list['id'], + 'id': ip_list['id'], # type: ignore[index] 'items': items, - 'name': ip_list['name'], - 'description': ip_list['description'] + 'name': ip_list['name'], # type: ignore[index] + 'description': ip_list['description'] # type: ignore[index] } ip_lists.append(item) @@ -1119,7 +1115,7 @@ def ip_list_get_command(client: Client, args: Dict[str, Any]) -> CommandResults: return command_results -def ip_list_delete_command(client: Client, args: Dict[str, Any]) -> CommandResults: +def ip_list_delete_command(client: Client, args: dict[str, Any]) -> CommandResults: """ Delete list by list ID. Args: @@ -1131,7 +1127,7 @@ def ip_list_delete_command(client: Client, args: Dict[str, Any]) -> CommandResul """ list_id = args.get('list_id') - response = client.ip_list_delete_request(list_id) + response = client.ip_list_delete_request(list_id) # type: ignore[arg-type] command_results = CommandResults(readable_output="IP list deleted successfully", outputs_prefix='CheckPointDome9.IpList', outputs_key_field='id', @@ -1141,7 +1137,7 @@ def ip_list_delete_command(client: Client, args: Dict[str, Any]) -> CommandResul return command_results -def ip_list_metadata_list_command(client: Client, args: Dict[str, Any]) -> CommandResults: +def ip_list_metadata_list_command(client: Client, args: dict[str, Any]) -> CommandResults: """ Get IP address metadata. Args: @@ -1168,7 +1164,7 @@ def ip_list_metadata_list_command(client: Client, args: Dict[str, Any]) -> Comma return command_results -def ip_list_metadata_create_command(client: Client, args: Dict[str, Any]) -> CommandResults: +def ip_list_metadata_create_command(client: Client, args: dict[str, Any]) -> CommandResults: """ Add a new IP address metadata. Args: @@ -1182,7 +1178,7 @@ def ip_list_metadata_create_command(client: Client, args: Dict[str, Any]) -> Com name = args.get('name') classification = args.get('classification') - response = client.ip_list_metadata_create_request(cidr, name, classification) + response = client.ip_list_metadata_create_request(cidr, name, classification) # type: ignore[arg-type] readable_output = tableToMarkdown(name='IP List metadata created successfully', t=response, @@ -1196,7 +1192,7 @@ def ip_list_metadata_create_command(client: Client, args: Dict[str, Any]) -> Com return command_results -def ip_list_metadata_update_command(client: Client, args: Dict[str, Any]) -> CommandResults: +def ip_list_metadata_update_command(client: Client, args: dict[str, Any]) -> CommandResults: """ Update IP address metadata. Args: @@ -1210,7 +1206,7 @@ def ip_list_metadata_update_command(client: Client, args: Dict[str, Any]) -> Com classification = args.get('classification') name = args.get('name') - response = client.ip_list_metadata_update_request(list_metadata_id, classification, name) + response = client.ip_list_metadata_update_request(list_metadata_id, classification, name) # type: ignore[arg-type] readable_output = tableToMarkdown(name='IP List metadata updated successfully', t=response, headerTransform=string_to_table_header) @@ -1223,7 +1219,7 @@ def ip_list_metadata_update_command(client: Client, args: Dict[str, Any]) -> Com return command_results -def ip_list_metadata_delete_command(client: Client, args: Dict[str, Any]) -> CommandResults: +def ip_list_metadata_delete_command(client: Client, args: dict[str, Any]) -> CommandResults: """ Delete IP address metadata. Args: @@ -1237,7 +1233,7 @@ def ip_list_metadata_delete_command(client: Client, args: Dict[str, Any]) -> Com address = args.get('address') mask = args.get('mask') - response = client.ip_list_metadata_delete_request(account_id, address, mask) + response = client.ip_list_metadata_delete_request(account_id, address, mask) # type: ignore[arg-type] command_results = CommandResults(readable_output="IP List metadata deleted successfully", outputs_prefix='CheckPointDome9.IpList.Metadata', outputs_key_field='', @@ -1247,7 +1243,7 @@ def ip_list_metadata_delete_command(client: Client, args: Dict[str, Any]) -> Com return command_results -def compliance_remediation_get_command(client: Client, args: Dict[str, Any]) -> CommandResults: +def compliance_remediation_get_command(client: Client, args: dict[str, Any]) -> CommandResults: """ Get a list of remediations for the account. Args: @@ -1273,7 +1269,7 @@ def compliance_remediation_get_command(client: Client, args: Dict[str, Any]) -> return command_results -def compliance_remediation_create_command(client: Client, args: Dict[str, Any]) -> CommandResults: +def compliance_remediation_create_command(client: Client, args: dict[str, Any]) -> CommandResults: """ Add a new remediation. Args: @@ -1288,7 +1284,7 @@ def compliance_remediation_create_command(client: Client, args: Dict[str, Any]) comment = args.get('comment') cloudbots = argToList(args.get('cloudbots')) - response = client.compliance_remediation_create_request(ruleset_id, rule_logic_hash, comment, + response = client.compliance_remediation_create_request(ruleset_id, rule_logic_hash, comment, # type: ignore[arg-type] cloudbots) readable_output = tableToMarkdown( @@ -1305,7 +1301,7 @@ def compliance_remediation_create_command(client: Client, args: Dict[str, Any]) return command_results -def compliance_remediation_update_command(client: Client, args: Dict[str, Any]) -> CommandResults: +def compliance_remediation_update_command(client: Client, args: dict[str, Any]) -> CommandResults: """ Update a remediation. Args: @@ -1321,8 +1317,8 @@ def compliance_remediation_update_command(client: Client, args: Dict[str, Any]) cloudbots = argToList(args.get('cloudbots')) rule_logic_hash = args.get('rule_logic_hash') - response = client.compliance_remediation_update_request(remediation_id, ruleset_id, - rule_logic_hash, comment, cloudbots) + response = client.compliance_remediation_update_request(remediation_id, ruleset_id, # type: ignore[arg-type] + rule_logic_hash, comment, cloudbots) # type: ignore[arg-type] readable_output = tableToMarkdown( name='Remediation updated successfully', @@ -1338,7 +1334,7 @@ def compliance_remediation_update_command(client: Client, args: Dict[str, Any]) return command_results -def compliance_remediation_delete_command(client: Client, args: Dict[str, Any]) -> CommandResults: +def compliance_remediation_delete_command(client: Client, args: dict[str, Any]) -> CommandResults: """ Delete a remediation. Args: @@ -1350,7 +1346,7 @@ def compliance_remediation_delete_command(client: Client, args: Dict[str, Any]) """ remediation_id = args.get('remediation_id') - response = client.compliance_remediation_delete_request(remediation_id) + response = client.compliance_remediation_delete_request(remediation_id) # type: ignore[arg-type] command_results = CommandResults(readable_output='Remediation deleted successfully', outputs_prefix='CheckPointDome9.ComplianceRemediation', outputs_key_field='id', @@ -1360,7 +1356,7 @@ def compliance_remediation_delete_command(client: Client, args: Dict[str, Any]) return command_results -def compliance_ruleset_list_command(client: Client, args: Dict[str, Any]) -> CommandResults: +def compliance_ruleset_list_command(client: Client, args: dict[str, Any]) -> CommandResults: """ Get all rulesets for the account. Args: client (Client): Dome9 API client. @@ -1388,7 +1384,7 @@ def compliance_ruleset_list_command(client: Client, args: Dict[str, Any]) -> Com return command_results -def compliance_ruleset_rule_list_command(client: Client, args: Dict[str, Any]) -> CommandResults: +def compliance_ruleset_rule_list_command(client: Client, args: dict[str, Any]) -> CommandResults: """ Get all rulesets for the account (get rule logic hash for create remediation). Args: @@ -1400,7 +1396,7 @@ def compliance_ruleset_rule_list_command(client: Client, args: Dict[str, Any]) - """ rule_id = args.get('rule_id') - response = client.compliance_ruleset_rule_list_request(rule_id) + response = client.compliance_ruleset_rule_list_request(rule_id) # type: ignore[arg-type] output = response['rules'] @@ -1421,7 +1417,7 @@ def compliance_ruleset_rule_list_command(client: Client, args: Dict[str, Any]) - return command_results -def security_group_instance_attach_command(client: Client, args: Dict[str, Any]) -> CommandResults: +def security_group_instance_attach_command(client: Client, args: dict[str, Any]) -> CommandResults: """ Attach security Group to an AWS EC2 Instance. Args: @@ -1436,7 +1432,7 @@ def security_group_instance_attach_command(client: Client, args: Dict[str, Any]) nic_name = args.get('nic_name') try: - response = client.security_group_attach_request(instance_id, sg_id, nic_name) + response = client.security_group_attach_request(instance_id, sg_id, nic_name) # type: ignore[arg-type] except Exception: raise ValueError('Security group already attached') @@ -1449,7 +1445,7 @@ def security_group_instance_attach_command(client: Client, args: Dict[str, Any]) return command_results -def security_group_service_delete_command(client: Client, args: Dict[str, Any]) -> CommandResults: +def security_group_service_delete_command(client: Client, args: dict[str, Any]) -> CommandResults: """ Delete a service from an AWS security group. Args: @@ -1462,7 +1458,7 @@ def security_group_service_delete_command(client: Client, args: Dict[str, Any]) sg_id = args.get('sg_id') service_id = args.get('service_id') - response = client.security_group_service_delete_request(sg_id, service_id) + response = client.security_group_service_delete_request(sg_id, service_id) # type: ignore[arg-type] command_results = CommandResults(readable_output="Service deleted successfully", outputs_prefix='CheckPointDome9.SecurityGroup.Service', @@ -1473,7 +1469,7 @@ def security_group_service_delete_command(client: Client, args: Dict[str, Any]) return command_results -def security_group_tags_update_command(client: Client, args: Dict[str, Any]) -> CommandResults: +def security_group_tags_update_command(client: Client, args: dict[str, Any]) -> CommandResults: """ Update the list of tags for an AWS security group. Args: @@ -1487,7 +1483,7 @@ def security_group_tags_update_command(client: Client, args: Dict[str, Any]) -> key = args.get('key') value = args.get('value') - response = client.security_group_tags_update_request(sg_id, key, value) + response = client.security_group_tags_update_request(sg_id, key, value) # type: ignore[arg-type] readable_output = tableToMarkdown(name='Tag updated successfully', t=response, headerTransform=string_to_table_header) @@ -1501,7 +1497,7 @@ def security_group_tags_update_command(client: Client, args: Dict[str, Any]) -> return command_results -def security_group_service_create_command(client: Client, args: Dict[str, Any]) -> CommandResults: +def security_group_service_create_command(client: Client, args: dict[str, Any]) -> CommandResults: """ Create a new Service (rule) for the security group. Args: @@ -1516,20 +1512,20 @@ def security_group_service_create_command(client: Client, args: Dict[str, Any]) protocol_type = args.get('protocol_type') # mandatory port = arg_to_number(args.get('port')) # mandatory policy_type = args.get('policy_type') - open_for_all = arg_to_boolean(args.get('open_for_all')) + open_for_all = arg_to_boolean(args.get('open_for_all')) # type: ignore[arg-type] description = args.get('description') data_id = args.get('data_id') data_name = args.get('data_name') scope_type = args.get('type') is_valid = args.get('is_valid') - inbound = arg_to_boolean(args.get('inbound')) + inbound = arg_to_boolean(args.get('inbound')) # type: ignore[arg-type] icmptype = args.get('icmptype') icmpv6type = args.get('icmpv6type') - response = client.security_group_service_create_request(sg_id, name, protocol_type, port, - policy_type, open_for_all, description, - data_id, data_name, scope_type, - is_valid, inbound, icmptype, icmpv6type) + response = client.security_group_service_create_request(sg_id, name, protocol_type, port, # type: ignore[arg-type] + policy_type, open_for_all, description, # type: ignore[arg-type] + data_id, data_name, scope_type, # type: ignore[arg-type] + is_valid, inbound, icmptype, icmpv6type) # type: ignore[arg-type] sg_service = [{ 'id': response['id'], 'name': response['name'], @@ -1552,7 +1548,7 @@ def security_group_service_create_command(client: Client, args: Dict[str, Any]) return command_results -def security_group_service_update_command(client: Client, args: Dict[str, Any]) -> CommandResults: +def security_group_service_update_command(client: Client, args: dict[str, Any]) -> CommandResults: """ Update a service (rule) for an AWS security group. Can update only port and name. Args: @@ -1577,11 +1573,11 @@ def security_group_service_update_command(client: Client, args: Dict[str, Any]) icmptype = args.get('icmptype') icmpv6type = args.get('icmpv6type') - response = client.security_group_service_update_request(sg_id, service_name, protocol_type, - port, policy_type, open_for_all, - description, data_id, data_name, - scope_type, is_valid, inbound, icmptype, - icmpv6type) + response = client.security_group_service_update_request(sg_id, service_name, protocol_type, # type: ignore[arg-type] + port, policy_type, open_for_all, # type: ignore[arg-type] + description, data_id, data_name, # type: ignore[arg-type] + scope_type, is_valid, inbound, icmptype, # type: ignore[arg-type] + icmpv6type) # type: ignore[arg-type] sg_service = [{ 'id': response['id'], @@ -1606,7 +1602,7 @@ def security_group_service_update_command(client: Client, args: Dict[str, Any]) return command_results -def security_group_instance_detach_command(client: Client, args: Dict[str, Any]) -> CommandResults: +def security_group_instance_detach_command(client: Client, args: dict[str, Any]) -> CommandResults: """ Detach security Group from an AWS EC2 Instance. Args: @@ -1621,7 +1617,7 @@ def security_group_instance_detach_command(client: Client, args: Dict[str, Any]) nic_name = args.get('nic_name') try: - response = client.security_group_instance_detach_request(instance_id, sg_id, nic_name) + response = client.security_group_instance_detach_request(instance_id, sg_id, nic_name) # type: ignore[arg-type] except Exception: raise ValueError('Security group already detached') @@ -1635,7 +1631,7 @@ def security_group_instance_detach_command(client: Client, args: Dict[str, Any]) def security_group_protection_mode_update_command(client: Client, - args: Dict[str, Any]) -> CommandResults: + args: dict[str, Any]) -> CommandResults: """ Change the protection mode for an AWS security group (FullManage or ReadOnly). Args: @@ -1648,7 +1644,7 @@ def security_group_protection_mode_update_command(client: Client, protection_mode = args.get('protection_mode') sg_id = args.get('sg_id') - response = client.protection_mode_update_request(sg_id, protection_mode) + response = client.protection_mode_update_request(sg_id, protection_mode) # type: ignore[arg-type] security_group_list = create_sg_list([response]) readable_output = tableToMarkdown(name='protection mode updated for security group :', @@ -1664,7 +1660,7 @@ def security_group_protection_mode_update_command(client: Client, return command_results -def cloud_accounts_list_command(client: Client, args: Dict[str, Any]) -> CommandResults: +def cloud_accounts_list_command(client: Client, args: dict[str, Any]) -> CommandResults: """ Get cloud account list. Args: @@ -1675,7 +1671,7 @@ def cloud_accounts_list_command(client: Client, args: Dict[str, Any]) -> Command CommandResults: outputs, readable outputs and raw response for XSOAR. """ account_id = args.get('account_id') - response = client.cloud_accounts_list_request(account_id) + response = client.cloud_accounts_list_request(account_id) # type: ignore[arg-type] if account_id: fix_output, pagination_message = response, "" else: @@ -1697,7 +1693,7 @@ def cloud_accounts_list_command(client: Client, args: Dict[str, Any]) -> Command return command_results -def instance_list_command(client: Client, args: Dict[str, Any]) -> CommandResults: +def instance_list_command(client: Client, args: dict[str, Any]) -> CommandResults: """ Get AWS instances. Args: @@ -1708,7 +1704,7 @@ def instance_list_command(client: Client, args: Dict[str, Any]) -> CommandResult CommandResults: outputs, readable outputs and raw response for XSOAR. """ instance_id = args.get('instance_id') - response = client.instance_list_request(instance_id) + response = client.instance_list_request(instance_id) # type: ignore[arg-type] fix_output, pagination_message = pagination(response, args) instance_list = [] @@ -1738,7 +1734,7 @@ def instance_list_command(client: Client, args: Dict[str, Any]) -> CommandResult return command_results -def check_ip_list_security_group_attach_command(client: Client, args: Dict[str, +def check_ip_list_security_group_attach_command(client: Client, args: dict[str, Any]) -> CommandResults: """ Get AWS cloud accounts for a specific security group and region and check if there is an IP-list that attach to a security group. @@ -1752,7 +1748,7 @@ def check_ip_list_security_group_attach_command(client: Client, args: Dict[str, """ sg_id = args.get('sg_id') - response = client.check_ip_list_security_group_attach_request(sg_id) + response = client.check_ip_list_security_group_attach_request(sg_id) # type: ignore[arg-type] fix_output, pagination_message = pagination(response, args) @@ -1772,7 +1768,7 @@ def check_ip_list_security_group_attach_command(client: Client, args: Dict[str, return command_results -def security_group_list_command(client: Client, args: Dict[str, Any]) -> CommandResults: +def security_group_list_command(client: Client, args: dict[str, Any]) -> CommandResults: """ Get all security group Entities. Args: @@ -1810,7 +1806,7 @@ def security_group_list_command(client: Client, args: Dict[str, Any]) -> Command return command_results -def global_search_get_command(client: Client, args: Dict[str, Any]) -> CommandResults: +def global_search_get_command(client: Client, args: dict[str, Any]) -> CommandResults: """ Get top results for each service. Args: @@ -1853,7 +1849,7 @@ def global_search_get_command(client: Client, args: Dict[str, Any]) -> CommandRe return command_results -def cloud_trail_get_command(client: Client, args: Dict[str, Any]) -> CommandResults: +def cloud_trail_get_command(client: Client, args: dict[str, Any]) -> CommandResults: """ Get CloudTrail events for a Dome9 user. Args: @@ -1865,7 +1861,7 @@ def cloud_trail_get_command(client: Client, args: Dict[str, Any]) -> CommandResu """ response = client.cloud_trail_get_request() - cloud_trail = response[0] + cloud_trail = response[0] # type: ignore[index] cloud_trail_output = [] cloud_trail_output.append({ 'name': cloud_trail['name'], @@ -1888,7 +1884,7 @@ def cloud_trail_get_command(client: Client, args: Dict[str, Any]) -> CommandResu return command_results -def findings_bundle_get_command(client: Client, args: Dict[str, Any]) -> CommandResults: +def findings_bundle_get_command(client: Client, args: dict[str, Any]) -> CommandResults: """ Get the findings for a specific rule in a bundle, for all of the user's accounts. Args: @@ -1901,7 +1897,7 @@ def findings_bundle_get_command(client: Client, args: Dict[str, Any]) -> Command bundle_id = arg_to_number(args.get('bundle_id')) rule_logic_hash = args.get('rule_logic_hash') - response = client.findings_bundle_get_request(bundle_id, rule_logic_hash) + response = client.findings_bundle_get_request(bundle_id, rule_logic_hash) # type: ignore[arg-type] readable_output = tableToMarkdown(name='Findings Bundle', t=response, @@ -1915,7 +1911,7 @@ def findings_bundle_get_command(client: Client, args: Dict[str, Any]) -> Command return command_results -def organizational_unit_view_get_command(client: Client, args: Dict[str, Any]) -> CommandResults: +def organizational_unit_view_get_command(client: Client, args: dict[str, Any]) -> CommandResults: """ Get organizational unit view entities. Args: @@ -1940,7 +1936,7 @@ def organizational_unit_view_get_command(client: Client, args: Dict[str, Any]) - return command_results -def organizational_unit_flat_get_command(client: Client, args: Dict[str, Any]) -> CommandResults: +def organizational_unit_flat_get_command(client: Client, args: dict[str, Any]) -> CommandResults: """ Get organizational unit view entities. Args: @@ -1967,7 +1963,7 @@ def organizational_unit_flat_get_command(client: Client, args: Dict[str, Any]) - return command_results -def organizational_unit_get_command(client: Client, args: Dict[str, Any]) -> CommandResults: +def organizational_unit_get_command(client: Client, args: dict[str, Any]) -> CommandResults: """ Get an organizational unit by its ID. Args: @@ -1978,8 +1974,8 @@ def organizational_unit_get_command(client: Client, args: Dict[str, Any]) -> Com CommandResults: outputs, readable outputs and raw response for XSOAR. """ unit_id = args.get('unit_id') - response = client.organizational_unit_get_request(unit_id) - output = response[0]['item'] + response = client.organizational_unit_get_request(unit_id) # type: ignore[arg-type] + output = response[0]['item'] # type: ignore[index] organizational_unit_list = [] @@ -2006,7 +2002,7 @@ def organizational_unit_get_command(client: Client, args: Dict[str, Any]) -> Com return command_results -def finding_get_command(client: Client, args: Dict[str, Any]) -> CommandResults: +def finding_get_command(client: Client, args: dict[str, Any]) -> CommandResults: """ Get a findings by its ID. Args: @@ -2017,7 +2013,7 @@ def finding_get_command(client: Client, args: Dict[str, Any]) -> CommandResults: CommandResults: outputs, readable outputs and raw response for XSOAR. """ finding_id = args.get('finding_id') - response = client.finding_get_request(finding_id) + response = client.finding_get_request(finding_id) # type: ignore[arg-type] readable_output = tableToMarkdown(name='Findings:', t=response, headers=[ @@ -2045,11 +2041,11 @@ def parse_incident(alert: dict) -> dict: Returns: dict: XSOAR Incident. """ - alert_date = datetime.strptime(alert.get("createdTime"), TIME_FORMAT) + alert_date = datetime.strptime(alert.get("createdTime"), TIME_FORMAT) # type: ignore[arg-type] iso_time = FormatIso8601(alert_date) + 'Z' incident = { - 'name': "Dome9 Alert ID: " + alert.get('id'), + 'name': "Dome9 Alert ID: " + alert.get('id'), # type: ignore[arg-type,operator] 'occurred': iso_time, 'rawJSON': json.dumps(alert) } @@ -2090,17 +2086,17 @@ def fetch_incidents(client: Client, args: dict) -> None: assert isinstance(first_fetch_timestamp, int) - alert_list = client.findings_search_request(max_fetch, alert_severity, alert_region) + alert_list = client.findings_search_request(max_fetch, alert_severity, alert_region) # type: ignore[arg-type] incidents = [] # convert the last_run_time to dome9 time format last_run_datetime = dateparser.parse(last_run_time) - last_run_str = last_run_datetime.strftime(TIME_FORMAT) + last_run_str = last_run_datetime.strftime(TIME_FORMAT) # type: ignore[union-attr] last_run_datetime = dateparser.parse(last_run_str) for alert in alert_list['findings']: alert_time = dateparser.parse(alert['createdTime']) - if alert.get('id') != last_run_id and last_run_datetime < alert_time: + if alert.get('id') != last_run_id and last_run_datetime < alert_time: # type: ignore[return-value,operator] incidents.append(parse_incident(alert)) demisto.incidents(incidents) @@ -2116,16 +2112,16 @@ def test_module(client: Client) -> None: client.access_lease_list_request() except DemistoException as e: if 'password' in str(e): - return 'Authorization Error: make sure API key ID & secret are correctly set' + return 'Authorization Error: make sure API key ID & secret are correctly set' # type: ignore[return-value] else: raise e - return 'ok' + return 'ok' # type: ignore[return-value] def main() -> None: - params: Dict[str, Any] = demisto.params() - args: Dict[str, Any] = demisto.args() + params: dict[str, Any] = demisto.params() + args: dict[str, Any] = demisto.args() base_url = params.get('base_url') @@ -2191,11 +2187,11 @@ def main() -> None: } try: - client: Client = Client(base_url, key_id, key_secret, proxy, + client: Client = Client(base_url, key_id, key_secret, proxy, # type: ignore[arg-type] verify_certificate) # type: ignore if command == 'test-module': - return_results(test_module(client)) + return_results(test_module(client)) # type: ignore[func-returns-value] if command == 'fetch-incidents': fetch_incidents(client, params) elif command in commands: diff --git a/Packs/CheckPointDome9/Integrations/CheckPointDome9/CheckPointDome9.yml b/Packs/CheckPointDome9/Integrations/CheckPointDome9/CheckPointDome9.yml index 8648fc9c297..c1d66b9d916 100644 --- a/Packs/CheckPointDome9/Integrations/CheckPointDome9/CheckPointDome9.yml +++ b/Packs/CheckPointDome9/Integrations/CheckPointDome9/CheckPointDome9.yml @@ -1363,7 +1363,7 @@ script: - contextPath: CheckPointDome9.FindingsBundle.region description: The CloudTrail account ID. type: String - dockerimage: demisto/python3:3.10.13.84405 + dockerimage: demisto/python3:3.11.9.105369 isfetch: true runonce: false script: '-' diff --git a/Packs/CheckPointDome9/Integrations/CheckPointDome9/CheckPointDome9_test.py b/Packs/CheckPointDome9/Integrations/CheckPointDome9/CheckPointDome9_test.py index d454667c611..d6085c3c5c0 100644 --- a/Packs/CheckPointDome9/Integrations/CheckPointDome9/CheckPointDome9_test.py +++ b/Packs/CheckPointDome9/Integrations/CheckPointDome9/CheckPointDome9_test.py @@ -1,4 +1,3 @@ -# type: ignore import json import os import pytest @@ -19,7 +18,7 @@ def load_mock_response(file_name: str) -> str: str: Mock file content. """ - with open(os.path.join('test_data', file_name), mode='r', encoding='utf-8') as mock_file: + with open(os.path.join('test_data', file_name), encoding='utf-8') as mock_file: return json.loads(mock_file.read()) diff --git a/Packs/CheckPointDome9/ReleaseNotes/1_0_17.md b/Packs/CheckPointDome9/ReleaseNotes/1_0_17.md new file mode 100644 index 00000000000..f88650f4aca --- /dev/null +++ b/Packs/CheckPointDome9/ReleaseNotes/1_0_17.md @@ -0,0 +1,6 @@ + +#### Integrations + +##### Check Point Dome9 (CloudGuard) + +- Maintenance and stability enhancements. diff --git a/Packs/CheckPointDome9/pack_metadata.json b/Packs/CheckPointDome9/pack_metadata.json index 7beb2d7a4c8..100324dafc6 100644 --- a/Packs/CheckPointDome9/pack_metadata.json +++ b/Packs/CheckPointDome9/pack_metadata.json @@ -2,7 +2,7 @@ "name": "Check Point Dome9 (CloudGuard)", "description": "Dome9 integration allows to easily manage the security and compliance of the public cloud.", "support": "xsoar", - "currentVersion": "1.0.16", + "currentVersion": "1.0.17", "author": "Cortex XSOAR", "url": "https://www.paloaltonetworks.com/cortex", "email": "", diff --git a/Packs/CommonScripts/ReleaseNotes/1_15_48.md b/Packs/CommonScripts/ReleaseNotes/1_15_48.md new file mode 100644 index 00000000000..431f72eb891 --- /dev/null +++ b/Packs/CommonScripts/ReleaseNotes/1_15_48.md @@ -0,0 +1,6 @@ + +#### Scripts + +##### FindSimilarIncidents + +- Maintenance and stability enhancements. diff --git a/Packs/CommonScripts/Scripts/FindSimilarIncidentsV2/FindSimilarIncidentsV2.py b/Packs/CommonScripts/Scripts/FindSimilarIncidentsV2/FindSimilarIncidentsV2.py index 79d3a3a34da..b0c60acdd98 100644 --- a/Packs/CommonScripts/Scripts/FindSimilarIncidentsV2/FindSimilarIncidentsV2.py +++ b/Packs/CommonScripts/Scripts/FindSimilarIncidentsV2/FindSimilarIncidentsV2.py @@ -1,5 +1,3 @@ -# type: ignore - from CommonServerPython import * from dateutil import parser # type: ignore[import] diff --git a/Packs/CommonScripts/pack_metadata.json b/Packs/CommonScripts/pack_metadata.json index 54905d0635a..11adae30f2f 100644 --- a/Packs/CommonScripts/pack_metadata.json +++ b/Packs/CommonScripts/pack_metadata.json @@ -2,7 +2,7 @@ "name": "Common Scripts", "description": "Frequently used scripts pack.", "support": "xsoar", - "currentVersion": "1.15.47", + "currentVersion": "1.15.48", "author": "Cortex XSOAR", "url": "https://www.paloaltonetworks.com/cortex", "email": "", diff --git a/Packs/CyrenInboxSecurity/ReleaseNotes/1_1_13.md b/Packs/CyrenInboxSecurity/ReleaseNotes/1_1_13.md new file mode 100644 index 00000000000..6348c66f767 --- /dev/null +++ b/Packs/CyrenInboxSecurity/ReleaseNotes/1_1_13.md @@ -0,0 +1,9 @@ + +#### Scripts + +##### Cyren-Show-Threat-Indicators + +- Maintenance and stability enhancements. +##### Cyren-Find-Similar-Incidents + +- Maintenance and stability enhancements. diff --git a/Packs/CyrenInboxSecurity/Scripts/CyrenFindSimilarIncidents/CyrenFindSimilarIncidents.py b/Packs/CyrenInboxSecurity/Scripts/CyrenFindSimilarIncidents/CyrenFindSimilarIncidents.py index d6e59314453..33c6b7a4705 100644 --- a/Packs/CyrenInboxSecurity/Scripts/CyrenFindSimilarIncidents/CyrenFindSimilarIncidents.py +++ b/Packs/CyrenInboxSecurity/Scripts/CyrenFindSimilarIncidents/CyrenFindSimilarIncidents.py @@ -1,8 +1,5 @@ import demistomock as demisto # noqa: F401 from CommonServerPython import * # noqa: F401 -# noqa: F401 -# noqa: F401 -# type: ignore TIME_FIELD = "created" MAX_CANDIDATES_IN_LIST = 1000 diff --git a/Packs/CyrenInboxSecurity/Scripts/CyrenShowThreatIndicators/CyrenShowThreatIndicators.py b/Packs/CyrenInboxSecurity/Scripts/CyrenShowThreatIndicators/CyrenShowThreatIndicators.py index a1aa7adf97e..bdafbd1a39a 100644 --- a/Packs/CyrenInboxSecurity/Scripts/CyrenShowThreatIndicators/CyrenShowThreatIndicators.py +++ b/Packs/CyrenInboxSecurity/Scripts/CyrenShowThreatIndicators/CyrenShowThreatIndicators.py @@ -1,8 +1,5 @@ import demistomock as demisto # noqa: F401 from CommonServerPython import * # noqa: F401 -# noqa: F401 -# noqa: F401 -# type: ignore import json diff --git a/Packs/CyrenInboxSecurity/pack_metadata.json b/Packs/CyrenInboxSecurity/pack_metadata.json index db2f7236923..00ced76ba11 100644 --- a/Packs/CyrenInboxSecurity/pack_metadata.json +++ b/Packs/CyrenInboxSecurity/pack_metadata.json @@ -2,7 +2,7 @@ "name": "Cyren Inbox Security", "description": "Cyren Inbox Security protects Office 365 mailboxes from evasive phishing, business email compromise, and fraud.", "support": "partner", - "currentVersion": "1.1.12", + "currentVersion": "1.1.13", "author": "Cyren", "url": "https://www.cyren.com/products/cyren-inbox-security", "email": "paltoalto-cortex-xsoar@cyren.com", diff --git a/Packs/ForescoutEyeInspect/Integrations/ForescoutEyeInspect/ForescoutEyeInspect.py b/Packs/ForescoutEyeInspect/Integrations/ForescoutEyeInspect/ForescoutEyeInspect.py index e7a9921edbc..39fc69255ea 100644 --- a/Packs/ForescoutEyeInspect/Integrations/ForescoutEyeInspect/ForescoutEyeInspect.py +++ b/Packs/ForescoutEyeInspect/Integrations/ForescoutEyeInspect/ForescoutEyeInspect.py @@ -1,10 +1,9 @@ import demistomock as demisto # noqa: F401 from CommonServerPython import * # noqa: F401 -# type: ignore -# mypy: ignore-errors + from copy import deepcopy -from typing import Any, Dict, Tuple, Type -from urllib.parse import urljoin +from typing import Any +from urllib.parse import urljoin # type: ignore import urllib3 @@ -61,7 +60,7 @@ def list_hosts_request(self, last_seen: Optional[str] = None, id_min: Optional[int] = None, sort_field: Optional[str] = None, - sort_ascending: Optional[bool] = None) -> List[Dict[str, Any]]: + sort_ascending: Optional[bool] = None) -> List[dict[str, Any]]: """ Retrieves information about the hosts in the eyeInspect CC database. @@ -99,7 +98,7 @@ def list_links_request(self, last_seen: Optional[str] = None, id_min: Optional[int] = None, sort_field: Optional[str] = None, - sort_ascending: Optional[bool] = None) -> List[Dict[str, Any]]: + sort_ascending: Optional[bool] = None) -> List[dict[str, Any]]: """ Retrieves information about the links in the eyeInspect CC database. @@ -134,7 +133,7 @@ def list_links_request(self, return self._http_request(method='GET', url_suffix='links', params=params) - def get_vulnerability_info_request(self, cve_id: str) -> Dict[str, Any]: + def get_vulnerability_info_request(self, cve_id: str) -> dict[str, Any]: """ Retrieves information about a specific vulnerability stored in the eyeInspect CC database. @@ -161,7 +160,7 @@ def list_alerts_request(self, dst_port: Optional[int] = None, src_host_id: Optional[int] = None, dst_host_id: Optional[int] = None, - host_id: Optional[int] = None) -> List[Dict[str, Any]]: + host_id: Optional[int] = None) -> List[dict[str, Any]]: """ Retrieves information about the alerts inside eyeInspect CC. @@ -225,7 +224,7 @@ def get_alert_pcap_request(self, alert_id: int) -> bytes: def list_sensors_request(self, offset: Optional[int] = None, limit: Optional[int] = None, - all_sensors: Optional[bool] = None) -> List[Dict[str, Any]]: + all_sensors: Optional[bool] = None) -> List[dict[str, Any]]: """ Retrieves information about the sensors associated to the eyeInspect CC. @@ -249,7 +248,7 @@ def list_sensors_request(self, def list_sensor_modules_request(self, sensor_id: int, offset: Optional[int] = None, - limit: Optional[int] = None) -> List[Dict[str, Any]]: + limit: Optional[int] = None) -> List[dict[str, Any]]: """ Retrieves information about the Modules of the specified Sensor. @@ -274,7 +273,7 @@ def update_sensor_module_request(self, name: Optional[str] = None, description: Optional[str] = None, started: Optional[bool] = None, - operational_mode: Optional[str] = None) -> Dict[str, Any]: + operational_mode: Optional[str] = None) -> dict[str, Any]: """ Changes the specified properties of the specified Module. @@ -317,7 +316,7 @@ def delete_sensor_module_request(self, sensor_id: int, module_id: int) -> None: def get_ip_blacklist_request(self, sensor_id: int, offset: Optional[int] = None, - limit: Optional[int] = None) -> List[Dict[str, Any]]: + limit: Optional[int] = None) -> List[dict[str, Any]]: """ Retrieves the IP blacklist from the Industrial Threat Library of the specified Sensor. @@ -356,7 +355,7 @@ def add_ip_blacklist_request(self, sensor_id: int, address: str, comment: str = def get_domain_blacklist_request(self, sensor_id: int, offset: Optional[int] = None, - limit: Optional[int] = None) -> List[Dict[str, Any]]: + limit: Optional[int] = None) -> List[dict[str, Any]]: """ Retrieves the domain name blacklist from the Industrial Threat Library of the specified Sensor. @@ -399,7 +398,7 @@ def add_domain_blacklist_request(self, def get_ssl_client_blacklist_request(self, sensor_id: int, offset: Optional[int] = None, - limit: Optional[int] = None) -> List[Dict[str, Any]]: + limit: Optional[int] = None) -> List[dict[str, Any]]: """ Retrieves the SSL client application blacklist from the Industrial Threat Library of the specified Sensor. @@ -447,7 +446,7 @@ def add_ssl_client_blacklist_request(self, def get_file_operation_blacklist_request(self, sensor_id: int, offset: Optional[int] = None, - limit: Optional[int] = None) -> List[Dict[str, str]]: + limit: Optional[int] = None) -> List[dict[str, str]]: """ Retrieves the file operation blacklist from the Industrial Threat Library of the specified Sensor. @@ -495,7 +494,7 @@ def add_file_operation_blacklist_request(self, json_data=body, resp_type='text') - def get_diagnostics_information_request(self) -> Dict[str, Any]: + def get_diagnostics_information_request(self) -> dict[str, Any]: """ Retrieves information about all monitored Command Center resources and their health status excluding the logs. @@ -528,7 +527,7 @@ def get_diagnostic_logs_request(self, def list_group_policies_request(self, offset: Optional[int] = None, - limit: Optional[int] = None) -> List[Dict[str, Any]]: + limit: Optional[int] = None) -> List[dict[str, Any]]: """ Get all group policies. @@ -545,7 +544,7 @@ def list_group_policies_request(self, return self._http_request(method='GET', url_suffix='group_policy', params=params) def create_group_policy_request(self, name: str, description: str, - constraints: List[Dict[str, Any]]) -> Dict[str, Any]: + constraints: List[dict[str, Any]]) -> dict[str, Any]: """ Create a new group policy. @@ -563,7 +562,7 @@ def create_group_policy_request(self, name: str, description: str, return self._http_request(method='POST', url_suffix='group_policy', json_data=body) def update_group_policy_request(self, policy_id: int, name: str, description: str, - constraints: List[Dict[str, Any]]) -> Dict[str, Any]: + constraints: List[dict[str, Any]]) -> dict[str, Any]: """ Update a group policy. @@ -596,7 +595,7 @@ def delete_group_policy_request(self, policy_id: int) -> None: resp_type='text') def assign_group_policy_hosts_request(self, policy_id: int, filter_type: str, - filter_value: str) -> Dict[str, Any]: + filter_value: str) -> dict[str, Any]: """ Add all hosts not assigned to any policy (individual or group) matching the filter to the group policy. @@ -616,7 +615,7 @@ def assign_group_policy_hosts_request(self, policy_id: int, filter_type: str, json_data=body) def unassign_group_policy_hosts_request(self, policy_id: int, filter_type: str, - filter_value: str) -> Dict[str, Any]: + filter_value: str) -> dict[str, Any]: """ Unassign all hosts assigned to the group policy matching the filter. @@ -637,7 +636,7 @@ def unassign_group_policy_hosts_request(self, policy_id: int, filter_type: str, def list_ip_reuse_domains_request(self, offset: Optional[int] = None, - limit: Optional[int] = None) -> List[Dict[str, Any]]: + limit: Optional[int] = None) -> List[dict[str, Any]]: """ Get all IP reuse domains. @@ -660,7 +659,7 @@ def list_hosts_changelog_request(self, start_timestamp: Optional[str] = None, end_timestamp: Optional[str] = None, event_type_id: Optional[str] = None, - event_category: Optional[str] = None) -> List[Dict[str, Any]]: + event_category: Optional[str] = None) -> List[dict[str, Any]]: """ Retrieves information about the changes of host properties and configuration from the eyeInspect CC database. @@ -696,7 +695,7 @@ def _http_request(self, method: str, url_suffix: str = '', full_url: str = None, - headers: Dict[str, str] = None, + headers: dict[str, str] = None, *args, **kwargs): if method in ['POST', 'PUT', 'DELETE']: @@ -723,7 +722,7 @@ def _get_csrf_token(self) -> str: return token_response.headers['X-CSRF-Token'] -def arg_to_type_list(arg: str, item_type: Type[Any]) -> List[Any]: +def arg_to_type_list(arg: str, item_type: type[Any]) -> List[Any]: """ Converts XSOAR argument to list with certain type. @@ -815,7 +814,7 @@ def matches_one_item(items: List[Any], container_list: List[Any]) -> bool: return any(True for item in items if item in container_list) -def filter_single_result(result: Dict[str, Any], **fields: List[Any]) -> bool: +def filter_single_result(result: dict[str, Any], **fields: List[Any]) -> bool: """ Filters a single result of the API, based on the results fields. @@ -841,7 +840,7 @@ def filter_single_result(result: Dict[str, Any], **fields: List[Any]) -> bool: return True -def filter_results(results: List[Dict[str, Any]], **fields: List[Any]) -> List[Dict[str, Any]]: +def filter_results(results: List[dict[str, Any]], **fields: List[Any]) -> List[dict[str, Any]]: """ Filters records from the API based on the provided fields. This is required due to lack of essential fields inside the API filtering. @@ -856,7 +855,7 @@ def filter_results(results: List[Dict[str, Any]], **fields: List[Any]) -> List[D return [result for result in results if filter_single_result(result, **fields)] -def add_alerts_fields(client: Client, alerts: List[Dict[str, Any]]) -> None: +def add_alerts_fields(client: Client, alerts: List[dict[str, Any]]) -> None: """ Adds additional data to the alerts. @@ -870,7 +869,7 @@ def add_alerts_fields(client: Client, alerts: List[Dict[str, Any]]) -> None: alert['xsoar_severity'] = XSOAR_SEVERITY_MAPPING.get(alert['severity'], alert['severity']) -def get_pagination_arguments(args: Dict[str, Any]) -> Tuple[int, int, int]: +def get_pagination_arguments(args: dict[str, Any]) -> tuple[int, int, int]: """ Gets and validates pagination arguments for client (offset and limit). @@ -884,12 +883,12 @@ def get_pagination_arguments(args: Dict[str, Any]) -> Tuple[int, int, int]: page = arg_to_number(args.get('page', DEFAULT_PAGE)) limit = arg_to_number(args.get('limit', DEFAULT_LIMIT)) - if page < 1: + if page < 1: # type: ignore[operator] raise DemistoException('Page argument must be greater than 1') - if not 1 <= limit <= MAX_LIMIT: + if not 1 <= limit <= MAX_LIMIT: # type: ignore[operator] raise DemistoException(f'Limit argument must be between 1 to {MAX_LIMIT}') - return page, (page - 1) * limit, limit + return page, (page - 1) * limit, limit # type: ignore[operator,return-value] def validate_fetch_params(max_fetch: int, first_fetch: str) -> None: @@ -911,7 +910,7 @@ def validate_fetch_params(max_fetch: int, first_fetch: str) -> None: f'The Maximum number of incidents per fetch should not exceed {MAX_FETCH_INCIDENTS}.') -def list_hosts_command(client: Client, args: Dict[str, str]) -> CommandResults: +def list_hosts_command(client: Client, args: dict[str, str]) -> CommandResults: """ Retrieves information about the hosts in the eyeInspect CC database. @@ -935,12 +934,12 @@ def list_hosts_command(client: Client, args: Dict[str, str]) -> CommandResults: id_min=id_min, sort_field=sort_field, sort_ascending=sort_ascending) - outputs = response['results'] + outputs = response['results'] # type: ignore[call-overload] ip_addresses = argToList(args.get('ip')) vlan_ids = argToList(args.get('vlan_id')) mac_addresses = argToList(args.get('mac_address')) - sensor_ids = arg_to_type_list(args.get('sensor_id'), int) + sensor_ids = arg_to_type_list(args.get('sensor_id'), int) # type: ignore[arg-type] outputs = filter_results(outputs, ip=ip_addresses, vlans=vlan_ids, @@ -962,7 +961,7 @@ def list_hosts_command(client: Client, args: Dict[str, str]) -> CommandResults: raw_response=response) -def list_links_command(client: Client, args: Dict[str, str]) -> CommandResults: +def list_links_command(client: Client, args: dict[str, str]) -> CommandResults: """ Retrieves information about the links in the eyeInspect CC database. @@ -994,7 +993,7 @@ def list_links_command(client: Client, args: Dict[str, str]) -> CommandResults: id_min=id_min, sort_field=sort_field, sort_ascending=sort_ascending) - outputs = response['results'] + outputs = response['results'] # type: ignore[call-overload] readable_output = tableToMarkdown('Host Links List:', outputs, @@ -1010,7 +1009,7 @@ def list_links_command(client: Client, args: Dict[str, str]) -> CommandResults: raw_response=response) -def get_vulnerability_info_command(client: Client, args: Dict[str, str]) -> CommandResults: +def get_vulnerability_info_command(client: Client, args: dict[str, str]) -> CommandResults: """ Retrieves information about a specific vulnerability stored in the eyeInspect CC database. @@ -1039,7 +1038,7 @@ def get_vulnerability_info_command(client: Client, args: Dict[str, str]) -> Comm raw_response=response) -def list_alerts_command(client: Client, args: Dict[str, str]) -> CommandResults: +def list_alerts_command(client: Client, args: dict[str, str]) -> CommandResults: """ Retrieves information about the alerts inside eyeInspect CC. @@ -1071,11 +1070,11 @@ def list_alerts_command(client: Client, args: Dict[str, str]) -> CommandResults: src_ip=src_ip, dst_ip=dst_ip, ip=ip) - outputs = response['results'] + outputs = response['results'] # type: ignore[call-overload] sensor_names = argToList(args.get('sensor_name')) vlan_ids = argToList(args.get('vlan_id')) - severities = arg_to_type_list(args.get('severity'), int) + severities = arg_to_type_list(args.get('severity'), int) # type: ignore[arg-type] statuses = argToList(args.get('status')) outputs = filter_results(outputs, sensor_name=sensor_names, @@ -1099,7 +1098,7 @@ def list_alerts_command(client: Client, args: Dict[str, str]) -> CommandResults: raw_response=response) -def get_alert_pcap_command(client: Client, args: Dict[str, str]) -> Dict[str, Any]: +def get_alert_pcap_command(client: Client, args: dict[str, str]) -> dict[str, Any]: """ Retrieves the PCAP file associated to a given Alert. @@ -1112,14 +1111,14 @@ def get_alert_pcap_command(client: Client, args: Dict[str, str]) -> Dict[str, An """ alert_id = arg_to_number(args['alert_id']) - response = client.get_alert_pcap_request(alert_id=alert_id) + response = client.get_alert_pcap_request(alert_id=alert_id) # type: ignore[arg-type] return fileResult(filename=f'alert_{alert_id}_sniff.pcap', data=response, file_type=EntryType.ENTRY_INFO_FILE) -def list_sensors_command(client: Client, args: Dict[str, str]) -> CommandResults: +def list_sensors_command(client: Client, args: dict[str, str]) -> CommandResults: """ Retrieves information about the sensors associated to the eyeInspect CC. @@ -1135,11 +1134,11 @@ def list_sensors_command(client: Client, args: Dict[str, str]) -> CommandResults all_sensors = arg_to_boolean(args.get('all_sensors')) response = client.list_sensors_request(offset=offset, limit=limit, all_sensors=all_sensors) - outputs = response['results'] + outputs = response['results'] # type: ignore[call-overload] names = argToList(args.get('name')) addresses = argToList(args.get('address')) - ports = arg_to_type_list(args.get('port'), int) + ports = arg_to_type_list(args.get('port'), int) # type: ignore[arg-type] sensor_types = argToList(args.get('type')) states = argToList(args.get('state')) outputs = filter_results(outputs, @@ -1163,7 +1162,7 @@ def list_sensors_command(client: Client, args: Dict[str, str]) -> CommandResults raw_response=response) -def list_sensor_modules_command(client: Client, args: Dict[str, str]) -> CommandResults: +def list_sensor_modules_command(client: Client, args: dict[str, str]) -> CommandResults: """ Retrieves information about the Modules of the specified Sensor. @@ -1178,8 +1177,8 @@ def list_sensor_modules_command(client: Client, args: Dict[str, str]) -> Command sensor_id = arg_to_number(args['sensor_id']) page, offset, limit = get_pagination_arguments(args) - response = client.list_sensor_modules_request(sensor_id=sensor_id, offset=offset, limit=limit) - outputs = response['results'] + response = client.list_sensor_modules_request(sensor_id=sensor_id, offset=offset, limit=limit) # type: ignore[arg-type] + outputs = response['results'] # type: ignore[call-overload] readable_output = tableToMarkdown(f'Sensor {sensor_id} Modules List:', outputs, @@ -1195,7 +1194,7 @@ def list_sensor_modules_command(client: Client, args: Dict[str, str]) -> Command raw_response=response) -def update_sensor_module_command(client: Client, args: Dict[str, str]) -> CommandResults: +def update_sensor_module_command(client: Client, args: dict[str, str]) -> CommandResults: """ Changes the specified properties of the specified Module. @@ -1214,8 +1213,8 @@ def update_sensor_module_command(client: Client, args: Dict[str, str]) -> Comman started = arg_to_boolean(args.get('started')) operational_mode = args.get('operational_mode') - response = client.update_sensor_module_request(sensor_id=sensor_id, - module_id=module_id, + response = client.update_sensor_module_request(sensor_id=sensor_id, # type: ignore[arg-type] + module_id=module_id, # type: ignore[arg-type] name=name, description=description, started=started, @@ -1233,7 +1232,7 @@ def update_sensor_module_command(client: Client, args: Dict[str, str]) -> Comman raw_response=response) -def delete_sensor_module_command(client: Client, args: Dict[str, str]) -> CommandResults: +def delete_sensor_module_command(client: Client, args: dict[str, str]) -> CommandResults: """ Deletes the specified Module from the specified Sensor and from the eyeInspect CC database. @@ -1248,13 +1247,13 @@ def delete_sensor_module_command(client: Client, args: Dict[str, str]) -> Comman sensor_id = arg_to_number(args['sensor_id']) module_id = arg_to_number(args['module_id']) - client.delete_sensor_module_request(sensor_id=sensor_id, module_id=module_id) + client.delete_sensor_module_request(sensor_id=sensor_id, module_id=module_id) # type: ignore[arg-type] readable_output = f'## The module {module_id} of sensor {sensor_id} was successfully deleted!' return CommandResults(readable_output=readable_output) -def get_ip_blacklist_command(client: Client, args: Dict[str, str]) -> CommandResults: +def get_ip_blacklist_command(client: Client, args: dict[str, str]) -> CommandResults: """ Retrieves the IP blacklist from the Industrial Threat Library of the specified Sensor. @@ -1269,9 +1268,9 @@ def get_ip_blacklist_command(client: Client, args: Dict[str, str]) -> CommandRes sensor_id = arg_to_number(args['sensor_id']) page, offset, limit = get_pagination_arguments(args) - response = client.get_ip_blacklist_request(sensor_id=sensor_id, offset=offset, limit=limit) + response = client.get_ip_blacklist_request(sensor_id=sensor_id, offset=offset, limit=limit) # type: ignore[arg-type] - outputs = deepcopy(response['results']) + outputs = deepcopy(response['results']) # type: ignore[call-overload] for entry in outputs: entry['sensor_id'] = sensor_id @@ -1289,7 +1288,7 @@ def get_ip_blacklist_command(client: Client, args: Dict[str, str]) -> CommandRes raw_response=response) -def add_ip_blacklist_command(client: Client, args: Dict[str, str]) -> CommandResults: +def add_ip_blacklist_command(client: Client, args: dict[str, str]) -> CommandResults: """ Adds a new entry to the IP blacklist from the Industrial Threat Library of the specified Sensor. @@ -1305,7 +1304,7 @@ def add_ip_blacklist_command(client: Client, args: Dict[str, str]) -> CommandRes address = args['address'] comment = args.get('comment', '') - client.add_ip_blacklist_request(sensor_id=sensor_id, address=address, comment=comment) + client.add_ip_blacklist_request(sensor_id=sensor_id, address=address, comment=comment) # type: ignore[arg-type] outputs = {'address': address, 'comment': comment} readable_output = tableToMarkdown(f'New IP Blacklist Entry of Sensor {sensor_id}:', @@ -1317,7 +1316,7 @@ def add_ip_blacklist_command(client: Client, args: Dict[str, str]) -> CommandRes return CommandResults(readable_output=readable_output) -def get_domain_blacklist_command(client: Client, args: Dict[str, str]) -> CommandResults: +def get_domain_blacklist_command(client: Client, args: dict[str, str]) -> CommandResults: """ Retrieves the domain name blacklist from the Industrial Threat Library of the specified Sensor. @@ -1332,9 +1331,9 @@ def get_domain_blacklist_command(client: Client, args: Dict[str, str]) -> Comman sensor_id = arg_to_number(args['sensor_id']) page, offset, limit = get_pagination_arguments(args) - response = client.get_domain_blacklist_request(sensor_id=sensor_id, offset=offset, limit=limit) + response = client.get_domain_blacklist_request(sensor_id=sensor_id, offset=offset, limit=limit) # type: ignore[arg-type] - outputs = deepcopy(response['results']) + outputs = deepcopy(response['results']) # type: ignore[call-overload] for entry in outputs: entry['sensor_id'] = sensor_id @@ -1352,7 +1351,7 @@ def get_domain_blacklist_command(client: Client, args: Dict[str, str]) -> Comman raw_response=response) -def add_domain_blacklist_command(client: Client, args: Dict[str, str]) -> CommandResults: +def add_domain_blacklist_command(client: Client, args: dict[str, str]) -> CommandResults: """ Adds a new entry to the domain name blacklist from the Industrial Threat Library of the specified Sensor. @@ -1368,7 +1367,7 @@ def add_domain_blacklist_command(client: Client, args: Dict[str, str]) -> Comman domain_name = args['domain_name'] comment = args.get('comment', '') - client.add_domain_blacklist_request(sensor_id=sensor_id, + client.add_domain_blacklist_request(sensor_id=sensor_id, # type: ignore[arg-type] domain_name=domain_name, comment=comment) @@ -1382,7 +1381,7 @@ def add_domain_blacklist_command(client: Client, args: Dict[str, str]) -> Comman return CommandResults(readable_output=readable_output) -def get_ssl_client_blacklist_command(client: Client, args: Dict[str, str]) -> CommandResults: +def get_ssl_client_blacklist_command(client: Client, args: dict[str, str]) -> CommandResults: """ Retrieves the SSL client application blacklist from the Industrial Threat Library of the specified Sensor. @@ -1397,11 +1396,11 @@ def get_ssl_client_blacklist_command(client: Client, args: Dict[str, str]) -> Co sensor_id = arg_to_number(args['sensor_id']) page, offset, limit = get_pagination_arguments(args) - response = client.get_ssl_client_blacklist_request(sensor_id=sensor_id, + response = client.get_ssl_client_blacklist_request(sensor_id=sensor_id, # type: ignore[arg-type] offset=offset, limit=limit) - outputs = deepcopy(response['results']) + outputs = deepcopy(response['results']) # type: ignore[call-overload] for entry in outputs: entry['sensor_id'] = sensor_id @@ -1419,7 +1418,7 @@ def get_ssl_client_blacklist_command(client: Client, args: Dict[str, str]) -> Co raw_response=response) -def add_ssl_client_blacklist_command(client: Client, args: Dict[str, str]) -> CommandResults: +def add_ssl_client_blacklist_command(client: Client, args: dict[str, str]) -> CommandResults: """ Adds a new entry to the SSL client application blacklist from the Industrial Threat Library of the specified Sensor. @@ -1436,7 +1435,7 @@ def add_ssl_client_blacklist_command(client: Client, args: Dict[str, str]) -> Co ja3_hash = args['ja3_hash'] comment = args.get('comment', '') - client.add_ssl_client_blacklist_request(sensor_id=sensor_id, + client.add_ssl_client_blacklist_request(sensor_id=sensor_id, # type: ignore[arg-type] application_name=application_name, ja3_hash=ja3_hash, comment=comment) @@ -1455,7 +1454,7 @@ def add_ssl_client_blacklist_command(client: Client, args: Dict[str, str]) -> Co return CommandResults(readable_output=readable_output) -def get_file_operation_blacklist_command(client: Client, args: Dict[str, str]) -> CommandResults: +def get_file_operation_blacklist_command(client: Client, args: dict[str, str]) -> CommandResults: """ Retrieves the file operation blacklist from the Industrial Threat Library of the specified Sensor. @@ -1470,11 +1469,11 @@ def get_file_operation_blacklist_command(client: Client, args: Dict[str, str]) - sensor_id = arg_to_number(args['sensor_id']) page, offset, limit = get_pagination_arguments(args) - response = client.get_file_operation_blacklist_request(sensor_id=sensor_id, + response = client.get_file_operation_blacklist_request(sensor_id=sensor_id, # type: ignore[arg-type] offset=offset, limit=limit) - outputs = deepcopy(response['results']) + outputs = deepcopy(response['results']) # type: ignore[call-overload] for entry in outputs: entry['sensor_id'] = sensor_id @@ -1493,7 +1492,7 @@ def get_file_operation_blacklist_command(client: Client, args: Dict[str, str]) - raw_response=response) -def add_file_operation_blacklist_command(client: Client, args: Dict[str, str]) -> CommandResults: +def add_file_operation_blacklist_command(client: Client, args: dict[str, str]) -> CommandResults: """ Adds entries to the file operation blacklist from the Industrial Threat Library of the specified Sensor. @@ -1511,7 +1510,7 @@ def add_file_operation_blacklist_command(client: Client, args: Dict[str, str]) - operation = args['operation'] comment = args.get('comment', '') - client.add_file_operation_blacklist_request(sensor_id=sensor_id, + client.add_file_operation_blacklist_request(sensor_id=sensor_id, # type: ignore[arg-type] matching_type=matching_type, file_or_folder=file_or_folder, operation=operation, @@ -1559,7 +1558,7 @@ def get_diagnostics_information_command(client: Client, *_) -> CommandResults: raw_response=response) -def get_diagnostic_logs_command(client: Client, args: Dict[str, str]) -> Dict[str, Any]: +def get_diagnostic_logs_command(client: Client, args: dict[str, str]) -> dict[str, Any]: """ Download the ZIP file which contains diagnostic logs of the Command Center. @@ -1581,7 +1580,7 @@ def get_diagnostic_logs_command(client: Client, args: Dict[str, str]) -> Dict[st file_type=EntryType.ENTRY_INFO_FILE) -def list_group_policies_command(client: Client, args: Dict[str, str]) -> CommandResults: +def list_group_policies_command(client: Client, args: dict[str, str]) -> CommandResults: """ Get all group policies. @@ -1596,7 +1595,7 @@ def list_group_policies_command(client: Client, args: Dict[str, str]) -> Command page, offset, limit = get_pagination_arguments(args) response = client.list_group_policies_request(offset=offset, limit=limit) - outputs = response['results'] + outputs = response['results'] # type: ignore[call-overload] readable_output = tableToMarkdown('Group Policies List:', outputs, @@ -1614,7 +1613,7 @@ def list_group_policies_command(client: Client, args: Dict[str, str]) -> Command ) -def create_group_policy_command(client: Client, args: Dict[str, str]) -> CommandResults: +def create_group_policy_command(client: Client, args: dict[str, str]) -> CommandResults: """ Create a group policy. @@ -1655,7 +1654,7 @@ def create_group_policy_command(client: Client, args: Dict[str, str]) -> Command raw_response=response) -def update_group_policy_command(client: Client, args: Dict[str, str]) -> CommandResults: +def update_group_policy_command(client: Client, args: dict[str, str]) -> CommandResults: """ Update a group policy. @@ -1672,7 +1671,7 @@ def update_group_policy_command(client: Client, args: Dict[str, str]) -> Command description = args['description'] constraints = argToList(args['constraints']) - response = client.update_group_policy_request(policy_id=policy_id, + response = client.update_group_policy_request(policy_id=policy_id, # type: ignore[arg-type] name=name, description=description, constraints=constraints) @@ -1700,7 +1699,7 @@ def update_group_policy_command(client: Client, args: Dict[str, str]) -> Command ) -def delete_group_policy_command(client: Client, args: Dict[str, str]) -> CommandResults: +def delete_group_policy_command(client: Client, args: dict[str, str]) -> CommandResults: """ Delete a group policy. @@ -1714,12 +1713,12 @@ def delete_group_policy_command(client: Client, args: Dict[str, str]) -> Command policy_id = arg_to_number(args['policy_id']) - client.delete_group_policy_request(policy_id=policy_id) + client.delete_group_policy_request(policy_id=policy_id) # type: ignore[arg-type] return CommandResults( readable_output=f'## The group policy {policy_id} was successfully deleted!') -def assign_group_policy_hosts_command(client: Client, args: Dict[str, str]) -> CommandResults: +def assign_group_policy_hosts_command(client: Client, args: dict[str, str]) -> CommandResults: """ Add all hosts not assigned to any policy (individual or group) matching the filter to the group policy. @@ -1735,7 +1734,7 @@ def assign_group_policy_hosts_command(client: Client, args: Dict[str, str]) -> C filter_type = args['filter_type'] filter_value = args['filter_value'] - response = client.assign_group_policy_hosts_request(policy_id=policy_id, + response = client.assign_group_policy_hosts_request(policy_id=policy_id, # type: ignore[arg-type] filter_type=filter_type, filter_value=filter_value) readable_output = f'## {response["count"]} Additional Hosts Were Assigned to Group Policy {policy_id}!' @@ -1743,7 +1742,7 @@ def assign_group_policy_hosts_command(client: Client, args: Dict[str, str]) -> C return CommandResults(readable_output=readable_output, raw_response=response) -def unassign_group_policy_hosts_command(client: Client, args: Dict[str, str]) -> CommandResults: +def unassign_group_policy_hosts_command(client: Client, args: dict[str, str]) -> CommandResults: """ Unassign all hosts assigned to the group policy matching the filter. @@ -1759,7 +1758,7 @@ def unassign_group_policy_hosts_command(client: Client, args: Dict[str, str]) -> filter_type = args['filter_type'] filter_value = args['filter_value'] - response = client.unassign_group_policy_hosts_request(policy_id=policy_id, + response = client.unassign_group_policy_hosts_request(policy_id=policy_id, # type: ignore[arg-type] filter_type=filter_type, filter_value=filter_value) readable_output = f'## {response["count"]} Additional Hosts Were Unassigned from Group Policy {policy_id}!' @@ -1767,7 +1766,7 @@ def unassign_group_policy_hosts_command(client: Client, args: Dict[str, str]) -> return CommandResults(readable_output=readable_output, raw_response=response) -def list_ip_reuse_domains_command(client: Client, args: Dict[str, str]) -> CommandResults: +def list_ip_reuse_domains_command(client: Client, args: dict[str, str]) -> CommandResults: """ Get all IP reuse domains. @@ -1782,7 +1781,7 @@ def list_ip_reuse_domains_command(client: Client, args: Dict[str, str]) -> Comma page, offset, limit = get_pagination_arguments(args) response = client.list_ip_reuse_domains_request(offset=offset, limit=limit) - outputs = response['results'] + outputs = response['results'] # type: ignore[call-overload] readable_output = tableToMarkdown('IP Reuse Domains List:', outputs, @@ -1798,7 +1797,7 @@ def list_ip_reuse_domains_command(client: Client, args: Dict[str, str]) -> Comma raw_response=response) -def list_hosts_changelog_command(client: Client, args: Dict[str, str]) -> CommandResults: +def list_hosts_changelog_command(client: Client, args: dict[str, str]) -> CommandResults: """ Retrieves information about the changes of host properties and configuration from the eyeInspect CC database. @@ -1824,7 +1823,7 @@ def list_hosts_changelog_command(client: Client, args: Dict[str, str]) -> Comman end_timestamp=end_timestamp, event_type_id=event_type_id, event_category=event_category) - outputs = response['results'] + outputs = response['results'] # type: ignore[call-overload] readable_output = tableToMarkdown( 'Hosts Changes List:', @@ -1872,7 +1871,7 @@ def test_module(client: Client, should_fetch: bool, first_fetch: str, max_fetch: def fetch_alerts(client: Client, last_time: datetime, max_fetch: int, - last_incident_id: int) -> List[Dict[str, Any]]: + last_incident_id: int) -> List[dict[str, Any]]: """ Fetches alerts with pagination. This is essential since the API might return earlier alerts @@ -1888,11 +1887,11 @@ def fetch_alerts(client: Client, last_time: datetime, max_fetch: int, List[Dict[str, Any]]: The new fetched alerts. """ - alerts = [] + alerts = [] # type: ignore[var-annotated] offset = 0 while max_fetch > 0: - results = client.list_alerts_request(offset=offset, + results = client.list_alerts_request(offset=offset, # type: ignore[union-attr,call-overload] limit=max_fetch, start_timestamp=last_time.isoformat())['results'] offset += len(results) @@ -1923,10 +1922,10 @@ def fetch_incidents(client: Client, first_fetch: str, max_fetch: int) -> None: validate_fetch_params(max_fetch=max_fetch, first_fetch=first_fetch) last_run = demisto.getLastRun() or {} - last_time = arg_to_datetime(last_run.get('time') or first_fetch).astimezone() + last_time = arg_to_datetime(last_run.get('time') or first_fetch).astimezone() # type: ignore[union-attr] last_incident_id = last_run.get('incident_id') - alerts = fetch_alerts(client, last_time, max_fetch, last_incident_id) + alerts = fetch_alerts(client, last_time, max_fetch, last_incident_id) # type: ignore[arg-type] add_alerts_fields(client, alerts) incidents = [] @@ -1957,7 +1956,7 @@ def main(): client = Client(server_url, username, password, use_ssl, use_proxy) max_fetch = arg_to_number(params.get('max_fetch', DEFAULT_FETCH_INCIDENTS)) - max_fetch = min(max_fetch, MAX_FETCH_INCIDENTS) + max_fetch = min(max_fetch, MAX_FETCH_INCIDENTS) # type: ignore[type-var] first_fetch = params.get('first_fetch', DEFAULT_FIRST_FETCH) commands = { @@ -1994,12 +1993,12 @@ def main(): command = demisto.command() if command == 'fetch-incidents': - fetch_incidents(client, first_fetch, max_fetch) + fetch_incidents(client, first_fetch, max_fetch) # type: ignore[arg-type] elif command == 'test-module': should_fetch = arg_to_boolean(params.get('isFetch')) - return_results(test_module(client, should_fetch, first_fetch, max_fetch)) + return_results(test_module(client, should_fetch, first_fetch, max_fetch)) # type: ignore[arg-type] elif command in commands: - return_results(commands[command](client, demisto.args())) + return_results(commands[command](client, demisto.args())) # type: ignore[operator] else: raise NotImplementedError(f'The command {command} does not exist!') except Exception as e: diff --git a/Packs/ForescoutEyeInspect/Integrations/ForescoutEyeInspect/ForescoutEyeInspect.yml b/Packs/ForescoutEyeInspect/Integrations/ForescoutEyeInspect/ForescoutEyeInspect.yml index 04ce7065411..8a9eed3dc7f 100644 --- a/Packs/ForescoutEyeInspect/Integrations/ForescoutEyeInspect/ForescoutEyeInspect.yml +++ b/Packs/ForescoutEyeInspect/Integrations/ForescoutEyeInspect/ForescoutEyeInspect.yml @@ -1113,7 +1113,7 @@ script: - contextPath: ForescoutEyeInspect.HostChangeLog.host_mac_addresses description: The MAC addresses associated to the host. type: String - dockerimage: demisto/python3:3.10.13.87159 + dockerimage: demisto/python3:3.11.9.105369 isfetch: true runonce: false script: "-" diff --git a/Packs/ForescoutEyeInspect/ReleaseNotes/1_0_22.md b/Packs/ForescoutEyeInspect/ReleaseNotes/1_0_22.md new file mode 100644 index 00000000000..30d65c742e9 --- /dev/null +++ b/Packs/ForescoutEyeInspect/ReleaseNotes/1_0_22.md @@ -0,0 +1,6 @@ + +#### Integrations + +##### Forescout EyeInspect + +- Maintenance and stability enhancements. diff --git a/Packs/ForescoutEyeInspect/pack_metadata.json b/Packs/ForescoutEyeInspect/pack_metadata.json index 550b2fa3c6b..0f194fae75c 100644 --- a/Packs/ForescoutEyeInspect/pack_metadata.json +++ b/Packs/ForescoutEyeInspect/pack_metadata.json @@ -2,7 +2,7 @@ "name": "Forescout EyeInspect", "description": "Get in-depth device visibility for OT networks", "support": "xsoar", - "currentVersion": "1.0.21", + "currentVersion": "1.0.22", "author": "Cortex XSOAR", "url": "https://www.paloaltonetworks.com/cortex", "email": "", diff --git a/Packs/FortiSIEM/Integrations/FortiSIEMV2/FortiSIEMV2.py b/Packs/FortiSIEM/Integrations/FortiSIEMV2/FortiSIEMV2.py index b6509a19ef4..68108526d02 100644 --- a/Packs/FortiSIEM/Integrations/FortiSIEMV2/FortiSIEMV2.py +++ b/Packs/FortiSIEM/Integrations/FortiSIEMV2/FortiSIEMV2.py @@ -1,7 +1,6 @@ import demistomock as demisto # noqa: F401 from CommonServerPython import * # noqa: F401 -# type: ignore -# mypy: ignore-errors + import json import re from collections.abc import Callable @@ -128,8 +127,8 @@ def cmdb_devices_list_request(self, include_ip_list: list, exclude_ip_list: list Returns: Dict[str,Any]: API response from FortiSIEM. """ - include_ip_set = build_ip_set([include_ip_list, include_ip_range]) - exclude_ip_set = build_ip_set([exclude_ip_list, exclude_ip_rage]) + include_ip_set = build_ip_set([include_ip_list, include_ip_range]) # type: ignore[list-item] + exclude_ip_set = build_ip_set([exclude_ip_list, exclude_ip_rage]) # type: ignore[list-item] params = assign_params(includeIps=include_ip_set, excludeIps=exclude_ip_set) @@ -425,7 +424,7 @@ def search_events_with_polling_command(client: FortiSIEMClient, args: dict[str, """ ScheduledCommand.raise_error_if_not_supported() interval_in_secs = arg_to_number(args.get('interval_in_seconds', '10')) - if interval_in_secs < 10: + if interval_in_secs < 10: # type: ignore[operator] raise ValueError( "The minimum time to wait between command execution when 'polling' should be at least 10 seconds.") timeout = arg_to_number(args.get('timeout_in_seconds', '60')) @@ -442,7 +441,7 @@ def search_events_with_polling_command(client: FortiSIEMClient, args: dict[str, # schedule first poll scheduled_command = ScheduledCommand( command=cmd, - next_run_in_seconds=interval_in_secs, + next_run_in_seconds=interval_in_secs, # type: ignore[arg-type] args=polling_args, timeout_in_seconds=timeout) command_results.scheduled_command = scheduled_command @@ -459,7 +458,7 @@ def search_events_with_polling_command(client: FortiSIEMClient, args: dict[str, } scheduled_command = ScheduledCommand( command=cmd, - next_run_in_seconds=interval_in_secs, + next_run_in_seconds=interval_in_secs, # type: ignore[arg-type] args=polling_args, timeout_in_seconds=timeout) command_results = CommandResults(scheduled_command=scheduled_command) @@ -478,13 +477,13 @@ def events_search_init_command(client: FortiSIEMClient, args: dict[str, Any]) -> Returns: CommandResults: Command results with raw response, outputs and readable outputs. """ - from_time = convert_date_to_timestamp(arg_to_datetime(args['from_time'])) - to_time = convert_date_to_timestamp(arg_to_datetime(args['to_time'])) + from_time = convert_date_to_timestamp(arg_to_datetime(args['from_time'])) # type: ignore[arg-type] + to_time = convert_date_to_timestamp(arg_to_datetime(args['to_time'])) # type: ignore[arg-type] query = args.get('query') extend_data = argToBoolean(args.get('extended_data', False)) events_constraint = query or build_constraint_from_args(copy.deepcopy(args)) - payload = build_query_xml(events_constraint, from_time, to_time, extend_data) - response = client.events_search_init_request(payload.decode('utf-8')) + payload = build_query_xml(events_constraint, from_time, to_time, extend_data) # type: ignore[arg-type] + response = client.events_search_init_request(payload.decode('utf-8')) # type: ignore[attr-defined] if " validate_ip_address(include_ip_list, exclude_ip_list) validate_ip_ranges(include_ip_range, exclude_ip_range) - response = client.cmdb_devices_list_request(include_ip_list, exclude_ip_list, include_ip_range, exclude_ip_range) - outputs, total_pages = format_list_commands_output(response, ['devices', 'device'], page, limit) - header = format_readable_output_header('List CMDB devices', limit, page, total_pages) + response = client.cmdb_devices_list_request(include_ip_list, exclude_ip_list, # type: ignore[arg-type] + include_ip_range, exclude_ip_range) # type: ignore[arg-type] + outputs, total_pages = format_list_commands_output(response, ['devices', 'device'], page, limit) # type: ignore[arg-type] + header = format_readable_output_header('List CMDB devices', limit, page, total_pages) # type: ignore[arg-type] readable_output = tableToMarkdown(header, outputs, headers=['name', 'accessIp', 'approved', 'unmanaged', 'deviceType'], @@ -616,7 +617,7 @@ def cmdb_device_get_command(client: FortiSIEMClient, args: dict[str, Any]) -> Li try: validate_ip_address(ip_address) response = client.cmdb_device_get_request(ip_address) - outputs = format_outputs_time_attributes_to_iso(copy.deepcopy(response.get('device'))) + outputs = format_outputs_time_attributes_to_iso(copy.deepcopy(response.get('device'))) # type: ignore[arg-type] readable_output = tableToMarkdown(f'CMDB device {ip_address}', outputs, headers=['name', 'accessIp', 'approved', 'unmanaged', 'deviceType', 'discoverTime', 'discoverMethod'], @@ -650,10 +651,11 @@ def monitored_organizations_list_command(client: FortiSIEMClient, args: dict[str limit = arg_to_number(args.get('limit', DEFAULT_LIMIT)) page = arg_to_number(args.get('page', DEFAULT_PAGE)) response = client.monitored_organizations_list_request() - outputs, total_pages_number = format_organizations_output(response, page, limit) + outputs, total_pages_number = format_organizations_output(response, page, limit) # type: ignore[arg-type] readable_output = tableToMarkdown( - format_readable_output_header('List Monitored Organizations', limit, page, total_pages_number), outputs, + format_readable_output_header('List Monitored Organizations', limit, page, # type: ignore[arg-type] + total_pages_number), outputs, # type: ignore[arg-type] headers=['domainId', 'name', 'custId', 'creationTime', 'lastModified', 'disabled'], headerTransform=pascalToSpace) command_results = CommandResults( @@ -688,8 +690,15 @@ def incident_update_command(client: FortiSIEMClient, args: dict[str, Any]) -> Co external_ticket_state = args.get('external_ticket_state') external_assigned_user = args.get('external_assigned_user') - response = client.incident_update_request(incident_id, comments, incident_status, external_ticket_type, - external_ticket_id, external_ticket_state, external_assigned_user) + response = client.incident_update_request( + incident_id, + comments, # type: ignore[arg-type] + incident_status, # type: ignore[arg-type] + external_ticket_type, # type: ignore[arg-type] + external_ticket_id, # type: ignore[arg-type] + external_ticket_state, # type: ignore[arg-type] + external_assigned_user # type: ignore[arg-type] + ) command_results = CommandResults(readable_output=format_update_incident_readable_output(incident_id, response)) return command_results @@ -708,10 +717,10 @@ def events_list_command(client: FortiSIEMClient, args: dict[str, Any]) -> Comman limit = arg_to_number(args.get('limit', DEFAULT_LIMIT)) page = arg_to_number(args.get('page', DEFAULT_PAGE)) incident_id = args['incident_id'] - response = client.events_list_request(limit * page, incident_id) - outputs = format_list_events_output(response, incident_id, page, limit) + response = client.events_list_request(limit * page, incident_id) # type: ignore[operator] + outputs = format_list_events_output(response, incident_id, page, limit) # type: ignore[arg-type] readable_output = tableToMarkdown( - format_readable_output_header(f'List Events for incident ID {incident_id}', limit, page), + format_readable_output_header(f'List Events for incident ID {incident_id}', limit, page), # type: ignore[arg-type] get_list_events_readable_output(outputs), headers=["eventID", "eventReceiveTime", "eventType", "message", "sourceIP", "destinationIP", "hostName", "hostIp", "user", "fileName", "command", "filePath", "SHA256Hash", "MD5Hash", "rawEventLog" @@ -746,7 +755,7 @@ def watchlist_list_command(client: FortiSIEMClient, args: dict[str, Any]) -> Com response = client.watchlist_list_all() outputs, total_pages = format_watchlist_output(response, page=page, limit=limit) readable_outputs = tableToMarkdown( - format_readable_output_header('List Watchlist Groups', limit, page, total_pages), + format_readable_output_header('List Watchlist Groups', limit, page, total_pages), # type: ignore[arg-type] outputs, headers=['id', 'name', 'displayName', 'description', 'valueType'], headerTransform=pascalToSpace) command_results = CommandResults( @@ -849,22 +858,22 @@ def watchlist_add_command(client: FortiSIEMClient, args: dict[str, Any]) -> Comm is_case_sensitive = argToBoolean(args.get('is_case_sensitive')) data_creation_type = args.get('data_creation_type') value_type = args.get('value_type') - age_out = datetime_to_age_out_in_days(arg_to_datetime(args.get('age_out'))) + age_out = datetime_to_age_out_in_days(arg_to_datetime(args.get('age_out'))) # type: ignore[arg-type] inclusive = argToBoolean(args.get('entry_inclusive')) entry_value = args.get('entry_value') - entry_age_out = datetime_to_age_out_in_days(arg_to_datetime(args.get('entry_age_out'))) + entry_age_out = datetime_to_age_out_in_days(arg_to_datetime(args.get('entry_age_out'))) # type: ignore[arg-type] count = args.get('entry_count') - first_seen = convert_date_to_timestamp(arg_to_datetime(args.get('entry_first_seen'))) - last_seen = convert_date_to_timestamp(arg_to_datetime(args.get('entry_last_seen'))) + first_seen = convert_date_to_timestamp(arg_to_datetime(args.get('entry_first_seen'))) # type: ignore[arg-type] + last_seen = convert_date_to_timestamp(arg_to_datetime(args.get('entry_last_seen'))) # type: ignore[arg-type] triggering_rules = args.get('triggering_rules') - validate_add_watchlist_args(first_seen, last_seen) - response = client.watchlist_add_request(display_name, description, is_case_sensitive, - data_creation_type, - value_type, age_out, inclusive, - entry_value, - entry_age_out, count, first_seen, last_seen, - triggering_rules) + validate_add_watchlist_args(first_seen, last_seen) # type: ignore[arg-type] + response = client.watchlist_add_request(display_name, description, is_case_sensitive, # type: ignore[arg-type] + data_creation_type, # type: ignore[arg-type] + value_type, age_out, inclusive, # type: ignore[arg-type] + entry_value, # type: ignore[arg-type] + entry_age_out, count, first_seen, last_seen, # type: ignore[arg-type] + triggering_rules) # type: ignore[arg-type] output, _ = format_watchlist_output(response, f"The Watchlist group: {display_name} " @@ -898,19 +907,19 @@ def watchlist_entry_add_command(client: FortiSIEMClient, args: dict[str, Any]) - count = arg_to_number(args.get('count')) triggering_rules = args.get('triggering_rules') value = args.get('value') - age_out = datetime_to_age_out_in_days(arg_to_datetime(args.get('age_out'))) - first_seen = convert_date_to_timestamp(arg_to_datetime(args.get('first_seen'))) - last_seen = convert_date_to_timestamp(arg_to_datetime(args.get('last_seen'))) + age_out = datetime_to_age_out_in_days(arg_to_datetime(args.get('age_out'))) # type: ignore[arg-type] + first_seen = convert_date_to_timestamp(arg_to_datetime(args.get('first_seen'))) # type: ignore[arg-type] + last_seen = convert_date_to_timestamp(arg_to_datetime(args.get('last_seen'))) # type: ignore[arg-type] data_creation_type = args.get('data_creation_type') description = args.get('description') - validate_add_watchlist_args(first_seen, last_seen) + validate_add_watchlist_args(first_seen, last_seen) # type: ignore[arg-type] disable_age_out = not age_out - response = client.watchlist_entry_add_request(watchlist_id, value, inclusive, count, - triggering_rules, - age_out, last_seen, first_seen, - data_creation_type, description, disable_age_out) + response = client.watchlist_entry_add_request(watchlist_id, value, inclusive, count, # type: ignore[arg-type] + triggering_rules, # type: ignore[arg-type] + age_out, last_seen, first_seen, # type: ignore[arg-type] + data_creation_type, description, disable_age_out) # type: ignore[arg-type] command_results = CommandResults( - readable_output=format_add_watchlist_entry_message(watchlist_id, value, response) + readable_output=format_add_watchlist_entry_message(watchlist_id, value, response) # type: ignore[arg-type] ) return command_results @@ -931,15 +940,15 @@ def watchlist_entry_update_command(client: FortiSIEMClient, args: dict[str, Any] count = arg_to_number(args.get('count')) triggering_rules = args.get('triggering_rules') value = args.get('value') - age_out = datetime_to_age_out_in_days(arg_to_datetime(args.get('age_out'))) - first_seen = convert_date_to_timestamp(arg_to_datetime(args.get('first_seen'))) - last_seen = convert_date_to_timestamp(arg_to_datetime(args.get('last_seen'))) - expiry_time = convert_date_to_timestamp(arg_to_datetime(args.get('expired_time'))) + age_out = datetime_to_age_out_in_days(arg_to_datetime(args.get('age_out'))) # type: ignore[arg-type] + first_seen = convert_date_to_timestamp(arg_to_datetime(args.get('first_seen'))) # type: ignore[arg-type] + last_seen = convert_date_to_timestamp(arg_to_datetime(args.get('last_seen'))) # type: ignore[arg-type] + expiry_time = convert_date_to_timestamp(arg_to_datetime(args.get('expired_time'))) # type: ignore[arg-type] data_creation_type = args.get('data_creation_type') description = args.get('description') - validate_add_watchlist_args(first_seen, last_seen) + validate_add_watchlist_args(first_seen, last_seen) # type: ignore[arg-type] - response = client.watchlist_entry_update_request(entry_id, value, inclusive=inclusive, count=count, + response = client.watchlist_entry_update_request(entry_id, value, inclusive=inclusive, count=count, # type: ignore[arg-type] description=description, triggeringRules=triggering_rules, ageOut=age_out, firstSeen=first_seen, lastSeen=last_seen, expiredTime=expiry_time, @@ -1128,10 +1137,10 @@ def watchlist_entry_get_command(client: FortiSIEMClient, args: dict[str, Any]) - ) command_results_list.append(command_results) except Exception as error: - error = CommandResults( + error = CommandResults( # type: ignore[assignment] readable_output=f'**{error}**' ) - command_results_list.append(error) + command_results_list.append(error) # type: ignore[arg-type] return command_results_list @@ -1424,7 +1433,7 @@ def format_watchlist_output(response: dict[str, Any], failure_message: str = Non message = failure_message or response_content raise ValueError(message) - outputs, total_results = format_list_commands_output(response_content, [], page or 1, limit or 1) + outputs, total_results = format_list_commands_output(response_content, [], page or 1, limit or 1) # type: ignore[arg-type] for watchlist in outputs: if watchlist.get('entries'): watchlist['entries'] = format_outputs_time_attributes_to_iso(watchlist['entries']) @@ -1443,7 +1452,7 @@ def format_message_delete_watchlist(watchlist_id: int, response: dict[str, Any]) status = response.get('status') message = response.get('response') if status == 'Success': - deleted_count = int(message.split(": ")[1]) + deleted_count = int(message.split(": ")[1]) # type: ignore[union-attr] if deleted_count >= 1: return f'The watchlist {watchlist_id} was deleted successfully.' raise ValueError(f'Failed to delete Watchlist group: {watchlist_id}.') @@ -1461,7 +1470,7 @@ def format_message_delete_entry(entry_id: int, response: dict[str, Any]) -> str: status = response.get('status') message = response.get('response') if status == 'Success': - deleted_count = int(message.split("- ")[1]) + deleted_count = int(message.split("- ")[1]) # type: ignore[union-attr] if deleted_count >= 1: return f'The entry {entry_id} were deleted successfully.' raise ValueError(f'Failed to delete entry {entry_id}.') @@ -1547,7 +1556,7 @@ def fetch_relevant_incidents(client: FortiSIEMClient, List[dict]: Relevant incidents. """ demisto.debug(f'Fetch incident from: {str(time_from)} to {str(time_to)}') - filtered_incidents = [] + filtered_incidents = [] # type: ignore[var-annotated] start_index = last_run.get('start_index') or 0 last_incident_create_time = last_run.get('create_time') or time_from last_fetch_incidents: List[int] = last_run.get('last_incidents') or [] @@ -1558,13 +1567,13 @@ def fetch_relevant_incidents(client: FortiSIEMClient, total = response.get('total') demisto.debug(f'Got: {total} total incidents.') # filtering & pagination - while len(filtered_incidents) < max_fetch and start_index < total: - for incident in incidents: + while len(filtered_incidents) < max_fetch and start_index < total: # type: ignore[operator] + for incident in incidents: # type: ignore[union-attr] if incident.get('incidentId') not in last_fetch_incidents and \ len(filtered_incidents) < max_fetch and \ incident.get('incidentFirstSeen') >= last_incident_create_time: filtered_incidents.append(incident) - if len(incidents) < page_size: # last page + if len(incidents) < page_size: # type: ignore[arg-type] break start_index += page_size @@ -1585,7 +1594,8 @@ def format_incidents(relevant_incidents: List[dict]) -> List[dict]: List[dict]: Formatted incidents. """ for incident in relevant_incidents: - incident['normalizedEventSeverity'] = INCIDENT_EVENT_CATEGORY_MAPPING.get(incident.get('eventSeverityCat'), 0.5) + incident['normalizedEventSeverity'] = INCIDENT_EVENT_CATEGORY_MAPPING.get( + incident.get('eventSeverityCat'), 0.5) # type: ignore[arg-type] format_integer_field_to_verbal(incident) # formatting integer attributes. for attribute_name in REFORMAT_INCIDENT_FIELDS: # formatting nested attributes. @@ -1602,7 +1612,7 @@ def format_incidents(relevant_incidents: List[dict]) -> List[dict]: return relevant_incidents -def format_nested_incident_attribute(attribute_value: str | None) -> tuple: +def format_nested_incident_attribute(attribute_value: str | None) -> tuple: # type: ignore[return] """ Format nested attributes to be readable. For example: for the attribute_value "srcIpAddr:192.168.1.1,", @@ -1664,7 +1674,7 @@ def get_mapping_for_verbal_incident_attrib(field_name: str) -> tuple: 'incidentReso': (INCIDENT_RESOLUTION_INT_VERBAL_MAPPING, 'None'), 'phIncidentCategory': (INCIDENT_CATEGORY_INT_VERBAL_MAPPING, 'AVAILABILITY') } - return routing.get(field_name) + return routing.get(field_name) # type: ignore[return-value] def build_readable_attribute_key(key: str, attribute_name: str): @@ -1770,18 +1780,18 @@ def get_list_events_readable_output(outputs: List[dict]) -> List[dict]: "eventReceiveTime": event.get('receiveTime'), "eventID": event.get('id'), "eventType": event.get('eventType'), - "message": attributes.get('rawMessage') or event.get('msg'), - "sourceIP": attributes.get("Source IP") or attributes.get('srcIpAddr'), - "destinationIP": attributes.get("Destination IP") or attributes.get('destIpAddr'), - "hostName": attributes.get("Host Name") or attributes.get('hostName'), - "hostIp": attributes.get("Host IP") or attributes.get('hostIpAddr'), - "user": attributes.get("User") or attributes.get('user'), - "fileName": attributes.get("File Name") or attributes.get('fileName'), - "command": attributes.get("Command") or attributes.get('command'), - "filePath": attributes.get("File Path") or attributes.get('filePath'), - "SHA256Hash": attributes.get("SHA256 Hash") or attributes.get('hashSHA256'), - "MD5Hash": attributes.get("MD5 Hash") or attributes.get('hashMD5'), - "rawEventLog": attributes.get("Raw Event Log") or attributes.get('rawEventMsg'), + "message": attributes.get('rawMessage') or event.get('msg'), # type: ignore[union-attr] + "sourceIP": attributes.get("Source IP") or attributes.get('srcIpAddr'), # type: ignore[union-attr] + "destinationIP": attributes.get("Destination IP") or attributes.get('destIpAddr'), # type: ignore[union-attr] + "hostName": attributes.get("Host Name") or attributes.get('hostName'), # type: ignore[union-attr] + "hostIp": attributes.get("Host IP") or attributes.get('hostIpAddr'), # type: ignore[union-attr] + "user": attributes.get("User") or attributes.get('user'), # type: ignore[union-attr] + "fileName": attributes.get("File Name") or attributes.get('fileName'), # type: ignore[union-attr] + "command": attributes.get("Command") or attributes.get('command'), # type: ignore[union-attr] + "filePath": attributes.get("File Path") or attributes.get('filePath'), # type: ignore[union-attr] + "SHA256Hash": attributes.get("SHA256 Hash") or attributes.get('hashSHA256'), # type: ignore[union-attr] + "MD5Hash": attributes.get("MD5 Hash") or attributes.get('hashMD5'), # type: ignore[union-attr] + "rawEventLog": attributes.get("Raw Event Log") or attributes.get('rawEventMsg'), # type: ignore[union-attr] }) return readable_outputs @@ -1799,7 +1809,7 @@ def datetime_to_age_out_in_days(age_out_date: datetime) -> str: delta = now - age_out_date days = delta.days # interested in interval only. return f'{days}d' - return None + return None # type: ignore[return-value] def update_last_run_obj(last_run: dict[str, Any], formatted_incidents: List[dict]): @@ -1834,13 +1844,13 @@ def main() -> None: fetch_with_events = params.get('fetch_mode') == 'Fetch With Events' max_events_fetch = arg_to_number(params.get('max_events_fetch', DEFAULT_EVENTS_FETCH)) status_filter_list = argToList(params.get('status')) - headers = {} + headers = {} # type: ignore[var-annotated] command = demisto.command() demisto.debug(f'Command being called is {command}') try: - requests.packages.urllib3.disable_warnings() + requests.packages.urllib3.disable_warnings() # type: ignore[attr-defined] client: FortiSIEMClient = FortiSIEMClient(urljoin(url, ''), verify_certificate, proxy, headers=headers, auth=(f'super/{username}', password)) @@ -1879,10 +1889,10 @@ def main() -> None: status_filter_list) elif command == 'fetch-incidents': - incidents, last_run = fetch_incidents(client, max_fetch, - first_fetch, + incidents, last_run = fetch_incidents(client, max_fetch, # type: ignore[arg-type] + first_fetch, # type: ignore[arg-type] status_filter_list, fetch_with_events, - max_events_fetch, demisto.getLastRun()) + max_events_fetch, demisto.getLastRun()) # type: ignore[arg-type] demisto.setLastRun(last_run) demisto.incidents(incidents) diff --git a/Packs/FortiSIEM/Integrations/FortiSIEMV2/FortiSIEMV2.yml b/Packs/FortiSIEM/Integrations/FortiSIEMV2/FortiSIEMV2.yml index ea88574e661..6683f4c286f 100644 --- a/Packs/FortiSIEM/Integrations/FortiSIEMV2/FortiSIEMV2.yml +++ b/Packs/FortiSIEM/Integrations/FortiSIEMV2/FortiSIEMV2.yml @@ -701,7 +701,7 @@ script: - contextPath: FortiSIEM.WatchlistEntry.ageOut description: Expiration date of the entry. type: String - dockerimage: demisto/python3:3.10.14.91134 + dockerimage: demisto/python3:3.11.9.105369 isfetch: true runonce: false script: '-' diff --git a/Packs/FortiSIEM/ReleaseNotes/2_0_36.md b/Packs/FortiSIEM/ReleaseNotes/2_0_36.md new file mode 100644 index 00000000000..877d28c03ed --- /dev/null +++ b/Packs/FortiSIEM/ReleaseNotes/2_0_36.md @@ -0,0 +1,6 @@ + +#### Integrations + +##### FortiSIEM v2 + +- Maintenance and stability enhancements. diff --git a/Packs/FortiSIEM/pack_metadata.json b/Packs/FortiSIEM/pack_metadata.json index fb0d7a71c02..dd0ae5393e0 100644 --- a/Packs/FortiSIEM/pack_metadata.json +++ b/Packs/FortiSIEM/pack_metadata.json @@ -2,7 +2,7 @@ "name": "FortiSIEM", "description": "Search and update events of FortiSIEM and manage resource lists.", "support": "xsoar", - "currentVersion": "2.0.35", + "currentVersion": "2.0.36", "author": "Cortex XSOAR", "url": "https://www.paloaltonetworks.com/cortex", "email": "", diff --git a/Packs/GCP-IAM/Integrations/GCPIAM/GCPIAM.py b/Packs/GCP-IAM/Integrations/GCPIAM/GCPIAM.py index bb96aa0fae6..4aa612cc8ec 100644 --- a/Packs/GCP-IAM/Integrations/GCPIAM/GCPIAM.py +++ b/Packs/GCP-IAM/Integrations/GCPIAM/GCPIAM.py @@ -1,6 +1,6 @@ import demistomock as demisto # noqa: F401 from CommonServerPython import * # noqa: F401 -# type: ignore + # pylint: disable=no-member import copy from collections.abc import Callable diff --git a/Packs/GCP-IAM/Integrations/GCPIAM/GCPIAM.yml b/Packs/GCP-IAM/Integrations/GCPIAM/GCPIAM.yml index 07b805a5231..ddd807243bf 100644 --- a/Packs/GCP-IAM/Integrations/GCPIAM/GCPIAM.yml +++ b/Packs/GCP-IAM/Integrations/GCPIAM/GCPIAM.yml @@ -1250,7 +1250,7 @@ script: description: Create a short-lived access token for a service account. The generated token will be exposed to the context menu and War Room, and can potentially be logged. execution: true name: gcp-iam-service-account-generate-access-token - dockerimage: demisto/google-api-py3:1.0.0.78763 + dockerimage: demisto/google-api-py3:1.0.0.105788 runonce: false script: '-' subtype: python3 diff --git a/Packs/GCP-IAM/ReleaseNotes/1_0_26.md b/Packs/GCP-IAM/ReleaseNotes/1_0_26.md new file mode 100644 index 00000000000..8e9cc08ca84 --- /dev/null +++ b/Packs/GCP-IAM/ReleaseNotes/1_0_26.md @@ -0,0 +1,6 @@ + +#### Integrations + +##### GCP-IAM + +- Maintenance and stability enhancements. diff --git a/Packs/GCP-IAM/pack_metadata.json b/Packs/GCP-IAM/pack_metadata.json index 2ff989a7b7b..70b342e90e0 100644 --- a/Packs/GCP-IAM/pack_metadata.json +++ b/Packs/GCP-IAM/pack_metadata.json @@ -2,7 +2,7 @@ "name": "GCP IAM", "description": "Manage identity and access control for Google Cloud Platform resources.", "support": "xsoar", - "currentVersion": "1.0.25", + "currentVersion": "1.0.26", "author": "Cortex XSOAR", "url": "https://www.paloaltonetworks.com/cortex", "email": "", diff --git a/Packs/IronDefense/Integrations/IronDefense/IronDefense_test.py b/Packs/IronDefense/Integrations/IronDefense/IronDefense_test.py index 8ec90ffd890..3230de30d30 100644 --- a/Packs/IronDefense/Integrations/IronDefense/IronDefense_test.py +++ b/Packs/IronDefense/Integrations/IronDefense/IronDefense_test.py @@ -1,4 +1,3 @@ -# type: ignore import json import unittest import demistomock as demisto @@ -7,7 +6,6 @@ from unittest import TestCase, mock from unittest.mock import Mock, call import requests -from typing import Dict from http.client import HTTPException requests.packages.urllib3.disable_warnings() @@ -53,17 +51,16 @@ def test_get_jwt(self): test_context = { 'JWT': test_jwt } - self.assertEqual(test_jwt, self.class_under_test._get_jwt(test_context), 'Unexpected result') - self.assertEqual(None, self.class_under_test._get_jwt(None), 'None context should return None') - self.assertEqual(None, self.class_under_test._get_jwt({'bogus': 'context'}), - 'Missing jwt in context should return None') + assert test_jwt == self.class_under_test._get_jwt(test_context), 'Unexpected result' + assert None is self.class_under_test._get_jwt(None), 'None context should return None' + assert None is self.class_under_test._get_jwt({'bogus': 'context'}), 'Missing jwt in context should return None' def test_configure_session_auth(self): self.mock_session.headers = {} # test no jwt token self.class_under_test._configure_session_auth({}) - self.assertIsNone(self.mock_session.headers.get('authentication', None)) + assert self.mock_session.headers.get('authentication', None) is None # test loading jwt token test_jwt = 'jwt token' @@ -71,19 +68,19 @@ def test_configure_session_auth(self): 'JWT': test_jwt } self.class_under_test._configure_session_auth(test_context) - self.assertEqual('Bearer ' + test_jwt, self.mock_session.headers.get('Authorization')) + assert 'Bearer ' + test_jwt == self.mock_session.headers.get('Authorization') @mock.patch('requests.Response', autospec=True) def test_http_request(self, MockResponse): MockResponse.return_value.headers = {} method = 'GET' uri = '/something' - headers: Dict[str, str] = {} + headers: dict[str, str] = {} data = '{}' - params: Dict[str, str] = {} + params: dict[str, str] = {} files = None mock_jwt_value = 'jwt token' - expected_uri = 'https://{}:{}{}{}'.format(self.host, self.port, self.url_prefix, uri) + expected_uri = f'https://{self.host}:{self.port}{self.url_prefix}{uri}' '''Test successful response''' mock_response = MockResponse() @@ -94,7 +91,7 @@ def test_http_request(self, MockResponse): self.mock_session.request.assert_called_with(method, expected_uri, headers=headers, data=data, params=params, files=files, timeout=self.class_under_test.request_timeout, auth=None, verify=False) - self.assertEqual(test_response, mock_response) + assert test_response == mock_response '''Test incorrect creds''' mock_response = MockResponse() @@ -107,7 +104,7 @@ def test_http_request(self, MockResponse): auth=( self.credentials['identifier'], self.credentials['password']), verify=False) - self.assertEqual(test_response, mock_response) + assert test_response == mock_response '''Test expired jwt''' self.mock_session.request.reset_mock() @@ -142,10 +139,9 @@ def side_effect(self, *args, **kwargs): auth=(self.credentials['identifier'], self.credentials['password']), verify=False) ]) # check to see if the jwt was stored - self.assertDictEqual({'JWT': mock_jwt_value}, demisto.getIntegrationContext(), 'JWT value should be the same ' - 'as the stored value.') - self.assertEqual(200, test_response.status_code, 'Unexpected status code') - self.assertEqual(2, self.mock_session.request.call_count, '_http_request should have made 2 calls') + assert {'JWT': mock_jwt_value} == demisto.getIntegrationContext() + assert test_response.status_code == 200, 'Unexpected status code' + assert self.mock_session.request.call_count == 2, '_http_request should have made 2 calls' '''Test 5xx response''' self.mock_session.request.reset_mock() @@ -160,7 +156,7 @@ def side_effect(self, *args, **kwargs): self.mock_session.request.assert_called_with(method, expected_uri, headers=headers, data=data, params=params, files=files, timeout=self.class_under_test.request_timeout, auth=None, verify=False) - self.assertEqual(test_response, mock_response) + assert test_response == mock_response @mock.patch('requests.Response', autospec=True) def test_test_module(self, MockResponse): @@ -178,7 +174,7 @@ def test_test_module(self, MockResponse): auth=(self.credentials['identifier'], self.credentials[ 'password']), verify=False) - self.assertEqual('ok', result, 'Result should be "ok"') + assert result == 'ok', 'Result should be "ok"' # test failed response error_json = { @@ -197,7 +193,7 @@ def test_test_module(self, MockResponse): auth=(self.credentials['identifier'], self.credentials[ 'password']), verify=False) - self.assertNotEqual('ok', result, 'Result should have an error message') + assert result != 'ok', 'Result should have an error message' @mock.patch('requests.Response', autospec=True) def test_update_analyst_ratings(self, MockResponse): @@ -765,7 +761,7 @@ def test_fetch_alert_incidents_filtering(self, MockResponse): result = [init_result[0]["rawJSON"], init_result[1]["rawJSON"], init_result[2]["rawJSON"], init_result[3]["rawJSON"]] - self.assertEqual(expected_resp_data, result) + assert expected_resp_data == result # Test default filtering on Alert Notifications @mock.patch('requests.Response', autospec=True) @@ -814,7 +810,7 @@ def test_fetch_alert_incidents_action_default(self, MockResponse): init_result[3]["rawJSON"], init_result[4]["rawJSON"], init_result[5]["rawJSON"], init_result[6]["rawJSON"]] - self.assertEqual(expected_resp_data, result) + assert expected_resp_data == result # Mock Json Data for fetch_event_incidents() def mock_fetch_event_incidents_data(self): @@ -985,7 +981,7 @@ def test_fetch_event_incidents_filtering(self, MockResponse): result = [init_result[0]["rawJSON"], init_result[1]["rawJSON"], init_result[2]["rawJSON"], init_result[3]["rawJSON"]] - self.assertEqual(expected_resp_data, result) + assert expected_resp_data == result # Test default filtering on Event Notifications @mock.patch('requests.Response', autospec=True) @@ -1034,7 +1030,7 @@ def test_fetch_event_incidents_action_default(self, MockResponse): init_result[3]["rawJSON"], init_result[4]["rawJSON"], init_result[5]["rawJSON"], init_result[6]["rawJSON"]] - self.assertEqual(expected_resp_data, result) + assert expected_resp_data == result @mock.patch('requests.Response', autospec=True) def test_get_alert_irondome_information(self, MockResponse): @@ -1084,12 +1080,12 @@ def test_get_error_msg_from_response(self, MockResponse): mock_response.json.return_value = error_json error_msg = self.class_under_test._get_error_msg_from_response(mock_response) - self.assertEqual(expected_error_msg, error_msg, 'Error message was not properly extracted') + assert expected_error_msg == error_msg, 'Error message was not properly extracted' mock_response.json.return_value = {} mock_response.text = expected_error_msg error_msg = self.class_under_test._get_error_msg_from_response(mock_response) - self.assertEqual(expected_error_msg, error_msg, 'Error message was not properly extracted') + assert expected_error_msg == error_msg, 'Error message was not properly extracted' @mock.patch('IronDefense.demisto') def test_test_module_command(self, mock_demisto): @@ -1125,6 +1121,7 @@ def getArg_side_effect(arg): return expected_severity if arg == 'expectation': return expected_expectation + return None mock_demisto.getArg.side_effect = getArg_side_effect @@ -1153,6 +1150,7 @@ def getArg_side_effect(arg): return expected_comment if arg == 'share_comment_with_irondome': return 'true' + return None mock_demisto.getArg.side_effect = getArg_side_effect @@ -1182,6 +1180,7 @@ def getArg_side_effect(arg): return 'true' if arg == 'status': return expected_status + return None mock_demisto.getArg.side_effect = getArg_side_effect @@ -1219,6 +1218,7 @@ def getArg_side_effect(arg): return expected_activity_start_time if arg == 'activity_end_time': return expected_activity_end_time + return None mock_demisto.getArg.side_effect = getArg_side_effect @@ -1356,6 +1356,7 @@ def test_get_event_command(self, mock_demisto): def getArg_side_effect(arg): if arg == 'event_id': return expected_event_id + return None def event_context_table_contains_multi_columns_side_effect(table): return table.get('name') == 'enterprise_ips' @@ -1771,7 +1772,7 @@ def test_event_context_table_to_dict_list(self): actual_dict_table_list = self.class_under_test.event_context_table_to_dict_list(event_context_table) # Assert results - self.assertEqual(expected_dict_table_list, actual_dict_table_list) + assert expected_dict_table_list == actual_dict_table_list def test_event_context_to_dict(self): # Expectations @@ -1789,7 +1790,7 @@ def test_event_context_to_dict(self): actual_dict_table = self.class_under_test.event_context_table_to_dict(event_context_table) # Assert results - self.assertEqual(expected_dict_table, actual_dict_table) + assert expected_dict_table == actual_dict_table def test_event_context_table_contains_multi_columns(self): # Execute test @@ -1797,13 +1798,13 @@ def test_event_context_table_contains_multi_columns(self): json_data = event_context_table_file.read() event_context_table = json.loads(json_data) result = self.class_under_test.event_context_table_contains_multi_columns(event_context_table) - self.assertTrue(result) + assert result with open('./test-data/event-context-key-value-table.json') as event_context_table_file: json_data = event_context_table_file.read() event_context_table = json.loads(json_data) result = self.class_under_test.event_context_table_contains_multi_columns(event_context_table) - self.assertFalse(result) + assert not result def test_create_markdown_link(self): # Expectations @@ -1815,7 +1816,7 @@ def test_create_markdown_link(self): actual_markdown_link = self.class_under_test.create_markdown_link(link_text, url) # Assert - self.assertEqual(expected_markdown_link, actual_markdown_link) + assert expected_markdown_link == actual_markdown_link def test_create_dome_markdown_link(self): # Expectations @@ -1828,7 +1829,7 @@ def test_create_dome_markdown_link(self): actual_markdown_link = self.class_under_test.create_dome_markdown_link(link_text, alert_id) # Assert - self.assertEqual(expected_markdown_link, actual_markdown_link) + assert expected_markdown_link == actual_markdown_link if __name__ == '__main__': diff --git a/Packs/MISP/Integrations/MISPV3/MISPV3.py b/Packs/MISP/Integrations/MISPV3/MISPV3.py index 54a5dfc3f73..2f1f3fdeaa2 100644 --- a/Packs/MISP/Integrations/MISPV3/MISPV3.py +++ b/Packs/MISP/Integrations/MISPV3/MISPV3.py @@ -1,7 +1,6 @@ import demistomock as demisto # noqa: F401 from CommonServerPython import * # noqa: F401 -# type: ignore import urllib3 import copy @@ -326,9 +325,9 @@ def build_custom_object(template_name: str, args: list[dict]): custom_obj = PYMISP.get_raw_object_template(template_name) - if not os.path.exists('/tmp/{}'.format(template_name)): - os.mkdir('/tmp/{}'.format(template_name)) - open('/tmp/{}/definition.json'.format(template_name), 'w').write(json.dumps(custom_obj)) + if not os.path.exists(f'/tmp/{template_name}'): + os.mkdir(f'/tmp/{template_name}') + open(f'/tmp/{template_name}/definition.json', 'w').write(json.dumps(custom_obj)) misp_object = MISPObject(name=template_name, misp_objects_path_custom='/tmp') @@ -1549,7 +1548,7 @@ def add_custom_object_command(demisto_args: dict): if obj is not False: return add_object(event_id, obj) else: - raise DemistoException('Unable to find custom template {}'. format(template)) + raise DemistoException(f'Unable to find custom template {template}') except ValueError as e: raise DemistoException( diff --git a/Packs/MISP/Integrations/MISPV3/MISPV3_test.py b/Packs/MISP/Integrations/MISPV3/MISPV3_test.py index 46e7fe9a90d..a179dc2467e 100644 --- a/Packs/MISP/Integrations/MISPV3/MISPV3_test.py +++ b/Packs/MISP/Integrations/MISPV3/MISPV3_test.py @@ -750,7 +750,7 @@ def test_add_custom_object(mocker): result = add_custom_object_command(demisto_args) expected_output = { - 'readable_output': 'Object has been added to MISP event ID {}'.format(event_id), + 'readable_output': f'Object has been added to MISP event ID {event_id}', 'outputs': response_add_obj } assert result.readable_output == expected_output['readable_output'] diff --git a/Packs/MISP/Integrations/MISP_V2/MISP_V2.py b/Packs/MISP/Integrations/MISP_V2/MISP_V2.py index 366652e6d97..428e42e9fc7 100644 --- a/Packs/MISP/Integrations/MISP_V2/MISP_V2.py +++ b/Packs/MISP/Integrations/MISP_V2/MISP_V2.py @@ -1,5 +1,3 @@ -# type: ignore - import logging import warnings from typing import Union, List, Any, Tuple, Dict diff --git a/Packs/MISP/ReleaseNotes/2_1_44.md b/Packs/MISP/ReleaseNotes/2_1_44.md new file mode 100644 index 00000000000..e62866b647d --- /dev/null +++ b/Packs/MISP/ReleaseNotes/2_1_44.md @@ -0,0 +1,9 @@ + +#### Integrations + +##### MISP v2 (Deprecated) + +- Maintenance and stability enhancements. +##### MISP v3 + +- Maintenance and stability enhancements. diff --git a/Packs/MISP/pack_metadata.json b/Packs/MISP/pack_metadata.json index 3cce685e410..df489973c90 100644 --- a/Packs/MISP/pack_metadata.json +++ b/Packs/MISP/pack_metadata.json @@ -2,7 +2,7 @@ "name": "MISP", "description": "Malware information and threat sharing platform.", "support": "xsoar", - "currentVersion": "2.1.43", + "currentVersion": "2.1.44", "author": "Cortex XSOAR", "url": "https://www.paloaltonetworks.com/cortex", "email": "", diff --git a/Packs/Netskope/Integrations/NetskopeAPIv1/NetskopeAPIv1.py b/Packs/Netskope/Integrations/NetskopeAPIv1/NetskopeAPIv1.py index 5f17cca88b4..a0cab1db02a 100644 --- a/Packs/Netskope/Integrations/NetskopeAPIv1/NetskopeAPIv1.py +++ b/Packs/Netskope/Integrations/NetskopeAPIv1/NetskopeAPIv1.py @@ -1,8 +1,8 @@ import demistomock as demisto # noqa: F401 from CommonServerPython import * # noqa: F401 -# type: ignore + from copy import deepcopy -from typing import Any, Dict, List, Optional, Tuple +from typing import Any import urllib3 @@ -47,16 +47,16 @@ def __init__(self, base_url: str, token: str, use_ssl: bool, use_proxy: bool): self._session.params['token'] = token # type: ignore def list_events_request(self, - query: Optional[str] = None, - event_type: Optional[str] = None, - timeperiod: Optional[int] = None, - start_time: Optional[int] = None, - end_time: Optional[int] = None, - insertion_start_time: Optional[int] = None, - insertion_end_time: Optional[int] = None, - limit: Optional[int] = None, - skip: Optional[int] = None, - unsorted: Optional[bool] = None) -> Dict[str, Any]: + query: str | None = None, + event_type: str | None = None, + timeperiod: int | None = None, + start_time: int | None = None, + end_time: int | None = None, + insertion_start_time: int | None = None, + insertion_end_time: int | None = None, + limit: int | None = None, + skip: int | None = None, + unsorted: bool | None = None) -> dict[str, Any]: """ Get events extracted from SaaS traffic and or logs. @@ -94,17 +94,17 @@ def list_events_request(self, return self._http_request(method='POST', url_suffix='events', json_data=body) def list_alerts_request(self, - query: Optional[str] = None, - alert_type: Optional[str] = None, - acked: Optional[bool] = None, - timeperiod: Optional[int] = None, - start_time: Optional[int] = None, - end_time: Optional[int] = None, - insertion_start_time: Optional[int] = None, - insertion_end_time: Optional[int] = None, - limit: Optional[int] = None, - skip: Optional[int] = None, - unsorted: Optional[bool] = None) -> Dict[str, Any]: + query: str | None = None, + alert_type: str | None = None, + acked: bool | None = None, + timeperiod: int | None = None, + start_time: int | None = None, + end_time: int | None = None, + insertion_start_time: int | None = None, + insertion_end_time: int | None = None, + limit: int | None = None, + skip: int | None = None, + unsorted: bool | None = None) -> dict[str, Any]: """ Get alerts generated by Netskope, including policy, DLP, and watch list alerts. @@ -144,10 +144,10 @@ def list_alerts_request(self, return self._http_request(method='POST', url_suffix='alerts', json_data=body) def list_quarantined_files_request(self, - start_time: Optional[int] = None, - end_time: Optional[int] = None, - limit: Optional[int] = None, - skip: Optional[int] = None) -> Dict[str, Any]: + start_time: int | None = None, + end_time: int | None = None, + limit: int | None = None, + skip: int | None = None) -> dict[str, Any]: """ List all quarantined files. @@ -214,7 +214,7 @@ def update_quarantined_file_request(self, quarantine_profile_id: str, file_id: s self._http_request(method='POST', url_suffix='quarantine', json_data=body, resp_type='text') - def update_url_list_request(self, name: str, urls: List[str]) -> None: + def update_url_list_request(self, name: str, urls: list[str]) -> None: """ Update the URL List with the values provided. @@ -226,7 +226,7 @@ def update_url_list_request(self, name: str, urls: List[str]) -> None: body = {'name': name, 'list': ','.join(urls)} self._http_request(method='POST', url_suffix='updateUrlList', json_data=body) - def update_file_hash_list_request(self, name: str, hashes: List[str]) -> None: + def update_file_hash_list_request(self, name: str, hashes: list[str]) -> None: """ Update file hash list with the values provided. @@ -239,9 +239,9 @@ def update_file_hash_list_request(self, name: str, hashes: List[str]) -> None: return self._http_request(method='POST', url_suffix='updateFileHashList', json_data=body) def list_clients_request(self, - query: Optional[str] = None, - limit: Optional[int] = None, - skip: Optional[int] = None) -> Dict[str, Any]: + query: str | None = None, + limit: int | None = None, + skip: int | None = None) -> dict[str, Any]: """ Get information about the Netskope clients. @@ -266,7 +266,7 @@ def _http_request(self, *args, **kwargs): return response -def arg_to_boolean(arg: Optional[str]) -> Optional[bool]: +def arg_to_boolean(arg: str | None) -> bool | None: """ Converts an XSOAR argument to a Python boolean or None. @@ -284,7 +284,7 @@ def arg_to_boolean(arg: Optional[str]) -> Optional[bool]: return argToBoolean(arg) -def arg_to_seconds_timestamp(arg: Optional[str]): +def arg_to_seconds_timestamp(arg: str | None): """ Converts an XSOAR date string argument to a timestamp in seconds. @@ -316,11 +316,11 @@ def date_to_seconds_timestamp(date_str_or_dt: Union[str, datetime]) -> int: return date_to_timestamp(date_str_or_dt) // 1000 -def validate_time_arguments(start_time: Optional[int] = None, - end_time: Optional[int] = None, - insertion_start_time: Optional[int] = None, - insertion_end_time: Optional[int] = None, - timeperiod: Optional[int] = None) -> None: +def validate_time_arguments(start_time: int | None = None, + end_time: int | None = None, + insertion_start_time: int | None = None, + insertion_end_time: int | None = None, + timeperiod: int | None = None) -> None: """ Validates time arguments from the user. The user must provide one of the following: @@ -353,7 +353,7 @@ def validate_time_arguments(start_time: Optional[int] = None, def validate_fetch_params(max_fetch: int, max_events_fetch: int, fetch_events: bool, - first_fetch: str, event_types: List[str]) -> None: + first_fetch: str, event_types: list[str]) -> None: """ Validates the parameters for fetch incident command. @@ -382,7 +382,7 @@ def get_pagination_readable_message(header: str, page: int, limit: int) -> str: return f'{header}\n Current page size: {limit}\n Showing page {page} out of others that may exist.' -def get_pagination_arguments(args: Dict[str, Any]) -> Tuple[int, int, int]: +def get_pagination_arguments(args: dict[str, Any]) -> tuple[int, int, int]: """ Gets and validates pagination arguments for client (skip and limit). @@ -404,7 +404,7 @@ def get_pagination_arguments(args: Dict[str, Any]) -> Tuple[int, int, int]: return page, (page - 1) * limit, limit -def list_events_command(client: Client, args: Dict[str, str]) -> CommandResults: +def list_events_command(client: Client, args: dict[str, str]) -> CommandResults: """ Get events extracted from SaaS traffic and or logs. @@ -461,7 +461,7 @@ def list_events_command(client: Client, args: Dict[str, str]) -> CommandResults: raw_response=response) -def list_alerts_command(client: Client, args: Dict[str, str]) -> CommandResults: +def list_alerts_command(client: Client, args: dict[str, str]) -> CommandResults: """ Get alerts generated by Netskope, including policy, DLP, and watch list alerts. @@ -520,7 +520,7 @@ def list_alerts_command(client: Client, args: Dict[str, str]) -> CommandResults: raw_response=response) -def list_quarantined_files_command(client: Client, args: Dict[str, str]) -> CommandResults: +def list_quarantined_files_command(client: Client, args: dict[str, str]) -> CommandResults: """ List all quarantined files. @@ -567,7 +567,7 @@ def list_quarantined_files_command(client: Client, args: Dict[str, str]) -> Comm raw_response=response) -def get_quarantined_file_command(client: Client, args: Dict[str, str]) -> CommandResults: +def get_quarantined_file_command(client: Client, args: dict[str, str]) -> CommandResults: """ Download a quarantined file. @@ -588,7 +588,7 @@ def get_quarantined_file_command(client: Client, args: Dict[str, str]) -> Comman return fileResult(filename=file_name, data=response, file_type=EntryType.FILE) -def update_quarantined_file_command(client: Client, args: Dict[str, str]) -> CommandResults: +def update_quarantined_file_command(client: Client, args: dict[str, str]) -> CommandResults: """ Take an action on a quarantined file. @@ -612,7 +612,7 @@ def update_quarantined_file_command(client: Client, args: Dict[str, str]) -> Com return CommandResults(readable_output=readable_output) -def update_url_list_command(client: Client, args: Dict[str, str]) -> CommandResults: +def update_url_list_command(client: Client, args: dict[str, str]) -> CommandResults: """ Update the URL List with the values provided. @@ -638,7 +638,7 @@ def update_url_list_command(client: Client, args: Dict[str, str]) -> CommandResu readable_output=readable_output) -def update_file_hash_list_command(client: Client, args: Dict[str, str]) -> CommandResults: +def update_file_hash_list_command(client: Client, args: dict[str, str]) -> CommandResults: """ Update file hash list with the values provided. @@ -664,7 +664,7 @@ def update_file_hash_list_command(client: Client, args: Dict[str, str]) -> Comma readable_output=readable_output) -def list_clients_command(client: Client, args: Dict[str, str]) -> CommandResults: +def list_clients_command(client: Client, args: dict[str, str]) -> CommandResults: """ Get information about the Netskope clients. @@ -698,7 +698,7 @@ def list_clients_command(client: Client, args: Dict[str, str]) -> CommandResults raw_response=response) -def list_host_associated_user_command(client: Client, args: Dict[str, str]) -> CommandResults: +def list_host_associated_user_command(client: Client, args: dict[str, str]) -> CommandResults: """ List all users of certain host by its hostname. @@ -737,7 +737,7 @@ def list_host_associated_user_command(client: Client, args: Dict[str, str]) -> C raw_response=response) -def list_user_associated_host_command(client: Client, args: Dict[str, str]) -> CommandResults: +def list_user_associated_host_command(client: Client, args: dict[str, str]) -> CommandResults: """ List all hosts related to a certain username. @@ -777,7 +777,7 @@ def list_user_associated_host_command(client: Client, args: Dict[str, str]) -> C def test_module(client: Client, max_fetch: int, first_fetch: str, fetch_events: bool, - max_events_fetch: int, event_types: List[str]) -> str: + max_events_fetch: int, event_types: list[str]) -> str: """ Validates all integration parameters, and tests connection to Netskope instance. """ @@ -791,8 +791,8 @@ def test_module(client: Client, max_fetch: int, first_fetch: str, fetch_events: def fetch_multiple_type_events(client: Client, max_fetch: int, start_time: int, - event_types: List[str], - query: Optional[str]) -> List[Dict[str, Any]]: + event_types: list[str], + query: str | None) -> list[dict[str, Any]]: """ Fetches events from multiple types. The function makes an API call for each type, since the API requires @@ -830,8 +830,8 @@ def fetch_multiple_type_events(client: Client, max_fetch: int, start_time: int, def fetch_incidents(client: Client, max_fetch: int, first_fetch: str, fetch_events: bool, - max_events_fetch: int, event_types: List[str], alerts_query: Optional[str], - events_query: Optional[str]) -> None: + max_events_fetch: int, event_types: list[str], alerts_query: str | None, + events_query: str | None) -> None: """ Fetches alerts and events as incidents. diff --git a/Packs/Netskope/Integrations/NetskopeAPIv1/NetskopeAPIv1.yml b/Packs/Netskope/Integrations/NetskopeAPIv1/NetskopeAPIv1.yml index 3ffad54de17..750ea017aae 100644 --- a/Packs/Netskope/Integrations/NetskopeAPIv1/NetskopeAPIv1.yml +++ b/Packs/Netskope/Integrations/NetskopeAPIv1/NetskopeAPIv1.yml @@ -494,7 +494,7 @@ script: - contextPath: Netskope.Host.agent_status description: The status of the agent on the device. type: String - dockerimage: demisto/python3:3.10.13.89009 + dockerimage: demisto/python3:3.11.9.105369 isfetch: true runonce: false script: "-" diff --git a/Packs/Netskope/ReleaseNotes/3_3_11.md b/Packs/Netskope/ReleaseNotes/3_3_11.md new file mode 100644 index 00000000000..18f6da06db8 --- /dev/null +++ b/Packs/Netskope/ReleaseNotes/3_3_11.md @@ -0,0 +1,6 @@ + +#### Integrations + +##### Netskope (API v1) + +- Maintenance and stability enhancements. diff --git a/Packs/Netskope/pack_metadata.json b/Packs/Netskope/pack_metadata.json index 37c87fa447c..652806da5b0 100644 --- a/Packs/Netskope/pack_metadata.json +++ b/Packs/Netskope/pack_metadata.json @@ -2,7 +2,7 @@ "name": "Netskope", "description": "Cloud access security broker that enables to find, understand, and secure cloud apps.", "support": "xsoar", - "currentVersion": "3.3.10", + "currentVersion": "3.3.11", "author": "Cortex XSOAR", "url": "https://www.paloaltonetworks.com/cortex", "email": "", diff --git a/Packs/Tenable_io/Integrations/Tenable_io/Tenable_io_test.py b/Packs/Tenable_io/Integrations/Tenable_io/Tenable_io_test.py index d9eea45fb6d..8328b8d9ea8 100644 --- a/Packs/Tenable_io/Integrations/Tenable_io/Tenable_io_test.py +++ b/Packs/Tenable_io/Integrations/Tenable_io/Tenable_io_test.py @@ -4,7 +4,6 @@ from CommonServerPython import * import json -# mypy: disable-error-code="operator" MOCK_PARAMS = { 'access-key': 'fake_access_key',