Skip to main content

Democritus functions for working with IP addresses.

Project description

Democritus IP Addresses

PyPI CI Lint codecov The Democritus Project uses semver version 2.0.0 The Democritus Project uses black to format code License: LGPL v3

Democritus functions[1] for working with IP addresses.

[1] Democritus functions are simple, effective, modular, well-tested, and well-documented Python functions.

We use d8s as an abbreviation for democritus (you can read more about this here).

Functions

  • def ipv4_address_examples(n: int = 10):
        """Create n ipv4 addresses."""
    
  • def ipv6_address_examples(n: int = 10):
        """Create n ipv6 addresses."""
    
  • def ipv4_addresses_find(text):
        """Parse IPv4 addresses from the given text."""
    
  • def ipv6_addresses_find(text):
        """Parse IPv6 addresses from the given text."""
    
  • def ip_addresses_find(text):
        """Parse ip addresses from the given text."""
    
  • def ip_is_private(ip):
        """Check if the IP address is private."""
    
  • def is_ip_address(text):
        """Determine whether or not the given text is an ip address."""
    
  • def ip_whois(ip):
        """Get whois information for the given ip address."""
    
  • def ip_is_reserved(ip):
        """Check if the IP address is IETF (https://www.ietf.org/) reserved."""
    
  • def ip_version(ip):
        """Get the version number of the ip address (4 or 6)."""
    
  • def ip_network_block_first_address(network_block: str):
        """Return the first address of the given network_block."""
    
  • def ip_network_block_last_address(network_block: str):
        """Return the first address of the given network_block."""
    
  • def ip_network_block_ip_count(network_block_string):
        """Get the number of IP addresses in the given network block."""
    
  • def ip_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>"."""
    
  • def ip_network_block_enumerate(network_block_string):
        """Return a list of all of the ip addresses in the given network_block_string."""
    
  • def ip_network_block_contains_ip(network_block: str, ip_address: str):
        """."""
    
  • def ip_in_network_block(ip_address: str, network_block: str):
        """Return whether or not the given ip_address is in the network_block."""
    
  • def ip_range_to_network_block(ip_range_string):
        """Take a range like "<starting-ip> - <ending-ip>" and convert this into an IP address network block."""
    
  • def ipv6_expand(ip_v6):
        """Expand (also known as 'Exploding') an ipv6 address."""
    
  • def ipv6_compress(ip_v6):
        """Compress an ipv6 address."""
    
  • def ipv6_threatconnect_form(ip_v6):
        """Format ipv6 address as expected by ThreatConnect."""
    
  • def ip_current():
        """Get the current ip address."""
    
  • def ipv4_private_addresses():
        """Get private ipv4 addresses from https://www.iana.org/assignments/iana-ipv4-special-registry/iana-ipv4-special-registry.xhtml."""
    
  • def ipv6_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."""
    
  • def ipv4_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)"""
    
  • def ipv4_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:

If you have any questions or there is anything we did not cover, please raise an issue and we'll be happy to help.

Credits

This package was created with Cookiecutter and Floyd Hightower's Python project template.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

d8s_ip_addresses-0.5.2.tar.gz (28.2 kB view details)

Uploaded Source

Built Distribution

d8s_ip_addresses-0.5.2-py2.py3-none-any.whl (24.4 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file d8s_ip_addresses-0.5.2.tar.gz.

File metadata

  • Download URL: d8s_ip_addresses-0.5.2.tar.gz
  • Upload date:
  • Size: 28.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.10.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4

File hashes

Hashes for d8s_ip_addresses-0.5.2.tar.gz
Algorithm Hash digest
SHA256 b90bf34640237fb64f6b4b3029aa539e97812fbdf0021b73fd20a65fd828ee66
MD5 7c20aad7d7df05edf4bdc85a91ba11dc
BLAKE2b-256 7d091f0ad074047732dfecae69f8358c0f92a4968ea6f83b64d8659e46140355

See more details on using hashes here.

File details

Details for the file d8s_ip_addresses-0.5.2-py2.py3-none-any.whl.

File metadata

  • Download URL: d8s_ip_addresses-0.5.2-py2.py3-none-any.whl
  • Upload date:
  • Size: 24.4 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.10.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4

File hashes

Hashes for d8s_ip_addresses-0.5.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 6300c347e89edf57bd66d2d7ecc7c55aefb40581e7224075f732cb334ac71a46
MD5 47cf7e86c53b13a524bb570a6fabc0c6
BLAKE2b-256 815ce183655d2b9938ad0f485a4c586ade3e2b7c56d6181de39c4f2dc21b95e3

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page