Check external net
Check domains, IPs, and hosts to ensure they are “external”
This is intended to be used to check user-entered host names to ensure that they only contain IP addresses, or domain names that are considered to be external to your system. No IP addresses that are reserved (eg 127.0.0.0/8, 192.168.0.0/16, fc00::/7) and no domains that aren’t children of a public suffix (eg *.com is okay, *.local is not).
Internal IP addresses (is_external_address)
If we are able to discern an IPv4 mapped address, that is passed through as the address to check rather than the original.
From there, all IPv4 reserved networks, and IPv6 reserved networks are considered “internal” (see is_global)
Internal domains (is_external_domain)
A domain is considered internal if it is not external.
A domain is considered external if the last suffix (the final part of a domain after the last . character) exists in the Mozilla public suffix registry.
Internal hosts (is_external_host)
Hosts are parsed as IP addresses via the ipaddress.ip_address function. If this succeeds, it’s treated to the rules of an internal IP address. Otherwise, it’s treated as a domain.
Usage
>>> check_external_net.is_external_host('127.0.0.1')
False
>>> check_external_net.is_external_host('::0')
False
>>> check_external_net.is_external_host('8.8.8.8')
True
>>> check_external_net.is_external_host('::ffff:8.8.8.8')
True
>>> check_external_net.is_external_host('localhost')
False
>>> check_external_net.is_external_host('cluster.local')
False
>>> check_external_net.is_external_host('google.com')
True
>>> check_external_net.is_external_host('dutyof.care')
True
Metadata
Release files for check-external-net 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| check_external_net-1.0.1.tar.gz | 3.2 kB | Without provenance | Details for check_external_net-1.0.1.tar.gz |
Release files / check_external_net-1.0.1.tar.gz
| Download URL | check_external_net-1.0.1.tar.gz |
|---|---|
| Size | 3.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
dac581f50dad10346b30ba66fe6c5897f61d81a1d4e36e5f20f6b3f66fa5c71e
|
|
BLAKE2b-256 checksum How to use checksums |
efd70405ffe734f7c42cd5dfa95bca36396ac66b5d785976c22ce4df3f2d0862
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.5.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.0
|
Security for check-external-net 1.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.