From 5a3ed7cd59379a4a5fccb5c97d75ed010eee30d0 Mon Sep 17 00:00:00 2001
From: Menachem Weinfeld <90556466+mmhw@users.noreply.github.com>
Date: Tue, 12 Sep 2023 16:24:51 +0300
Subject: [PATCH] [pre-commit pycln] Align the entire repo with pycln (#29611)
* Fix falls of the pycln hook
* pre-commit
* Fix unit test
* Add RN
* Fix validate in GetDomainDNSDetails
* fuff on GetDomainDNSDetails
* ignore mypy error in test_content.py:350
---
.../ACTIIndicatorQuery_test.py | 9 ++-
.../ACTIVulnerabilityQuery_test.py | 5 +-
Packs/CommonScripts/ReleaseNotes/1_12_23.md | 6 ++
.../GetDomainDNSDetails.py | 16 ++---
.../GetDomainDNSDetails.yml | 14 ++--
...sitiveDetectionsVSDetectionEngines_test.py | 6 +-
Packs/CommonScripts/pack_metadata.json | 2 +-
.../DatadogCloudSIEM/DatadogCloudSIEM_test.py | 32 ++++-----
.../LogsignSiem/LogsignSiem_test.py | 3 +-
.../MobileIronCLOUD/MobileIronCLOUD_test.py | 24 ++++---
.../PAN-OS/Integrations/Panorama/Panorama.py | 4 +-
.../PAN-OS/Integrations/Panorama/Panorama.yml | 66 +++++++++----------
Packs/PAN-OS/ReleaseNotes/2_1_6.md | 6 ++
Packs/PAN-OS/pack_metadata.json | 2 +-
.../knowbe4Phisher/knowbe4Phisher_test.py | 8 ++-
.../scripts/utils/logging_wrapper/__init__.py | 3 +-
Tests/test_content.py | 22 +++----
17 files changed, 115 insertions(+), 113 deletions(-)
create mode 100644 Packs/CommonScripts/ReleaseNotes/1_12_23.md
create mode 100644 Packs/PAN-OS/ReleaseNotes/2_1_6.md
diff --git a/Packs/AccentureCTI/Integrations/ACTIIndicatorQuery/ACTIIndicatorQuery_test.py b/Packs/AccentureCTI/Integrations/ACTIIndicatorQuery/ACTIIndicatorQuery_test.py
index f75dabbc2377..a11bbf205ce9 100644
--- a/Packs/AccentureCTI/Integrations/ACTIIndicatorQuery/ACTIIndicatorQuery_test.py
+++ b/Packs/AccentureCTI/Integrations/ACTIIndicatorQuery/ACTIIndicatorQuery_test.py
@@ -1,7 +1,9 @@
import requests_mock
from ACTIIndicatorQuery import IDEFENSE_URL_TEMPLATE, Client, domain_command, url_command, ip_command, uuid_command, _calculate_dbot_score, getThreatReport_command, fix_markdown, addBaseUrlToPartialPaths, convert_inline_image_to_encoded, fundamental_uuid_command # noqa: E501
from CommonServerPython import DemistoException, DBotScoreReliability
-from test_data.response_constants import *
+from test_data.response_constants import URL_RES_JSON, URL_INTEL_JSON, IP_RES_JSON, IP_INTEL_JSON, DOMAIN_RES_JSON, \
+ DOMAIN_INTEL_JSON, UUID_RES_JSON, RES_JSON_IA, RES_JSON_IR, expected_output_ia, expected_output_ir, MALWARE_FAMILY_RES_JSON, \
+ expected_output_malware_family, RAW_MALWARE_FAMILY_RES_JSON
import demistomock as demisto
import pytest
@@ -231,10 +233,7 @@ def _is_intelligence_data_present_in_command_result(context_result, test_intel_j
if url not in content[content.find(title):content.find('|', content.find(title))]:
return False
- for title, url in reports.items():
- if url not in content[content.find(title):content.find('|', content.find(title))]:
- return False
- return True
+ return all(url in content[content.find(title):content.find("|", content.find(title))] for title, url in reports.items())
def test_uuid_command():
diff --git a/Packs/AccentureCTI/Integrations/ACTIVulnerabilityQuery/ACTIVulnerabilityQuery_test.py b/Packs/AccentureCTI/Integrations/ACTIVulnerabilityQuery/ACTIVulnerabilityQuery_test.py
index 93ef60da09fc..448f9a276155 100644
--- a/Packs/AccentureCTI/Integrations/ACTIVulnerabilityQuery/ACTIVulnerabilityQuery_test.py
+++ b/Packs/AccentureCTI/Integrations/ACTIVulnerabilityQuery/ACTIVulnerabilityQuery_test.py
@@ -1,7 +1,6 @@
import json
-import io
from ACTIVulnerabilityQuery import Client, vuln_command
-from test_data.response_constants import *
+from test_data.response_constants import VULN_RES_JSON
from CommonServerPython import DBotScoreReliability
import requests_mock
@@ -10,7 +9,7 @@
def util_load_json(path):
- with io.open(path, mode='r', encoding='utf-8') as f:
+ with open(path, encoding='utf-8') as f:
return json.loads(f.read())
diff --git a/Packs/CommonScripts/ReleaseNotes/1_12_23.md b/Packs/CommonScripts/ReleaseNotes/1_12_23.md
new file mode 100644
index 000000000000..f4d531123861
--- /dev/null
+++ b/Packs/CommonScripts/ReleaseNotes/1_12_23.md
@@ -0,0 +1,6 @@
+
+#### Scripts
+
+##### GetDomainDNSDetails
+
+- Updated the Docker image to: *demisto/dnspython:1.0.0.73453*.
diff --git a/Packs/CommonScripts/Scripts/GetDomainDNSDetails/GetDomainDNSDetails.py b/Packs/CommonScripts/Scripts/GetDomainDNSDetails/GetDomainDNSDetails.py
index b30e40b036cc..f298519d7bbf 100644
--- a/Packs/CommonScripts/Scripts/GetDomainDNSDetails/GetDomainDNSDetails.py
+++ b/Packs/CommonScripts/Scripts/GetDomainDNSDetails/GetDomainDNSDetails.py
@@ -3,12 +3,10 @@
from CommonServerUserPython import * # noqa # pylint: disable=unused-wildcard-import
from typing import (
- Dict, Any, Optional,
- Union, List
+ Any
)
import traceback
-import dns.message
import dns.resolver
import dns.rdatatype
import dns.rdataclass
@@ -22,7 +20,7 @@
''' STANDALONE FUNCTION '''
-def make_query(resolver: dns.resolver.Resolver, qname: str, qtype: str, use_tcp: bool) -> Dict[str, Any]:
+def make_query(resolver: dns.resolver.Resolver, qname: str, qtype: str, use_tcp: bool) -> dict[str, Any]:
q_rdtype = dns.rdatatype.from_text(qtype)
q_rdclass = dns.rdataclass.from_text("IN")
@@ -41,7 +39,7 @@ def make_query(resolver: dns.resolver.Resolver, qname: str, qtype: str, use_tcp:
if ans.rrset is None:
return {}
- result: Dict[str, List[str]] = {}
+ result: dict[str, list[str]] = {}
result[qtype] = [
rr.to_text()
@@ -55,9 +53,9 @@ def make_query(resolver: dns.resolver.Resolver, qname: str, qtype: str, use_tcp:
''' COMMAND FUNCTION '''
-def get_domain_dns_details_command(args: Dict[str, Any]) -> CommandResults:
- outputs: Optional[Dict[str, Dict[str, Any]]]
- answer: Union[str, Dict[str, Any]]
+def get_domain_dns_details_command(args: dict[str, Any]) -> CommandResults:
+ outputs: dict[str, dict[str, Any]] | None
+ answer: str | dict[str, Any]
server = args.get('server')
use_tcp = argToBoolean(args.get('use_tcp', 'Yes'))
@@ -88,7 +86,7 @@ def get_domain_dns_details_command(args: Dict[str, Any]) -> CommandResults:
}
markdown = tableToMarkdown(
- f' Domain DNS Details for {qname}',
+ f'Domain DNS Details for {qname}',
answer,
headers=["domain", "server"] + qtypes
)
diff --git a/Packs/CommonScripts/Scripts/GetDomainDNSDetails/GetDomainDNSDetails.yml b/Packs/CommonScripts/Scripts/GetDomainDNSDetails/GetDomainDNSDetails.yml
index ac277d34bc59..286d0846cd3b 100644
--- a/Packs/CommonScripts/Scripts/GetDomainDNSDetails/GetDomainDNSDetails.yml
+++ b/Packs/CommonScripts/Scripts/GetDomainDNSDetails/GetDomainDNSDetails.yml
@@ -1,20 +1,20 @@
args:
-- description: The domain to query
+- description: The domain to query.
name: domain
required: true
-- description: "IP of the DNS Server to use (default: system settings)"
+- description: "IP of the DNS Server to use (default: system settings)."
name: server
-- description: "Use TCP for the query (default: false)"
+- description: "Use TCP for the query (default: false)."
name: use_tcp
auto: PREDEFINED
predefined:
- 'true'
- 'false'
defaultValue: 'false'
-- description: "Comma separated list of query types (default: CNAME,NS,A,AAAA)"
+- description: "Comma separated list of query types (default: CNAME,NS,A,AAAA)."
name: qtype
defaultValue: CNAME,NS,A,AAAA
-comment: Returns DNS details for a domain
+comment: Returns DNS details for a domain.
commonfields:
id: GetDomainDNSDetails
version: -1
@@ -43,5 +43,7 @@ tags: []
timeout: '0'
type: python
subtype: python3
-dockerimage: demisto/dnspython:1.0.0.12410
+dockerimage: demisto/dnspython:1.0.0.73453
fromversion: 5.0.0
+tests:
+- No tests (auto formatted)
diff --git a/Packs/CommonScripts/Scripts/PositiveDetectionsVSDetectionEngines/PositiveDetectionsVSDetectionEngines_test.py b/Packs/CommonScripts/Scripts/PositiveDetectionsVSDetectionEngines/PositiveDetectionsVSDetectionEngines_test.py
index 23338a807d21..31d39a076564 100644
--- a/Packs/CommonScripts/Scripts/PositiveDetectionsVSDetectionEngines/PositiveDetectionsVSDetectionEngines_test.py
+++ b/Packs/CommonScripts/Scripts/PositiveDetectionsVSDetectionEngines/PositiveDetectionsVSDetectionEngines_test.py
@@ -1,4 +1,4 @@
-from __future__ import print_function
+from typing import Any
import pytest
from PositiveDetectionsVSDetectionEngines import extract_engines_data_from_indicator
@@ -134,8 +134,8 @@
}
}
-no_engines_data = {
- 'CustomFields': {}, # type: dict[any: any]
+no_engines_data: dict[str, Any] = {
+ 'CustomFields': {},
'ManuallyEditedFields': None,
'account': '',
'calculatedTime': '2019-11-11T14:25:28.922329+02:00',
diff --git a/Packs/CommonScripts/pack_metadata.json b/Packs/CommonScripts/pack_metadata.json
index 1c1591a0a2a1..d5d5bb7b2f7a 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.12.22",
+ "currentVersion": "1.12.23",
"author": "Cortex XSOAR",
"url": "https://www.paloaltonetworks.com/cortex",
"email": "",
diff --git a/Packs/DatadogCloudSIEM/Integrations/DatadogCloudSIEM/DatadogCloudSIEM_test.py b/Packs/DatadogCloudSIEM/Integrations/DatadogCloudSIEM/DatadogCloudSIEM_test.py
index 00c5f621b8c6..4f57c4991a15 100644
--- a/Packs/DatadogCloudSIEM/Integrations/DatadogCloudSIEM/DatadogCloudSIEM_test.py
+++ b/Packs/DatadogCloudSIEM/Integrations/DatadogCloudSIEM/DatadogCloudSIEM_test.py
@@ -11,10 +11,8 @@
"""
import json
-import io
import os
import pytest
-from typing import Optional
from unittest.mock import MagicMock
from CommonServerPython import CommandResults, DemistoException
from DatadogCloudSIEM import (
@@ -55,13 +53,20 @@
MetricSearchResponseResults,
)
from datadog_api_client.v1.model.metric_metadata import MetricMetadata
-from test_data.inputs import *
+from test_data.inputs import TIME_SERIES_POINT_QUERY_RESPONSE, TIME_SERIES_POINT_QUERY_CONTEXT, CREATE_INCIDENT_RESPONSE, \
+ CREATE_INCIDENT_CONTEXT, UPDATE_INCIDENT_RESPONSE, UPDATE_INCIDENT_CONTEXT, GET_INCIDENT_RESPONSE, GET_INCIDENT_CONTEXT, \
+ INCIDENT_LOOKUP_DATA, INCIDENT_LOOKUP_DATA_EXPECTED, METRIC_COMMAND_RESULT_INPUT, METRIC_COMMAND_RESULT_OUTPUT, \
+ TAGS_CONTEXT_READABLE_OUTPUT, LIST_INCIDENT_RESPONSE, LIST_INCIDENT_CONTEXT, EVENT_CREATE_RESPONSE, TAGS_LIST_CONTEXT, \
+ EVENT_CREATE_CONTEXT, EVENT_LIST_RESPONSE, EVENT_LIST_CONTEXT, EVENT_GET_RESPONSE, EVENT_GET_CONTEXT, \
+ HOST_TAG_CREATE_CONTEXT, HOST_TAG_GET_CONTEXT, HOST_TAG_UPDATE_CONTEXT, ACTIVE_METRIC_LIST_RESPONSE, \
+ ACTIVE_METRIC_LIST_CONTEXT, METRIC_SEARCH_RESPONSE, METRIC_SEARCH_CONTEXT, METRIC_METADATA_GET_RESPONSE, \
+ METRIC_METADATA_GET_CONTEXT, METRIC_METADATA_UPDATE_RESPONSE, METRIC_METADATA_UPDATE_CONTEXT, EVENT_MOCK, EXPECTED_EVENT_MOCK
import datetime
import demistomock as demisto
def util_load_json(path):
- with io.open(path, mode="r", encoding="utf-8") as f:
+ with open(path, encoding="utf-8") as f:
return json.loads(f.read())
@@ -146,7 +151,6 @@ def test_create_event_command(mocker, raw_resp, expected, configuration):
mocker.patch("DatadogCloudSIEM.EventsApi", return_value=DATADOG_API_CLIENT_MOCK)
with open(
os.path.join("test_data", "readable_outputs/create_event_command_readable.md"),
- "r",
) as f:
readable_output = f.read()
result = create_event_command(configuration, args)
@@ -186,7 +190,6 @@ def test_list_events_command(mocker, raw_resp, expected, configuration):
result = get_events_command(configuration, args)
with open(
os.path.join("test_data", "readable_outputs/list_events_command_readable.md"),
- "r",
) as f:
readable_output = f.read()
assert isinstance(result, CommandResults)
@@ -218,7 +221,6 @@ def test_get_events_command(mocker, raw_resp, expected, configuration):
result = get_events_command(configuration, args)
with open(
os.path.join("test_data", "readable_outputs/get_events_command_readable.md"),
- "r",
) as f:
readable_output = f.read()
assert isinstance(result, CommandResults)
@@ -255,7 +257,6 @@ def test_add_tags_to_host_command(mocker, raw_resp, expected, configuration):
os.path.join(
"test_data", "readable_outputs/add_tags_to_host_command_readable.md"
),
- "r",
) as f:
readable_output = f.read()
assert isinstance(result, CommandResults)
@@ -287,7 +288,6 @@ def test_get_host_tags_command(mocker, raw_resp, expected, configuration):
result = get_host_tags_command(configuration, args)
with open(
os.path.join("test_data", "readable_outputs/get_host_tags_command_readable.md"),
- "r",
) as f:
readable_output = f.read()
assert isinstance(result, CommandResults)
@@ -324,7 +324,6 @@ def test_update_host_tags_command(mocker, raw_resp, expected, configuration):
os.path.join(
"test_data", "readable_outputs/update_host_tags_command_readable.md"
),
- "r",
) as f:
readable_output = f.read()
assert isinstance(result, CommandResults)
@@ -360,7 +359,6 @@ def test_active_metrics_list_command(mocker, raw_resp, expected, configuration):
os.path.join(
"test_data", "readable_outputs/active_metrics_list_command_readable.md"
),
- "r",
) as f:
readable_output = f.read()
assert isinstance(result, CommandResults)
@@ -397,7 +395,6 @@ def test_metrics_search_command(mocker, raw_resp, expected, configuration):
os.path.join(
"test_data", "readable_outputs/metrics_search_command_readable.md"
),
- "r",
) as f:
readable_output = f.read()
assert isinstance(result, CommandResults)
@@ -432,7 +429,6 @@ def test_get_metric_metadata_command(mocker, raw_resp, expected, configuration):
os.path.join(
"test_data", "readable_outputs/get_metric_metadata_command_readable.md"
),
- "r",
) as f:
readable_output = f.read()
assert isinstance(result, CommandResults)
@@ -475,7 +471,6 @@ def test_update_metric_metadata_command(mocker, raw_resp, expected, configuratio
os.path.join(
"test_data", "readable_outputs/update_metric_metadata_command_readable.md"
),
- "r",
) as f:
readable_output = f.read()
assert isinstance(result, CommandResults)
@@ -510,7 +505,7 @@ def test_get_tags_command(mocker, raw_resp, expected, configuration):
mocker.patch("DatadogCloudSIEM.TagsApi", return_value=DATADOG_API_CLIENT_MOCK)
result = get_tags_command(configuration, args)
with open(
- os.path.join("test_data", "readable_outputs/get_tags_command_readable.md"), "r"
+ os.path.join("test_data", "readable_outputs/get_tags_command_readable.md")
) as f:
readable_output = f.read()
assert isinstance(result, CommandResults)
@@ -545,7 +540,6 @@ def test_query_timeseries_points_command(mocker, raw_resp, expected, configurati
os.path.join(
"test_data", "readable_outputs/query_timeseries_points_command_readable.md"
),
- "r",
) as f:
readable_output = f.read()
assert isinstance(result[0], CommandResults)
@@ -641,7 +635,6 @@ def test_create_incident_command(mocker, raw_resp, expected, configuration):
os.path.join(
"test_data", "readable_outputs/create_incident_command_readable.md"
),
- "r",
) as f:
readable_output = f.read()
assert isinstance(result, CommandResults)
@@ -689,7 +682,6 @@ def test_update_incident_command(mocker, raw_resp, expected, configuration):
os.path.join(
"test_data", "readable_outputs/update_incident_command_readable.md"
),
- "r",
) as f:
readable_output = f.read()
assert isinstance(result, CommandResults)
@@ -721,7 +713,6 @@ def test_get_incident_command(mocker, raw_resp, expected, configuration):
result = get_incident_command(configuration, args)
with open(
os.path.join("test_data", "readable_outputs/get_incident_command_readable.md"),
- "r",
) as f:
readable_output = f.read()
assert isinstance(result, CommandResults)
@@ -753,7 +744,6 @@ def test_list_incident_command(mocker, raw_resp, expected, configuration):
result = get_incident_command(configuration, args)
with open(
os.path.join("test_data", "readable_outputs/list_incident_command_readable.md"),
- "r",
) as f:
readable_output = f.read()
assert isinstance(result, CommandResults)
@@ -959,7 +949,7 @@ def test_incident_for_lookup(raw, expected):
],
)
def test_pagination(
- limit: Optional[int], page: Optional[int], page_size: Optional[int], expected
+ limit: int | None, page: int | None, page_size: int | None, expected
):
"""
Test function for the pagination function in DatadogCloudSIEM.
diff --git a/Packs/LogsignSiem/Integrations/LogsignSiem/LogsignSiem_test.py b/Packs/LogsignSiem/Integrations/LogsignSiem/LogsignSiem_test.py
index 530cdb49f4b0..58ca861d1362 100644
--- a/Packs/LogsignSiem/Integrations/LogsignSiem/LogsignSiem_test.py
+++ b/Packs/LogsignSiem/Integrations/LogsignSiem/LogsignSiem_test.py
@@ -3,7 +3,8 @@
import pytest
from LogsignSiem import *
-from test_data.sample_data import *
+from test_data.sample_data import DATE_FORMAT, CHECK_ARG_MOCK_DATA, PARAMS, ARGS_Q, MOCK_INCIDENTS, MOCK_INC, RESULT_COUNT_HR, \
+ RESULT_COLUMNS_HR
import demistomock
diff --git a/Packs/MobileIronUEM/Integrations/MobileIronCLOUD/MobileIronCLOUD_test.py b/Packs/MobileIronUEM/Integrations/MobileIronCLOUD/MobileIronCLOUD_test.py
index b6137800a8ee..a83ae6d2afff 100644
--- a/Packs/MobileIronUEM/Integrations/MobileIronCLOUD/MobileIronCLOUD_test.py
+++ b/Packs/MobileIronUEM/Integrations/MobileIronCLOUD/MobileIronCLOUD_test.py
@@ -1,6 +1,6 @@
-import io
-from pytest import raises, fixture
+import pytest
+from MobileIronCLOUD import get_partition_id
from CommonServerPython import *
@@ -10,7 +10,7 @@
}
-@fixture
+@pytest.fixture
def client():
from MobileIronCLOUD import MobileIronCloudClient
@@ -22,19 +22,17 @@ def client():
def util_load_json(path):
- with io.open(path, mode='r', encoding='utf-8') as f:
+ with open(path, encoding='utf-8') as f:
return json.loads(f.read())
class TestGetPartitionId:
- from MobileIronCLOUD import get_partition_id
-
@staticmethod
def test_get_partition_id_return_param(mocker, client):
"""It returns the value of partition id from params"""
mocker.patch.object(demisto, 'params', return_value=MOCK_PARAMS)
- result = TestGetPartitionId.get_partition_id(client)
+ result = get_partition_id(client)
assert result == '12345'
@@ -52,7 +50,7 @@ def test_get_partition_id_return_api(mocker, requests_mock, client):
mock_response = util_load_json('test_data/tenant_spaces.json')
requests_mock.get('/api/v1/tenant/partition/device', json=mock_response)
- result = TestGetPartitionId.get_partition_id(client)
+ result = get_partition_id(client)
assert result == '100001'
@@ -70,7 +68,7 @@ def test_get_partition_id_return_stored(mocker, client):
'for_user': 'useremail',
'default_partition_id': '10101'
})
- result = TestGetPartitionId.get_partition_id(client)
+ result = get_partition_id(client)
assert result == '10101'
@staticmethod
@@ -89,14 +87,14 @@ def test_get_partition_id_change_user(mocker, client, requests_mock):
mock_response = util_load_json('test_data/tenant_spaces.json')
requests_mock.get('/api/v1/tenant/partition/device', json=mock_response)
- result = TestGetPartitionId.get_partition_id(client)
+ result = get_partition_id(client)
assert result == '100001'
class TestClientGetDevicesData:
- @fixture
+ @pytest.fixture
def prepare_mock(self, requests_mock):
mock_response_page_one = util_load_json('test_data/get_devices_response_page.json')
mock_response_page_two = util_load_json('test_data/get_devices_response_page2.json')
@@ -184,7 +182,7 @@ def test_execute_device_action_command(client, requests_mock, mocker):
requests_mock.put('/api/v1/device/unlock', json={'errors': None, 'result': 0})
- with raises(ValueError):
+ with pytest.raises(ValueError):
execute_device_action_command(client, 'unlock')
@@ -206,7 +204,7 @@ def test_execute_send_message_command(client, requests_mock, mocker):
requests_mock.put('/api/v1/device/message', json={'errors': None, 'result': 0})
- with raises(ValueError):
+ with pytest.raises(ValueError):
execute_send_message_command(client)
diff --git a/Packs/PAN-OS/Integrations/Panorama/Panorama.py b/Packs/PAN-OS/Integrations/Panorama/Panorama.py
index c69f5c948b11..f3b8ab5f1614 100644
--- a/Packs/PAN-OS/Integrations/Panorama/Panorama.py
+++ b/Packs/PAN-OS/Integrations/Panorama/Panorama.py
@@ -32,7 +32,7 @@
import re
import requests
import urllib3
-from urllib.parse import urlparse, quote
+from urllib.parse import urlparse
# disable insecure warnings
urllib3.disable_warnings()
@@ -5289,7 +5289,7 @@ def build_logs_query(address_src: Optional[str], address_dst: Optional[str], ip_
@logger
def panorama_query_logs(log_type: str, number_of_logs: str, query: str, address_src: str, address_dst: str, ip_: str,
- zone_src: str, zone_dst: str, time_generated: str, time_generated_after: str, action: str,
+ zone_src: str, zone_dst: str, time_generated: str, time_generated_after: str, action: str,
port_dst: str, rule: str, url: str, filedigest: str):
params = {
'type': 'log',
diff --git a/Packs/PAN-OS/Integrations/Panorama/Panorama.yml b/Packs/PAN-OS/Integrations/Panorama/Panorama.yml
index d1e5bac49021..4ce841b8f98b 100644
--- a/Packs/PAN-OS/Integrations/Panorama/Panorama.yml
+++ b/Packs/PAN-OS/Integrations/Panorama/Panorama.yml
@@ -213,7 +213,7 @@ configuration:
type: 13
section: Connect
required: false
-description: Manage Palo Alto Networks Firewall and Panorama. Use this pack to manage Prisma Access through Panorama. For more information, see the Panorama documentation
+description: Manage Palo Alto Networks Firewall and Panorama. Use this pack to manage Prisma Access through Panorama. For more information, see the Panorama documentation.
display: Palo Alto Networks PAN-OS
name: Panorama
script:
@@ -239,7 +239,7 @@ script:
name: category
- description: The XML structure that defines the command. Used for operation commands.
name: cmd
- - description: The command to run. For example, command =
+ - description: The command to run. For example, command =.
name: command
- description: The specified destination.
name: dst
@@ -255,9 +255,9 @@ script:
name: log-type
- description: The type of move operation (for example, where=after, where=before, where=top, where=bottom).
name: where
- - description: The time period. For example, period=last-24-hrs
+ - description: The time period. For example, period=last-24-hrs.
name: period
- - description: The xpath location. For example, xpath=/config/predefined/application/entry[@name='hotmail']
+ - description: The xpath location. For example, xpath=/config/predefined/application/entry[@name='hotmail'].
name: xpath
- description: The PCAP ID included in the threat log.
name: pcap-id
@@ -532,9 +532,9 @@ script:
name: description
- description: The FQDN of the new address.
name: fqdn
- - description: The IP Netmask of the new address. For example, 10.10.10.10/24
+ - description: The IP Netmask of the new address. For example, 10.10.10.10/24.
name: ip_netmask
- - description: The IP range of the new address IP. For example, 10.10.10.0-10.10.10.255
+ - description: The IP range of the new address IP. For example, 10.10.10.0-10.10.10.255.
name: ip_range
- description: The device group for which to return addresses (Panorama instances).
name: device-group
@@ -661,7 +661,7 @@ script:
- dynamic
- static
required: true
- - description: The dynamic address group match. For example "1.1.1.1 or 2.2.2.2"
+ - description: The dynamic address group match. For example "1.1.1.1 or 2.2.2.2".
name: match
- description: The static address group list of addresses.
isArray: true
@@ -1746,7 +1746,7 @@ script:
description: The blocked direction.
type: string
- contextPath: Panorama.SecurityRule.Target
- description: The target firewall (Panorama instances)
+ description: The target firewall (Panorama instances).
type: string
- contextPath: Panorama.SecurityRule.LogForwarding
description: The log forwarding profile (Panorama instances).
@@ -1951,7 +1951,7 @@ script:
description: The job ID details.
type: string
- contextPath: Panorama.Commit.Warnings
- description: The job ID warnings
+ description: The job ID warnings.
type: String
- arguments:
- description: The job ID to check.
@@ -1988,7 +1988,7 @@ script:
required: true
- description: The serial number of the firewall to download the PCAP from.
name: serialNumber
- - description: The
+ - description: The.
name: from
- description: The new name for the PCAP file after downloading. If this argument is not specified, the file name is the PCAP file name set in the firewall.
name: localName
@@ -3561,7 +3561,7 @@ script:
description: The name of the user interface.
type: String
- contextPath: Panorama.UserInterfaces.Zone
- description: The zone to which the interface is connected
+ description: The zone to which the interface is connected.
type: String
- contextPath: Panorama.UserInterfaces.EnableUserIdentification
description: Whether user identification is enabled.
@@ -3709,7 +3709,7 @@ script:
name: category
- description: Specifies the XML structure that defines the command. Used for operation commands (op type command). Can be retrieved from the PAN-OS web UI debugger or enabling debugging via the CLI using `debug cli on`.
name: cmd
- - description: The command to run. For example, command =
+ - description: The command to run. For example, command =.
name: command
- description: The specified destination.
name: dst
@@ -3725,7 +3725,7 @@ script:
name: log-type
- description: The type of move operation (for example, where=after, where=before, where=top, where=bottom).
name: where
- - description: The time period, for example period=last-24-hrs
+ - description: The time period, for example period=last-24-hrs.
name: period
- description: xpath location. xpath defines the location of the object. For example, xpath=/config/predefined/application/entry[@name='hotmail']. Documentation - https://docs.paloaltonetworks.com/pan-os/9-1/pan-os-panorama-api/about-the-pan-os-xml-api/structure-of-a-pan-os-xml-api-request/xml-and-xpath.
name: xpath
@@ -3764,7 +3764,7 @@ script:
name: vsys
- description: The device group in which to run the command.
name: device-group
- - description: Return raw XML
+ - description: Return raw XML.
name: is_xml
description: Runs any command supported in the API.
name: pan-os
@@ -3992,11 +3992,11 @@ script:
name: description
- description: The FQDN of the new address.
name: fqdn
- - description: The IP netmask of the new address. For example, 10.10.10.10/24
+ - description: The IP netmask of the new address. For example, 10.10.10.10/24.
name: ip_netmask
- - description: The IP range of the new address IP. For example, 10.10.10.0-10.10.10.255
+ - description: The IP range of the new address IP. For example, 10.10.10.0-10.10.10.255.
name: ip_range
- - description: The IP wildcard of the new address. For example, 10.20.1.0/0.0.248.255
+ - description: The IP wildcard of the new address. For example, 10.20.1.0/0.0.248.255.
name: ip_wildcard
- description: The device group for which to return addresses (Panorama instances).
name: device-group
@@ -4100,7 +4100,7 @@ script:
required: true
- description: The device group for which to return addresses (Panorama instances).
name: device-group
- description: Gets details for the specified address group
+ description: Gets details for the specified address group.
name: pan-os-get-address-group
outputs:
- contextPath: Panorama.AddressGroups.Name
@@ -4135,7 +4135,7 @@ script:
- dynamic
- static
required: true
- - description: The dynamic address group match. For example "1.1.1.1 or 2.2.2.2"
+ - description: The dynamic address group match. For example "1.1.1.1 or 2.2.2.2".
name: match
- description: The static address group list of addresses.
isArray: true
@@ -4888,7 +4888,7 @@ script:
required: true
- description: The device group for which to return addresses for the EDL (Panorama instances).
name: device-group
- description: Returns information for an external dynamic list
+ description: Returns information for an external dynamic list.
name: pan-os-get-edl
outputs:
- contextPath: Panorama.EDL.Name
@@ -5021,12 +5021,12 @@ script:
- arguments:
- description: The serial number of the device.
name: target
- description: Pull the running config file
+ description: Pull the running config file.
name: pan-os-get-running-config
- arguments:
- description: The serial number of the device.
name: target
- description: Pull the merged config file
+ description: Pull the merged config file.
name: pan-os-get-merged-config
- arguments:
- description: The name of the EDL.
@@ -5494,7 +5494,7 @@ script:
description: The job ID details.
type: string
- contextPath: Panorama.Commit.Warnings
- description: The job ID warnings
+ description: The job ID warnings.
type: String
- arguments:
- description: The job ID to check.
@@ -5516,7 +5516,7 @@ script:
description: The job ID details.
type: string
- contextPath: Panorama.Push.Warnings
- description: The job ID warnings
+ description: The job ID warnings.
type: String
- arguments:
- description: The type of packet capture.
@@ -7743,7 +7743,7 @@ script:
outputs:
- contextPath: PANOS.ShowBGPPeers.Summary.hostid
type: String
- description: The host ID
+ description: The host ID.
- contextPath: PANOS.ShowBGPPeers.Summary.peer
description: The name of the Border Gateway Protocol (BGP) peer.
type: String
@@ -7781,7 +7781,7 @@ script:
description: The total accepted routes from the peer.
type: String
- contextPath: PANOS.ShowBGPPeers.Result.incoming_rejected
- description: The total rejected routes from peer
+ description: The total rejected routes from peer.
type: String
- contextPath: PANOS.ShowBGPPeers.Result.policy_rejected
description: The total routes rejected by the peer by policy.
@@ -7932,7 +7932,7 @@ script:
outputs:
- contextPath: PANOS.RestartStatus.Summary.hostid
type: String
- description: The host ID
+ description: The host ID.
- contextPath: PANOS.RestartStatus.Summary.started
description: Whether the download process started.
type: String
@@ -8305,7 +8305,7 @@ script:
outputs:
- contextPath: PANOS.ConfigurationHygieneFix.hostid
type: String
- description: The host ID
+ description: The host ID.
- contextPath: PANOS.ConfigurationHygieneFix.container_name
description: What parent container (DG, Template, VSYS) this object belongs to.
type: String
@@ -8799,7 +8799,7 @@ script:
description: The filter interface(s).
type: Unknown
- contextPath: Panorama.RedistributionProfile.FilterType
- description: The filter type(s)
+ description: The filter type(s).
type: Unknown
- contextPath: Panorama.RedistributionProfile.FilterDestination
description: The filter destination(s).
@@ -9188,7 +9188,7 @@ script:
description: The list of the applications that the application-group has.
type: Unknown
- contextPath: Panorama.ApplicationGroup.Members
- description: The number of the application that are part of the application-group
+ description: The number of the application that are part of the application-group.
type: Number
- arguments:
- description: The name for the application-group to be created with.
@@ -9240,7 +9240,7 @@ script:
description: The list of the applications that the application-group has.
type: Unknown
- contextPath: Panorama.ApplicationGroup.Members
- description: The number of the applications that are part of the application-group
+ description: The number of the applications that are part of the application-group.
type: Number
- arguments:
- description: The name of the application-group to delete. Can be retrieved from the pan-os-list-application-groups command.
@@ -9248,7 +9248,7 @@ script:
required: true
- description: The device-group in which the application-group is part of. Only for a Panorama instance.
name: device-group
- description: Deletes an application-group
+ description: Deletes an application-group.
name: pan-os-delete-application-group
outputs: []
- arguments:
@@ -9334,7 +9334,7 @@ script:
- contextPath: Panorama.DeviceGroupNames
description: The list of device groups.
type: string
- dockerimage: demisto/pan-os-python:1.0.0.72295
+ dockerimage: demisto/pan-os-python:1.0.0.73711
isfetch: true
runonce: false
script: ''
diff --git a/Packs/PAN-OS/ReleaseNotes/2_1_6.md b/Packs/PAN-OS/ReleaseNotes/2_1_6.md
new file mode 100644
index 000000000000..64b6843ce4d8
--- /dev/null
+++ b/Packs/PAN-OS/ReleaseNotes/2_1_6.md
@@ -0,0 +1,6 @@
+
+#### Integrations
+
+##### Palo Alto Networks PAN-OS
+
+- Updated the Docker image to: *demisto/pan-os-python:1.0.0.73711*.
diff --git a/Packs/PAN-OS/pack_metadata.json b/Packs/PAN-OS/pack_metadata.json
index 3f128b3b8052..da62f1a09875 100644
--- a/Packs/PAN-OS/pack_metadata.json
+++ b/Packs/PAN-OS/pack_metadata.json
@@ -2,7 +2,7 @@
"name": "PAN-OS by Palo Alto Networks",
"description": "Manage Palo Alto Networks Firewall and Panorama. Use this pack to manage Prisma Access through Panorama. For more information see Panorama documentation.",
"support": "xsoar",
- "currentVersion": "2.1.5",
+ "currentVersion": "2.1.6",
"author": "Cortex XSOAR",
"url": "https://www.paloaltonetworks.com/cortex",
"email": "",
diff --git a/Packs/knowbe4Phisher/Integrations/knowbe4Phisher/knowbe4Phisher_test.py b/Packs/knowbe4Phisher/Integrations/knowbe4Phisher/knowbe4Phisher_test.py
index b49a553e1bc4..e06186002917 100644
--- a/Packs/knowbe4Phisher/Integrations/knowbe4Phisher/knowbe4Phisher_test.py
+++ b/Packs/knowbe4Phisher/Integrations/knowbe4Phisher/knowbe4Phisher_test.py
@@ -1,11 +1,13 @@
+from CommonServerPython import CommandResults
import knowbe4Phisher as phisher
import pytest
-from test_data.mock_tests import *
+from test_data.mock_tests import create_request_test, pagination_response, response_fetch, expected_fetch, events_example, \
+ expected_time
import json
def util_load_json(path):
- with open(path, mode='r', encoding='utf-8') as f:
+ with open(path, encoding='utf-8') as f:
return json.load(f)
@@ -50,7 +52,7 @@ def test_caclulate_event(mocker, query, expected, return_value):
mocker.patch.object(client, "phisher_gql_request", return_value=return_value)
result = phisher.calculate_number_of_events(client, query)
assert result == expected
- assert "X-KB4-Integration" in client._headers.keys()
+ assert "X-KB4-Integration" in client._headers
assert client._headers["X-KB4-Integration"] == "Cortex XSOAR PhishER"
diff --git a/Tests/scripts/utils/logging_wrapper/__init__.py b/Tests/scripts/utils/logging_wrapper/__init__.py
index 0e976010f329..368a78994865 100644
--- a/Tests/scripts/utils/logging_wrapper/__init__.py
+++ b/Tests/scripts/utils/logging_wrapper/__init__.py
@@ -1,8 +1,9 @@
-import logging
+import logging # noqa: N999
from logging import *
# add success level in addition to levels imported from logging
SUCCESS = 25
+__all__ = ['SUCCESS', 'success']
root = logging.root
addLevelName(SUCCESS, 'SUCCESS')
diff --git a/Tests/test_content.py b/Tests/test_content.py
index e7766f72e7bb..455fbd3157d3 100644
--- a/Tests/test_content.py
+++ b/Tests/test_content.py
@@ -1,4 +1,3 @@
-from __future__ import print_function
import datetime
import json
@@ -8,9 +7,10 @@
import sys
from contextlib import contextmanager
from queue import Queue
-from typing import Union, Any, Generator
+from typing import Any
+from collections.abc import Generator
+import demisto_client
-import demisto_client.demisto_api
import pytz
import requests
import urllib3
@@ -104,7 +104,7 @@ def add_proxy_related_test_data(self, proxy):
def print_test_summary(tests_data_keeper: DataKeeperTester,
is_ami: bool = True,
- logging_module: Union[Any, ParallelLoggingManager] = logging) -> None:
+ logging_module: Any | ParallelLoggingManager = logging) -> None:
"""
Takes the information stored in the tests_data_keeper and prints it in a human readable way.
Args:
@@ -268,8 +268,8 @@ def collect_integrations(integrations_conf, skipped_integration, skipped_integra
integrations = []
test_skipped_integration = []
for integration in integrations_conf:
- if integration in skipped_integrations_conf.keys():
- skipped_integration.add("{0} - reason: {1}".format(integration, skipped_integrations_conf[integration]))
+ if integration in skipped_integrations_conf:
+ skipped_integration.add(f"{integration} - reason: {skipped_integrations_conf[integration]}")
test_skipped_integration.append(integration)
# string description
@@ -282,7 +282,7 @@ def collect_integrations(integrations_conf, skipped_integration, skipped_integra
def extract_filtered_tests():
- with open(FILTER_CONF, 'r') as filter_file:
+ with open(FILTER_CONF) as filter_file:
filtered_tests = [line.strip('\n') for line in filter_file.readlines()]
return filtered_tests
@@ -308,7 +308,7 @@ def load_env_results_json():
logging.warning(f"Did not find {env_results_path} file ")
return {}
- with open(env_results_path, 'r') as json_file:
+ with open(env_results_path) as json_file:
return json.load(json_file)
@@ -347,7 +347,7 @@ def get_server_numeric_version(ami_env, is_local_run=False):
def extract_server_numeric_version(instances_ami_name, default_version):
try:
- server_numeric_version = re.search(
+ server_numeric_version = re.search( # type: ignore[union-attr]
r'family/xsoar-(?:ga-)?(?P[a-z0-9\-]+)',
instances_ami_name
).group('version')
@@ -390,7 +390,7 @@ def get_test_records_of_given_test_names(tests_settings, tests_names_to_search):
def get_json_file(path):
- with open(path, 'r') as json_file:
+ with open(path) as json_file:
return json.loads(json_file.read())
@@ -433,7 +433,7 @@ def add_pr_comment(comment):
branch_name = os.environ['CI_COMMIT_BRANCH']
sha1 = os.environ['CI_COMMIT_SHA']
- query = '?q={}+repo:demisto/content+org:demisto+is:pr+is:open+head:{}+is:open'.format(sha1, branch_name)
+ query = f'?q={sha1}+repo:demisto/content+org:demisto+is:pr+is:open+head:{branch_name}+is:open'
url = 'https://api.github.com/search/issues'
headers = {'Authorization': 'Bearer ' + token}
try: