IPCalcReturnSubnetBroadcastAddress
An Automation Script to return subnet broadcast address.
- Type
- python
- Pack
- CommunityCommonScripts
Source
import demistomock as demisto # noqa: F401
from CommonServerPython import * # noqa: F401
from CommonServerUserPython import *
import ipaddress
import traceback
""" COMMAND FUNCTION """
def return_subnet_broadcast_address_command(args: Dict[str, Any]) -> CommandResults:
subnet = args.get("subnet", None)
broadcast_address = format(ipaddress.IPv4Network(subnet, strict=False).broadcast_address)
readable_output = tableToMarkdown(headers="Address:", t=broadcast_address, name="Broadcast Address")
return CommandResults(
outputs_prefix="IPCalc.IP.Address",
outputs_key_field="",
readable_output=readable_output,
outputs=broadcast_address,
)
""" MAIN FUNCTION """
def main():
try:
return_results(return_subnet_broadcast_address_command(demisto.args()))
except Exception as ex:
demisto.error(traceback.format_exc())
return_error(f"Failed to execute IPCalcReturnSubnetBroadcastAddress. Error: {str(ex)}")
""" ENTRY POINT """
if __name__ in ("__main__", "__builtin__", "builtins"):
main()
README
An Automation Script to return subnet broadcast address
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.Address |
Subnet addresses |
String |
Script Example
!IPCalcReturnSubnetBroadcastAddress subnet=192.168.10.10/15
Context Example
{
"IPCalc": {
"IP": {
"Address": "192.169.255.255"
}
}
}
Human Readable Output
Broadcast Address