IPCalcReturnSubnetNetwork
An Automation Script to return subnet network ID.
python · Community Common Scripts
Source
import demistomock as demisto # noqa: F401 from CommonServerPython import * # noqa: F401 from CommonServerUserPython import * import ipaddress import traceback """ COMMAND FUNCTION """ def return_subnet_network_command(args: Dict[str, Any]) -> CommandResults: subnet = args.get("subnet", None) network = format(ipaddress.IPv4Network(subnet, strict=False).network_address) readable_output = tableToMarkdown(headers="Network:", t=network, name="Subnet Network") return CommandResults( outputs_prefix="IPCalc.IP.Network", outputs_key_field="", readable_output=readable_output, outputs=network, ) """ MAIN FUNCTION """ def main(): try: return_results(return_subnet_network_command(demisto.args())) except Exception as ex: demisto.error(traceback.format_exc()) return_error(f"Failed to execute IPCalcReturnSubnetNetwork. Error: {str(ex)}") """ ENTRY POINT """ if __name__ in ("__main__", "__builtin__", "builtins"): main()
README
An Automation Script to return subnet network ID
Script Data
| Name | Description |
|---|---|
| Script Type | python3 |
| Tags | |
| Cortex XSOAR Version | 6.0.0 |
Inputs
| Argument Name | Description |
|---|---|
| subnet | Subnet to use |
Outputs
| Path | Description | Type |
|---|---|---|
| IPCalc.IP.Network | Subnet network | String |
Script Example
!IPCalcReturnSubnetNetwork subnet=87.248.100.215/28
Context Example
{
"IPCalc": {
"IP": {
"Network": "87.248.100.208"
}
}
}
Human Readable Output
Subnet Network
Network: 87.248.100.208