Package: d8s-ip-addresses
Democritus IP AddressesDemocritus functions[1]for working with IP addresses.[1] Democritus functions aresimple, effective, modular, well-tested, and well-documentedPython functions.We used8s(pronounced "dee-eights") as an abbreviation fordemocritus(you can read more about thishere).Installationpip install d8s-ip-addressesUsageYou import the library like:fromd8s_ip_addressesimport*Once imported, you can use any of the functions listed below.Functionsdefipv4_address_examples(n:int=10):"""Create n ipv4 addresses."""defipv6_address_examples(n:int=10):"""Create n ipv6 addresses."""defipv4_addresses_find(text):"""Parse IPv4 addresses from the given text."""defipv6_addresses_find(text):"""Parse IPv6 addresses from the given text."""defip_addresses_find(text):"""Parse ip addresses from the given text."""defip_is_private(ip):"""Check if the IP address is private."""defis_ip_address(text):"""Determine whether or not the given text is an ip address."""defip_whois(ip):"""Get whois information for the given ip address."""defip_is_reserved(ip):"""Check if the IP address is IETF (https://www.ietf.org/) reserved."""defip_version(ip):"""Get the version number of the ip address (4 or 6)."""defip_network_block_first_address(network_block:str):"""Return the first address of the given network_block."""defip_network_block_last_address(network_block:str):"""Return the first address of the given network_block."""defip_network_block_ip_count(network_block_string):"""Get the number of IP addresses in the given network block."""defip_network_block_to_range(network_block_string):"""Return the range of IP addresses covered by the network block in the form "<starting-ip> - <ending-ip>"."""defip_network_block_enumerate(network_block_string):"""Return a list of all of the ip addresses in the given network_block_string."""defip_network_block_contains_ip(network_block:str,ip_address:str):"""."""defip_in_network_block(ip_address:str,network_block:str):"""Return whether or not the given ip_address is in the network_block."""defip_range_to_network_block(ip_range_string):"""Take a range like "<starting-ip> - <ending-ip>" and convert this into an IP address network block."""defipv6_expand(ip_v6):"""Expand (also known as 'Exploding') an ipv6 address."""defipv6_compress(ip_v6):"""Compress an ipv6 address."""defipv6_threatconnect_form(ip_v6):"""Format ipv6 address as expected by ThreatConnect."""defip_current():"""Get the current ip address."""defipv4_private_addresses():"""Get private ipv4 addresses from https://www.iana.org/assignments/iana-ipv4-special-registry/iana-ipv4-special-registry.xhtml."""defipv6_private_addresses():"""Get private ipv6 addresses from https://www.iana.org/assignments/iana-ipv6-special-registry/iana-ipv6-special-registry.xhtml#iana-ipv6-special-registry-1."""defipv4_sum(ipv4_address):"""Find the sum of the ip address by adding each section of the ip address. For example, 8.8.8.8 would sum to 32 (calculated by taking 8 + 8 + 8 + 8)"""defipv4_is_possible_version_number(ipv4_address):"""Determine whether or not the ipv4 ip address is likely a version number or not. This is a beta function and is a work in progress. The word "Possible" in the function name should be taken seriously; this function will return `True` if the ipv4_address *might* be a version number. The results of this function are conjecture and should not be used definitively."""Development👋  If you want to get involved in this project, we have some short, helpful guides below:contribute to this project 🥇test it 🧪lint it 🧹explore it 🔭If you have any questions or there is anything we did not cover, please raise an issue and we'll be happy to help.CreditsThis package was created withCookiecutterand Floyd Hightower'sPython project template.