Extract IP addresses from a log
Paste or open an access log, a firewall or VPN export, mail headers or an alert. IPv4 addresses are listed first and IPv6 after, each one once, in the order it first appears. Ports and brackets are left behind: 203.0.113.7:443 gives 203.0.113.7.
IPv4 checks
All four octets must be in 0-255, and the address must stand on its own, so the scanner does not take 1.2.3.4 out of 1.2.3.4.5 or 256.1.1.1. Private, loopback and reserved ranges are kept, because in a log they are often the interesting ones.
IPv6 normalisation
The same IPv6 address can be written many ways. Every match is parsed into its eight groups and printed in the RFC 5952 short form, so 2001:DB8:0:0:0:0:0:1, 2001:db8::0001 and 2001:db8::1 collapse into a single entry. IPv4-mapped addresses keep their dotted tail, as in ::ffff:192.0.2.1.
Next step
Take a list of addresses to the IP Subnet Calculator to see which block each belongs to, or to DNS Lookup for reverse records.