Lookup an IP address to find out which public cloud it originates from
This repository contains python3 code to find out which public cloud an IP address originates from.
Requirements
- Python3 (3.11)
- MaxMind license key (for GeoLite2 ASN database). This database is free subject to license restrictions by MaxMind. Sign up here.
Supported Clouds
- Amazon Web Services (AWS)
- Google Cloud Platform (GCP)
- Microsoft Azure
- Oracle Cloud Infrastructure (OCI)
- Hetzner
- DigitalOcean
- Linode
- Tencent
- OVH
- IBM Cloud
- Vultr
- Scaleway
- Fly.io
- Starlink (yes ok, not a cloud but it is up in the clouds right?)
How it works
For AWS, GCP, Azure and OCI this looks up the IPs using the publicly published IP ranges by these providers.
For the other providers it uses the MaxMind ASN database to lookup IP information.
Internally this is using the ipaddress module in python to do a search through the various CIDR blocks. In future this could be improved if the need arises.
Setup
- pip install tg_ip_lookup
- Prepare the database, execute
python -c "exec(\"import tg_ip_lookup\ntg_ip_lookup.cloudlookup.loadCloudProviderData.main(\'*MaxMind License Key*\')\")" - Try an IP lookup
python -c "exec(\"import tg_ip_lookup\ntg_ip_lookup.main(\'XXX.XXX.XXX.XXX\')\")"
Metadata
Release files for tg-ip-lookup 0.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 |
|---|---|---|---|---|
| tg_ip_lookup-0.0.1.tar.gz | 11.7 kB | Without provenance | Details for tg_ip_lookup-0.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| tg_ip_lookup-0.0.1-py3-none-any.whl | Python 3 | none | any | Details for tg_ip_lookup-0.0.1-py3-none-any.whl |
Total release size: 23.7 kB
Release files / tg_ip_lookup-0.0.1.tar.gz
| Download URL | tg_ip_lookup-0.0.1.tar.gz |
|---|---|
| Size | 11.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f97e088eb2db66eb6529f5b4158b1df9bbd403a5a0792f5e362ea764057b9424
|
|
BLAKE2b-256 checksum How to use checksums |
476ccba1b767d61cff856baf408f740b7626fbc7cab25b9c63f84c79a8a2f2cc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.12
|
Release files / tg_ip_lookup-0.0.1-py3-none-any.whl
| Download URL | tg_ip_lookup-0.0.1-py3-none-any.whl |
|---|---|
| Size | 12.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5bc802a22309e68e708dffbb588a4448d2bbecb5df56d107dcfd8d79e8cee922
|
|
BLAKE2b-256 checksum How to use checksums |
0057f393ae5e46611e5b357e91b5ac9b442613a1fa339ff266d2643edea5e916
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.12
|
Security for tg-ip-lookup 0.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.