Internet Protocol address operations.
- Copyright:
-
- Crown Copyright 2016
- License:
-
- Apache-2.0
- Source:
Members
-
<static, constant> INCLUDE_NETWORK_INFO
-
- Default Value:
-
- true
- Source:
-
<static, constant> ENUMERATE_ADDRESSES
-
- Default Value:
-
- true
- Source:
-
<static, constant> ALLOW_LARGE_LIST
-
- Source:
-
<static, constant> IPv4_REGEX
-
- Default Value:
-
- /^\s*((?:\d{1,3}\.){3}\d{1,3})\s*$/
- Source:
-
<static, constant> IPv6_REGEX
-
- Default Value:
-
- /^\s*(((?=.*::)(?!.*::.+::)(::)?([\dA-F]{1,4}:(:|\b)|){5}|([\dA-F]{1,4}:){6})((([\dA-F]{1,4}((?!\4)::|:\b|(?![\dA-F])))|(?!\3\4)){2}|(((2[0-4]|1\d|[1-9])?\d|25[0-5])\.?\b){4}))\s*$/i
- Source:
-
<static, constant> IP_FORMAT_LIST
-
- Default Value:
-
- ["Dotted Decimal","Decimal","Hex"]
- Source:
-
<static, constant> DELIM_OPTIONS
-
- Default Value:
-
- ["Line feed","CRLF","Space","Comma","Semi-colon"]
- Source:
-
<static, constant> GROUP_CIDR
-
- Default Value:
-
- 24
- Source:
-
<static, constant> GROUP_ONLY_SUBNET
-
- Source:
-
<private, static, constant> _LARGE_RANGE_ERROR
-
- Default Value:
-
- The specified range contains more than 65,536 addresses. Running this query could crash your browser. If you want to run it, select the "Allow large queries" option. You are advised to turn off "Auto Bake" whilst editing large ranges.
- Source:
Methods
-
<static> run_parse_ip_range(input, args)
-
Parse IP range operation.
Parameters:
Name Type Description inputstring argsArray.<Object> - Source:
Returns:
- Type
- string
-
<static> run_parse_ipv6(input, args)
-
Parse IPv6 address operation.
Parameters:
Name Type Description inputstring argsArray.<Object> - Source:
Returns:
- Type
- string
-
<static> run_change_ip_format(input, args)
-
Change IP format operation.
Parameters:
Name Type Description inputstring argsArray.<Object> - Source:
Returns:
- Type
- string
-
<static> run_group_ips(input, args)
-
Group IP addresses operation.
Parameters:
Name Type Description inputstring argsArray.<Object> - Source:
Returns:
- Type
- string
-
<private, static> _ipv4_cidr_range(cidr, include_network_info, enumerate_addresses, allow_large_list)
-
Parses an IPv4 CIDR range (e.g. 192.168.0.0/24) and displays information about it.
Parameters:
Name Type Description cidrRegExp include_network_infoboolean enumerate_addressesboolean allow_large_listboolean - Source:
Returns:
- Type
- string
-
<private, static> _ipv6_cidr_range(cidr, include_network_info)
-
Parses an IPv6 CIDR range (e.g. ff00::/48) and displays information about it.
Parameters:
Name Type Description cidrRegExp include_network_infoboolean - Source:
Returns:
- Type
- string
-
<private, static> _gen_ipv6_mask(cidr)
-
Generates an IPv6 subnet mask given a CIDR value.
Parameters:
Name Type Description cidrnumber - Source:
Returns:
- Type
- Array.<number>
-
<private, static> _ipv4_hyphenated_range(range, include_network_info, enumerate_addresses, allow_large_list)
-
Parses an IPv4 hyphenated range (e.g. 192.168.0.0 - 192.168.0.255) and displays information
about it.Parameters:
Name Type Description rangeRegExp include_network_infoboolean enumerate_addressesboolean allow_large_listboolean - Source:
Returns:
- Type
- string
-
<private, static> _ipv6_hyphenated_range(range, include_network_info)
-
Parses an IPv6 hyphenated range (e.g. ff00:: - ffff::) and displays information about it.
Parameters:
Name Type Description rangeRegExp include_network_infoboolean - Source:
Returns:
- Type
- string
-
<private, static> _str_to_ipv4(ip_str)
-
Converts an IPv4 address from string format to numerical format.
Parameters:
Name Type Description ip_strstring - Source:
Returns:
- Type
- number
Example
// returns 168427520 IP._str_to_ipv4("10.10.0.0"); -
<private, static> _ipv4_to_str(ip_int)
-
Converts an IPv4 address from numerical format to string format.
Parameters:
Name Type Description ip_intnumber - Source:
Returns:
- Type
- string
Example
// returns "10.10.0.0" IP._ipv4_to_str(168427520);
-
<private, static> _str_to_ipv6(ip_str)
-
Converts an IPv6 address from string format to numerical array format.
Parameters:
Name Type Description ip_strstring - Source:
Returns:
- Type
- Array.<number>
Example
// returns [65280, 0, 0, 0, 0, 0, 4369, 8738] IP._str_to_ipv6("ff00::1111:2222"); -
<private, static> _ipv6_to_str(ipv6, compact)
-
Converts an IPv6 address from numerical array format to string format.
Parameters:
Name Type Description ipv6Array.<number> compactboolean Whether or not to return the address in shorthand or not
- Source:
Returns:
- Type
- string
Example
// returns "ff00::1111:2222" IP._ipv6_to_str([65280, 0, 0, 0, 0, 0, 4369, 8738], true); // returns "ff00:0000:0000:0000:0000:0000:1111:2222" IP._ipv6_to_str([65280, 0, 0, 0, 0, 0, 4369, 8738], false);
-
<private, static> _generate_ipv4_range(ip, end_ip)
-
Generates a list of IPv4 addresses in string format between two given numerical values.
Parameters:
Name Type Description ipnumber end_ipnumber - Source:
Returns:
- Type
- Array.<string>
Example
// returns ["0.0.0.1", "0.0.0.2", "0.0.0.3"] IP._generate_ipv4_range(1, 3);
CyberChef