Skip to content

Commit

Permalink
Add raw_result to IPNetwork (demisto#27913) (demisto#28489)
Browse files Browse the repository at this point in the history
* Add raw_result to IPNetwork

* change the type hints in the function return type to CommandResults as well

* Update Packs/CommonScripts/Scripts/IPNetwork/IPNetwork.py



* adding RL

* removing typing.Tuple

* docker update

---------

Co-authored-by: Martin <mail@martinspielmann.de>
Co-authored-by: Mai Morag <81917647+maimorag@users.noreply.github.com>
Co-authored-by: maimorag <mmorag@paloaltonetworks.com>
  • Loading branch information
4 people authored and xsoar-bot committed Aug 2, 2023
1 parent adbf815 commit 6c76581
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 12 deletions.
6 changes: 6 additions & 0 deletions Packs/CommonScripts/ReleaseNotes/1_12_6.md
@@ -0,0 +1,6 @@

#### Scripts

##### IPNetwork
- Added support for *raw_result* to *IPNetwork automation*.
- Updated the Docker image to: *demisto/python3:3.10.12.66339*.
19 changes: 9 additions & 10 deletions Packs/CommonScripts/Scripts/IPNetwork/IPNetwork.py
Expand Up @@ -2,7 +2,7 @@
from CommonServerPython import * # noqa: F401
# STD imports
import ipaddress
from typing import Dict, Tuple
from typing import Dict


# Local imports
Expand Down Expand Up @@ -34,7 +34,7 @@ def ip_cidr(cidr: str) -> Dict[str, str]:
return {}


def cidr_command(args: Dict[str, str]) -> Tuple[str, dict, str]:
def cidr_command(args: Dict[str, str]) -> CommandResults:
""" Perform command on given IP/CIDR
Args:
Expand All @@ -44,21 +44,20 @@ def cidr_command(args: Dict[str, str]) -> Tuple[str, dict, str]:
"""
cidr_list = argToList(args.get('cidr'))
ec = {'Network': [ip_cidr(cidr) for cidr in cidr_list]}
ec = [ip_cidr(cidr) for cidr in cidr_list]
markdown = tableToMarkdown(name=f'CIDR - {args.get("cidr")}',
t=ec.get('Network'),
t=ec,
removeNull=True)

return (
markdown,
ec,
""
return CommandResults(
outputs_prefix='Network',
outputs=ec,
readable_output=markdown
)


def main():
try:
return_outputs(*cidr_command(demisto.args()))
return_results(cidr_command(demisto.args()))
except Exception as ex:
return_error(f'Failed to execute IPNetwork script. Error: {str(ex)}')

Expand Down
2 changes: 1 addition & 1 deletion Packs/CommonScripts/Scripts/IPNetwork/IPNetwork.yml
Expand Up @@ -47,6 +47,6 @@ tags:
- ip
timeout: '0'
type: python
dockerimage: demisto/python3:3.10.12.63474
dockerimage: demisto/python3:3.10.12.66339
runas: DBotWeakRole
fromversion: 5.0.0
2 changes: 1 addition & 1 deletion Packs/CommonScripts/pack_metadata.json
Expand Up @@ -2,7 +2,7 @@
"name": "Common Scripts",
"description": "Frequently used scripts pack.",
"support": "xsoar",
"currentVersion": "1.12.5",
"currentVersion": "1.12.6",
"author": "Cortex XSOAR",
"url": "https://www.paloaltonetworks.com/cortex",
"email": "",
Expand Down

0 comments on commit 6c76581

Please sign in to comment.