dissect.target.helpers.regex.ipaddress¶
Module Contents¶
Functions¶
Extract IPv4 and IPv6 addresses from an input string. |
Attributes¶
- dissect.target.helpers.regex.ipaddress.IPV4_SEG = '(?:25[0-5]|2[0-4]\\d|[1]\\d\\d|[1-9]?\\d)'¶
- dissect.target.helpers.regex.ipaddress.IPV4_ADDR = '(?:(?:25[0-5]|2[0-4]\\d|[1]\\d\\d|[1-9]?\\d)\\.){3}(?:25[0-5]|2[0-4]\\d|[1]\\d\\d|[1-9]?\\d)(?:\...¶
- dissect.target.helpers.regex.ipaddress.IPV6_SEG = '(?:(?:[0-9a-fA-F]){1,4})'¶
- dissect.target.helpers.regex.ipaddress.IPV6_GROUPS¶
- dissect.target.helpers.regex.ipaddress.IPV6_ADDR = ''¶
- dissect.target.helpers.regex.ipaddress.IP_REGEX¶
- dissect.target.helpers.regex.ipaddress.extract_ips(text: str) list[str]¶
Extract IPv4 and IPv6 addresses from an input string.
Note:
910.12.34.569matches10.12.34.56, so always check your input!Deliberately does not find octal representations of IP addresses (e.g.
010.010.010.010) as this is generally discouraged and introduced ambiguity: the address could be interpreted as8.8.8.8or10.10.10.10. Most indexing services such as Elasticsearch also do not accept octal representations of IP addresses.References