From be1da0489dfcb7d98f257bd6ba2cf49f85b907d0 Mon Sep 17 00:00:00 2001 From: keithcampbelljr Date: Mon, 29 Jan 2024 11:33:58 -0500 Subject: [PATCH 1/3] added new_appid to allowed parameters for ApplicationFilter. Need to test --- panos/objects.py | 106 ++++++++++++++++++++++++++++++++--------------- 1 file changed, 72 insertions(+), 34 deletions(-) diff --git a/panos/objects.py b/panos/objects.py index e5509cb6..09d4c8e2 100644 --- a/panos/objects.py +++ b/panos/objects.py @@ -97,7 +97,8 @@ def _setup(self): params.append( VersionedParamPath("static_value", path="static", vartype="member") ) - params.append(VersionedParamPath("dynamic_value", path="dynamic/filter")) + params.append(VersionedParamPath( + "dynamic_value", path="dynamic/filter")) params.append(VersionedParamPath("description", path="description")) params.append(VersionedParamPath("tag", path="tag", vartype="member")) @@ -245,15 +246,18 @@ def _setup(self): values=["tcp", "udp", "sctp"], ) params.append( - VersionedParamPath("source_port", path="protocol/{protocol}/source-port") + VersionedParamPath( + "source_port", path="protocol/{protocol}/source-port") ) params.append( - VersionedParamPath("destination_port", path="protocol/{protocol}/port") + VersionedParamPath("destination_port", + path="protocol/{protocol}/port") ) params.append(VersionedParamPath("description", path="description")) params.append(VersionedParamPath("tag", path="tag", vartype="member")) params.append( - VersionedParamPath("enable_override_timeout", default="no", exclude=True) + VersionedParamPath("enable_override_timeout", + default="no", exclude=True) ) params[-1].add_profile( "8.1.0", @@ -267,7 +271,8 @@ def _setup(self): condition={"enable_override_timeout": "yes"}, path="protocol/{protocol}/override/{enable_override_timeout}/timeout", ) - params.append(VersionedParamPath("override_half_close_timeout", exclude=True)) + params.append(VersionedParamPath( + "override_half_close_timeout", exclude=True)) params[-1].add_profile( "8.1.0", vartype="int", @@ -277,7 +282,8 @@ def _setup(self): }, path="protocol/{protocol}/override/{enable_override_timeout}/halfclose-timeout", ) - params.append(VersionedParamPath("override_time_wait_timeout", exclude=True)) + params.append(VersionedParamPath( + "override_time_wait_timeout", exclude=True)) params[-1].add_profile( "8.1.0", vartype="int", @@ -311,7 +317,8 @@ def _setup(self): # params params = [] - params.append(VersionedParamPath("value", path="members", vartype="member")) + params.append(VersionedParamPath( + "value", path="members", vartype="member")) params.append(VersionedParamPath("tag", path="tag", vartype="member")) self._params = tuple(params) @@ -422,12 +429,15 @@ def _setup(self): ) ) params.append(VersionedParamPath("parent_app", path="parent-app")) - params.append(VersionedParamPath("timeout", path="timeout", vartype="int")) + params.append(VersionedParamPath( + "timeout", path="timeout", vartype="int")) params.append( - VersionedParamPath("tcp_timeout", path="tcp-timeout", vartype="int") + VersionedParamPath( + "tcp_timeout", path="tcp-timeout", vartype="int") ) params.append( - VersionedParamPath("udp_timeout", path="udp-timeout", vartype="int") + VersionedParamPath( + "udp_timeout", path="udp-timeout", vartype="int") ) params.append( VersionedParamPath( @@ -484,7 +494,8 @@ def _setup(self): ) ) params.append( - VersionedParamPath("pervasive_use", path="pervasive-use", vartype="yesno") + VersionedParamPath( + "pervasive_use", path="pervasive-use", vartype="yesno") ) params.append( VersionedParamPath( @@ -492,10 +503,12 @@ def _setup(self): ) ) params.append( - VersionedParamPath("virus_ident", path="virus-ident", vartype="yesno") + VersionedParamPath( + "virus_ident", path="virus-ident", vartype="yesno") ) params.append( - VersionedParamPath("data_ident", path="data-ident", vartype="yesno") + VersionedParamPath( + "data_ident", path="data-ident", vartype="yesno") ) params.append(VersionedParamPath("description", path="description")) params.append(VersionedParamPath("tag", path="tag", vartype="member")) @@ -523,7 +536,8 @@ def _setup(self): # params params = [] - params.append(VersionedParamPath("value", path="members", vartype="member")) + params.append(VersionedParamPath( + "value", path="members", vartype="member")) params.append(VersionedParamPath("tag", path="tag", vartype="member")) self._params = tuple(params) @@ -574,6 +588,7 @@ class ApplicationFilter(VersionedPanObject): has_known_vulnerabilities (bool): pervasive (bool): tag (list): Administrative tags + new_appid (bool): """ @@ -587,15 +602,20 @@ def _setup(self): # params params = [] - params.append(VersionedParamPath("category", path="category", vartype="member")) + params.append(VersionedParamPath( + "category", path="category", vartype="member")) params.append( - VersionedParamPath("subcategory", path="subcategory", vartype="member") + VersionedParamPath( + "subcategory", path="subcategory", vartype="member") ) params.append( - VersionedParamPath("technology", path="technology", vartype="member") + VersionedParamPath( + "technology", path="technology", vartype="member") ) - params.append(VersionedParamPath("risk", path="risk", vartype="member")) - params.append(VersionedParamPath("evasive", path="evasive", vartype="yesno")) + params.append(VersionedParamPath( + "risk", path="risk", vartype="member")) + params.append(VersionedParamPath( + "evasive", path="evasive", vartype="yesno")) params.append( VersionedParamPath( "excessive_bandwidth_use", @@ -608,7 +628,8 @@ def _setup(self): "prone_to_misuse", path="prone-to-misuse", vartype="yesno" ) ) - params.append(VersionedParamPath("is_saas", path="is-saas", vartype="yesno")) + params.append(VersionedParamPath( + "is_saas", path="is-saas", vartype="yesno")) params.append( VersionedParamPath( "transfers_files", path="transfers-files", vartype="yesno" @@ -634,7 +655,11 @@ def _setup(self): params.append( VersionedParamPath("pervasive", path="pervasive", vartype="yesno") ) - params.append(VersionedParamPath("tag", path="tagging/tag", vartype="member")) + params.append(VersionedParamPath( + "tag", path="tagging/tag", vartype="member")) + + params.append(VersionedParamPath( + "new_appid", path="new-appid", vartype="yesno")) self._params = tuple(params) @@ -668,7 +693,8 @@ def _setup(self): params = [] params.append( - VersionedParamPath("applications", path="functions", vartype="member") + VersionedParamPath( + "applications", path="functions", vartype="member") ) self._params = tuple(params) @@ -699,16 +725,21 @@ def _setup(self): # params params = [] - params.append(VersionedParamPath("virus", path="virus", vartype="member")) - params.append(VersionedParamPath("spyware", path="spyware", vartype="member")) + params.append(VersionedParamPath( + "virus", path="virus", vartype="member")) + params.append(VersionedParamPath( + "spyware", path="spyware", vartype="member")) params.append( - VersionedParamPath("vulnerability", path="vulnerability", vartype="member") + VersionedParamPath( + "vulnerability", path="vulnerability", vartype="member") ) params.append( - VersionedParamPath("url_filtering", path="url-filtering", vartype="member") + VersionedParamPath( + "url_filtering", path="url-filtering", vartype="member") ) params.append( - VersionedParamPath("file_blocking", path="file-blocking", vartype="member") + VersionedParamPath( + "file_blocking", path="file-blocking", vartype="member") ) params.append( VersionedParamPath( @@ -745,7 +776,8 @@ def _setup(self): # params params = [] - params.append(VersionedParamPath("url_value", path="list", vartype="member")) + params.append(VersionedParamPath( + "url_value", path="list", vartype="member")) params.append(VersionedParamPath("description", path="description")) params.append(VersionedParamPath("type", exclude=True)) params[-1].add_profile("9.0.0", path="type") @@ -871,16 +903,20 @@ def _setup(self): ) ) params.append( - VersionedParamPath("snmp_profiles", vartype="member", path="send-snmptrap") + VersionedParamPath( + "snmp_profiles", vartype="member", path="send-snmptrap") ) params.append( - VersionedParamPath("email_profiles", vartype="member", path="send-email") + VersionedParamPath( + "email_profiles", vartype="member", path="send-email") ) params.append( - VersionedParamPath("syslog_profiles", vartype="member", path="send-syslog") + VersionedParamPath("syslog_profiles", + vartype="member", path="send-syslog") ) params.append( - VersionedParamPath("http_profiles", vartype="member", path="send-http") + VersionedParamPath( + "http_profiles", vartype="member", path="send-http") ) self._params = tuple(params) @@ -940,7 +976,8 @@ def _setup(self): params[-1].add_profile( "8.1.0", path="type/{action_type}/action", - values=["Azure-Security-Center-Integration", "add-tag", "remove-tag"], + values=["Azure-Security-Center-Integration", + "add-tag", "remove-tag"], ) params.append( VersionedParamPath( @@ -1164,7 +1201,8 @@ def _setup(self): # params params = [] - params.append(VersionedParamPath("address", path="address", vartype="member")) + params.append(VersionedParamPath( + "address", path="address", vartype="member")) params.append( VersionedParamPath( "latitude", path="geo-location/latitude", vartype="float" From 2fbf455a7a25cca1881167d32daec2ad7f347d0d Mon Sep 17 00:00:00 2001 From: Keith <41241700+keithcampbelljr@users.noreply.github.com> Date: Wed, 7 Feb 2024 22:48:27 -0500 Subject: [PATCH 2/3] Fixed formatting --- panos/objects.py | 105 ++++++++++++++++------------------------------- 1 file changed, 35 insertions(+), 70 deletions(-) diff --git a/panos/objects.py b/panos/objects.py index 09d4c8e2..d8f6e5e1 100644 --- a/panos/objects.py +++ b/panos/objects.py @@ -97,8 +97,7 @@ def _setup(self): params.append( VersionedParamPath("static_value", path="static", vartype="member") ) - params.append(VersionedParamPath( - "dynamic_value", path="dynamic/filter")) + params.append(VersionedParamPath("dynamic_value", path="dynamic/filter")) params.append(VersionedParamPath("description", path="description")) params.append(VersionedParamPath("tag", path="tag", vartype="member")) @@ -246,18 +245,15 @@ def _setup(self): values=["tcp", "udp", "sctp"], ) params.append( - VersionedParamPath( - "source_port", path="protocol/{protocol}/source-port") + VersionedParamPath("source_port", path="protocol/{protocol}/source-port") ) params.append( - VersionedParamPath("destination_port", - path="protocol/{protocol}/port") + VersionedParamPath("destination_port",path="protocol/{protocol}/port") ) params.append(VersionedParamPath("description", path="description")) params.append(VersionedParamPath("tag", path="tag", vartype="member")) params.append( - VersionedParamPath("enable_override_timeout", - default="no", exclude=True) + VersionedParamPath("enable_override_timeout",default="no", exclude=True) ) params[-1].add_profile( "8.1.0", @@ -271,8 +267,7 @@ def _setup(self): condition={"enable_override_timeout": "yes"}, path="protocol/{protocol}/override/{enable_override_timeout}/timeout", ) - params.append(VersionedParamPath( - "override_half_close_timeout", exclude=True)) + params.append(VersionedParamPath("override_half_close_timeout", exclude=True)) params[-1].add_profile( "8.1.0", vartype="int", @@ -282,8 +277,7 @@ def _setup(self): }, path="protocol/{protocol}/override/{enable_override_timeout}/halfclose-timeout", ) - params.append(VersionedParamPath( - "override_time_wait_timeout", exclude=True)) + params.append(VersionedParamPath("override_time_wait_timeout", exclude=True)) params[-1].add_profile( "8.1.0", vartype="int", @@ -317,8 +311,7 @@ def _setup(self): # params params = [] - params.append(VersionedParamPath( - "value", path="members", vartype="member")) + params.append(VersionedParamPath("value", path="members", vartype="member")) params.append(VersionedParamPath("tag", path="tag", vartype="member")) self._params = tuple(params) @@ -432,16 +425,13 @@ def _setup(self): params.append(VersionedParamPath( "timeout", path="timeout", vartype="int")) params.append( - VersionedParamPath( - "tcp_timeout", path="tcp-timeout", vartype="int") + VersionedParamPath("tcp_timeout", path="tcp-timeout", vartype="int") ) params.append( - VersionedParamPath( - "udp_timeout", path="udp-timeout", vartype="int") + VersionedParamPath("udp_timeout", path="udp-timeout", vartype="int") ) params.append( - VersionedParamPath( - "tcp_half_closed_timeout", path="tcp-half-closed-timeout", vartype="int" + VersionedParamPath("tcp_half_closed_timeout", path="tcp-half-closed-timeout", vartype="int" ) ) params.append( @@ -494,8 +484,7 @@ def _setup(self): ) ) params.append( - VersionedParamPath( - "pervasive_use", path="pervasive-use", vartype="yesno") + VersionedParamPath("pervasive_use", path="pervasive-use", vartype="yesno") ) params.append( VersionedParamPath( @@ -503,12 +492,10 @@ def _setup(self): ) ) params.append( - VersionedParamPath( - "virus_ident", path="virus-ident", vartype="yesno") + VersionedParamPath("virus_ident", path="virus-ident", vartype="yesno") ) params.append( - VersionedParamPath( - "data_ident", path="data-ident", vartype="yesno") + VersionedParamPath("data_ident", path="data-ident", vartype="yesno") ) params.append(VersionedParamPath("description", path="description")) params.append(VersionedParamPath("tag", path="tag", vartype="member")) @@ -536,8 +523,7 @@ def _setup(self): # params params = [] - params.append(VersionedParamPath( - "value", path="members", vartype="member")) + params.append(VersionedParamPath("value", path="members", vartype="member")) params.append(VersionedParamPath("tag", path="tag", vartype="member")) self._params = tuple(params) @@ -602,20 +588,15 @@ def _setup(self): # params params = [] - params.append(VersionedParamPath( - "category", path="category", vartype="member")) + params.append(VersionedParamPath("category", path="category", vartype="member")) params.append( - VersionedParamPath( - "subcategory", path="subcategory", vartype="member") + VersionedParamPath("subcategory", path="subcategory", vartype="member") ) params.append( - VersionedParamPath( - "technology", path="technology", vartype="member") + VersionedParamPath("technology", path="technology", vartype="member") ) - params.append(VersionedParamPath( - "risk", path="risk", vartype="member")) - params.append(VersionedParamPath( - "evasive", path="evasive", vartype="yesno")) + params.append(VersionedParamPath("risk", path="risk", vartype="member")) + params.append(VersionedParamPath("evasive", path="evasive", vartype="yesno")) params.append( VersionedParamPath( "excessive_bandwidth_use", @@ -628,8 +609,7 @@ def _setup(self): "prone_to_misuse", path="prone-to-misuse", vartype="yesno" ) ) - params.append(VersionedParamPath( - "is_saas", path="is-saas", vartype="yesno")) + params.append(VersionedParamPath("is_saas", path="is-saas", vartype="yesno")) params.append( VersionedParamPath( "transfers_files", path="transfers-files", vartype="yesno" @@ -655,11 +635,9 @@ def _setup(self): params.append( VersionedParamPath("pervasive", path="pervasive", vartype="yesno") ) - params.append(VersionedParamPath( - "tag", path="tagging/tag", vartype="member")) + params.append(VersionedParamPath("tag", path="tagging/tag", vartype="member")) - params.append(VersionedParamPath( - "new_appid", path="new-appid", vartype="yesno")) + params.append(VersionedParamPath("new_appid", path="new-appid", vartype="yesno")) self._params = tuple(params) @@ -693,8 +671,7 @@ def _setup(self): params = [] params.append( - VersionedParamPath( - "applications", path="functions", vartype="member") + VersionedParamPath("applications", path="functions", vartype="member") ) self._params = tuple(params) @@ -725,21 +702,16 @@ def _setup(self): # params params = [] - params.append(VersionedParamPath( - "virus", path="virus", vartype="member")) - params.append(VersionedParamPath( - "spyware", path="spyware", vartype="member")) + params.append(VersionedParamPath("virus", path="virus", vartype="member")) + params.append(VersionedParamPath("spyware", path="spyware", vartype="member")) params.append( - VersionedParamPath( - "vulnerability", path="vulnerability", vartype="member") + VersionedParamPath("vulnerability", path="vulnerability", vartype="member") ) params.append( - VersionedParamPath( - "url_filtering", path="url-filtering", vartype="member") + VersionedParamPath("url_filtering", path="url-filtering", vartype="member") ) params.append( - VersionedParamPath( - "file_blocking", path="file-blocking", vartype="member") + VersionedParamPath("file_blocking", path="file-blocking", vartype="member") ) params.append( VersionedParamPath( @@ -776,8 +748,7 @@ def _setup(self): # params params = [] - params.append(VersionedParamPath( - "url_value", path="list", vartype="member")) + params.append(VersionedParamPath("url_value", path="list", vartype="member")) params.append(VersionedParamPath("description", path="description")) params.append(VersionedParamPath("type", exclude=True)) params[-1].add_profile("9.0.0", path="type") @@ -903,20 +874,16 @@ def _setup(self): ) ) params.append( - VersionedParamPath( - "snmp_profiles", vartype="member", path="send-snmptrap") + VersionedParamPath("snmp_profiles", vartype="member", path="send-snmptrap") ) params.append( - VersionedParamPath( - "email_profiles", vartype="member", path="send-email") + VersionedParamPath("email_profiles", vartype="member", path="send-email") ) params.append( - VersionedParamPath("syslog_profiles", - vartype="member", path="send-syslog") + VersionedParamPath("syslog_profiles",vartype="member", path="send-syslog") ) params.append( - VersionedParamPath( - "http_profiles", vartype="member", path="send-http") + VersionedParamPath("http_profiles", vartype="member", path="send-http") ) self._params = tuple(params) @@ -976,8 +943,7 @@ def _setup(self): params[-1].add_profile( "8.1.0", path="type/{action_type}/action", - values=["Azure-Security-Center-Integration", - "add-tag", "remove-tag"], + values=["Azure-Security-Center-Integration","add-tag", "remove-tag"], ) params.append( VersionedParamPath( @@ -1201,8 +1167,7 @@ def _setup(self): # params params = [] - params.append(VersionedParamPath( - "address", path="address", vartype="member")) + params.append(VersionedParamPath("address", path="address", vartype="member")) params.append( VersionedParamPath( "latitude", path="geo-location/latitude", vartype="float" From ffae55746d1e11f706844ee20945ee98305db091 Mon Sep 17 00:00:00 2001 From: keithcampbelljr Date: Thu, 8 Feb 2024 10:15:54 -0500 Subject: [PATCH 3/3] Formatting fixed *again* disabled my autopep8 extension which was causing issues --- panos/objects.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/panos/objects.py b/panos/objects.py index d8f6e5e1..bd4e9107 100644 --- a/panos/objects.py +++ b/panos/objects.py @@ -248,12 +248,12 @@ def _setup(self): VersionedParamPath("source_port", path="protocol/{protocol}/source-port") ) params.append( - VersionedParamPath("destination_port",path="protocol/{protocol}/port") + VersionedParamPath("destination_port", path="protocol/{protocol}/port") ) params.append(VersionedParamPath("description", path="description")) params.append(VersionedParamPath("tag", path="tag", vartype="member")) params.append( - VersionedParamPath("enable_override_timeout",default="no", exclude=True) + VersionedParamPath("enable_override_timeout", default="no", exclude=True) ) params[-1].add_profile( "8.1.0", @@ -422,8 +422,7 @@ def _setup(self): ) ) params.append(VersionedParamPath("parent_app", path="parent-app")) - params.append(VersionedParamPath( - "timeout", path="timeout", vartype="int")) + params.append(VersionedParamPath("timeout", path="timeout", vartype="int")) params.append( VersionedParamPath("tcp_timeout", path="tcp-timeout", vartype="int") ) @@ -431,7 +430,8 @@ def _setup(self): VersionedParamPath("udp_timeout", path="udp-timeout", vartype="int") ) params.append( - VersionedParamPath("tcp_half_closed_timeout", path="tcp-half-closed-timeout", vartype="int" + VersionedParamPath( + "tcp_half_closed_timeout", path="tcp-half-closed-timeout", vartype="int" ) ) params.append( @@ -637,7 +637,9 @@ def _setup(self): ) params.append(VersionedParamPath("tag", path="tagging/tag", vartype="member")) - params.append(VersionedParamPath("new_appid", path="new-appid", vartype="yesno")) + params.append( + VersionedParamPath("new_appid", path="new-appid", vartype="yesno") + ) self._params = tuple(params) @@ -880,7 +882,7 @@ def _setup(self): VersionedParamPath("email_profiles", vartype="member", path="send-email") ) params.append( - VersionedParamPath("syslog_profiles",vartype="member", path="send-syslog") + VersionedParamPath("syslog_profiles", vartype="member", path="send-syslog") ) params.append( VersionedParamPath("http_profiles", vartype="member", path="send-http") @@ -943,7 +945,7 @@ def _setup(self): params[-1].add_profile( "8.1.0", path="type/{action_type}/action", - values=["Azure-Security-Center-Integration","add-tag", "remove-tag"], + values=["Azure-Security-Center-Integration", "add-tag", "remove-tag"], ) params.append( VersionedParamPath(