Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Fix Pylint errors in P packs #38069

Merged
merged 16 commits into from
Jan 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions Packs/PAN-OS/Integrations/Panorama/Panorama.py
Original file line number Diff line number Diff line change
Expand Up @@ -2227,11 +2227,16 @@ def panorama_edit_address_group_command(args: dict):
addresses_param: str
addresses_path: str
result: Any
addresses = []
if type_ == 'dynamic':
if not match:
raise Exception('To edit a Dynamic Address group, Please provide a match.')
match_param = add_argument_open(match, 'filter', False)
match_path = f"{XPATH_OBJECTS}address-group/entry[@name=\'{address_group_name}\']/dynamic/filter"
else:
match_param = ""
match_path = ""
demisto.debug(f"{type_=} -> {match_param=} {match_path=}")

if type_ == 'static':
if (element_to_add and element_to_remove) or (not element_to_add and not element_to_remove):
Expand All @@ -2253,6 +2258,10 @@ def panorama_edit_address_group_command(args: dict):
)
addresses_param = add_argument_list(addresses, 'member', False)
addresses_path = f"{XPATH_OBJECTS}address-group/entry[@name=\'{address_group_name}\']/static"
else:
addresses_param = ""
addresses_path = ""
demisto.debug(f"{type_=} -> {addresses_param=} {addresses_path=}")

description = args.get('description')
tags = argToList(args['tags']) if 'tags' in args else None
Expand All @@ -2270,6 +2279,7 @@ def panorama_edit_address_group_command(args: dict):
if DEVICE_GROUP:
address_group_output['DeviceGroup'] = DEVICE_GROUP

result = None
if type_ == 'dynamic' and match:
params['xpath'] = match_path
params['element'] = match_param
Expand Down Expand Up @@ -14354,6 +14364,9 @@ def profile_exception_crud_requests(args: dict, action_type: str) -> Any:
'xpath': xpath,
'key': API_KEY,
}
else:
params = {}
demisto.debug(f"{action_type=} -> {params=}")

try:
raw_response = http_request(URL, 'GET', params=params)
Expand Down
4 changes: 4 additions & 0 deletions Packs/PAN-OS/ReleaseNotes/2_3_3.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#### Integrations

##### Palo Alto Networks PAN-OS
Code functionality improvements.
2 changes: 1 addition & 1 deletion Packs/PAN-OS/pack_metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -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.3.2",
"currentVersion": "2.3.3",
"author": "Cortex XSOAR",
"url": "https://www.paloaltonetworks.com/cortex",
"email": "",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#### Scripts

##### CheckPanosVersionAffected
- Code functionality improvements.
- Updated the Docker image to: *demisto/python3:3.11.11.1940698*.
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@ def return_result_dataclass(result: list[Advisory]):
summary_list = [vars(x) for x in result]
title = result[0]._title
output_prefix = result[0]._output_prefix
else:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for next time, I'd simply remove the if condition since result is guaranteed to be a list. We will never be in the else block

title = ''
summary_list = []
outputs = []
output_prefix = ''
demisto.debug(f"The result isn't of type list. {title=} {summary_list=} {outputs=} {output_prefix=}")

readable_output = tableToMarkdown(title, summary_list)
command_result = CommandResults(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ script: '-'
subtype: python3
timeout: '0'
type: python
dockerimage: demisto/python3:3.11.10.115186
dockerimage: demisto/python3:3.11.11.1940698
fromversion: 5.5.0
tests:
- No tests (auto formatted)
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "Security Advisories by Palo Alto Networks",
"description": "Search CVE details from the Palo Alto Security Advisories website.",
"support": "xsoar",
"currentVersion": "1.0.8",
"currentVersion": "1.0.9",
"author": "Cortex XSOAR",
"url": "https://www.paloaltonetworks.com/cortex",
"email": "",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -560,7 +560,8 @@ def file_command(client: Client, args: Dict) -> List[CommandResults]:
"""
Get the reputation of a sha256 or a md5 representing an antivirus
"""

readable_output = ""
file_info: dict = {}
hashes = argToList(args.get("file"))
command_results_list: List[CommandResults] = []
dbot_reliability = DBotScoreReliability.get_dbot_score_reliability_from_str(
Expand Down Expand Up @@ -592,7 +593,7 @@ def file_command(client: Client, args: Dict) -> List[CommandResults]:
readable_output = (
f"Hash {_hash} antivirus reputation is unknown to Threat Vault."
)
file_info = None
file_info = {}
else:
raise

Expand Down Expand Up @@ -622,6 +623,9 @@ def file_command(client: Client, args: Dict) -> List[CommandResults]:
headers=HEADERS_FILE,
removeNull=True,
)
else:
file = Common.File(dbot_score=0)
demisto.debug("No response. Initialized file variable.")

command_results = CommandResults(
readable_output=readable_output,
Expand All @@ -636,7 +640,8 @@ def file_command(client: Client, args: Dict) -> List[CommandResults]:


def cve_command(client: Client, args: Dict) -> List[CommandResults]:

readable_output = ""
_cve = None
cves = argToList(args.get("cve"))
command_results_list: List[CommandResults] = []

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1295,7 +1295,7 @@ script:
- contextPath: ThreatVault.ATP.PCAP.Name
description: Threatvault ATP PCAP name.
type: string
dockerimage: demisto/crypto:1.0.0.114611
dockerimage: demisto/crypto:1.0.0.117163
isfetch: true
script: ''
subtype: python3
Expand Down
5 changes: 5 additions & 0 deletions Packs/PaloAltoNetworks_Threat_Vault/ReleaseNotes/2_0_17.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#### Integrations

##### Palo Alto Networks Threat Vault v2
- Code functionality improvements.
- Updated the Docker image to: *demisto/crypto:1.0.0.117163*.
2 changes: 1 addition & 1 deletion Packs/PaloAltoNetworks_Threat_Vault/pack_metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "Threat Vault by Palo Alto Networks",
"description": "Use the Palo Alto Networks Threat Vault to research the latest threats (vulnerabilities/exploits, viruses, and spyware) that Palo Alto Networks next-generation firewalls can detect and prevent.",
"support": "xsoar",
"currentVersion": "2.0.16",
"currentVersion": "2.0.17",
"author": "Cortex XSOAR",
"url": "https://www.paloaltonetworks.com/cortex",
"email": "",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#### Scripts

##### DlpAskFeedback
- Code functionality improvements.
- Updated the Docker image to: *demisto/python3:3.11.11.1940698*.
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,7 @@ def create_blocks(message: str, entitlement: str, reply: str) -> list:
def send_slack_message(entitlement, task, user_id, message):
lifetime = '1 day'
expiry_date = dateparser.parse('in ' + lifetime, settings={'TIMEZONE': 'UTC'})
if expiry_date:
expiry = datetime.strftime(expiry_date, DATE_FORMAT)
expiry = datetime.strftime(expiry_date, DATE_FORMAT) if expiry_date else None

entitlement_string = f'{entitlement}@{demisto.investigation().get("id")}'
if task:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ dependson:
should:
- SlackV3|||send-notification
runonce: false
dockerimage: demisto/python3:3.11.10.115186
dockerimage: demisto/python3:3.11.11.1940698
runas: DBotWeakRole
fromversion: 5.5.0
tests:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"support": "xsoar",
"author": "Palo Alto Networks Enterprise DLP",
"url": "https://www.paloaltonetworks.com/enterprise-data-loss-prevention",
"currentVersion": "2.0.14",
"currentVersion": "2.0.15",
"categories": [
"Network Security"
],
Expand Down
2 changes: 2 additions & 0 deletions Packs/PicusAutomation/Integrations/Picus/Picus.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,8 @@ def getThreatResults():
vector_name = attacker_peer + " - " + victim_peer
vectors_results = picus_threat_json_result["vectors"]

threat_result = ""
last_time = ""
for i in range(len(vectors_results)):
if vectors_results[i]["name"] == vector_name:
variants_results = vectors_results[i]["variants"]
Expand Down
Loading
Loading