IsRFC1918Address
A filter that receives a single IPv4 address string as an input and determines whether it is in the private RFC-1918 address space (10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16). For more information, see https://en.wikipedia.org/wiki/Private_network
python · Filters And Transformers
Source
import demistomock as demisto from CommonServerPython import * from netaddr import IPAddress, IPNetwork def main(): try: args = demisto.args() ip_address = args.get("value") if not ip_address: ip_address = args.get("left") if not ip_address: raise Exception("Please enter an IPv4 Address either in the value or in the left arguments.") cidr_range_list = ["10.0.0.0/8", "172.16.0.0/12", "192.168.0.0/16"] for cidr in cidr_range_list: if IPAddress(ip_address) in IPNetwork(cidr): demisto.results(True) return demisto.results(False) except Exception as err: return_error(str(err)) if __name__ == "__builtin__" or __name__ == "builtins": main()
README
A filter that receives a single IPv4 address string as an input and determines whether it is in the private RFC-1918 address space (10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16). For more information, see https://en.wikipedia.org/wiki/Private_network
Script Data
| Name | Description |
|---|---|
| Script Type | python3 |
| Tags | filter |
| Cortex XSOAR Version | 5.0.0 |
Inputs
| Argument Name | Description |
|---|---|
| value | The IPv4 address to check. |
| left | The IPv4 address to check (can be used instead of the value argument). |
Outputs
There are no outputs for this script.