cloudiplookup


Namecloudiplookup JSON
Version 1.0.6 PyPI version JSON
download
home_pagehttps://github.com/rabuchaim/cloudiplookup
SummaryCloud IP Lookup is a Pure Python application and library for Python 3 to verify which cloud platform a given IP address belongs to (AWS, Azure, Cloudflare, DigitalOcean, Google Services/Cloud, JD Cloud and Oracle Cloud).
upload_time2024-07-24 23:48:40
maintainerRicardo Abuchaim
docs_urlNone
authorRicardo Abuchaim
requires_pythonNone
licenseMIT
keywords cloudiplookup cloud ip lookup geoip aws azure gcp pure-python purepython pure python oracle cloud oci digitalocean digital ocean
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Cloud IP Lookup v1.0.6
Cloud IP Lookup is a Pure Python application and library for Python 3 to verify which cloud platform a given IP address belongs to. Its supports IPv4 and IPv6, and have its own database that can be updated whenever you want with a simple command: ```cloudiplookup --update [--verbose]```

**Cloud IP Lookup does not connect to your cloud services account**. All data is collected from the websites of the most popular cloud service providers. Sometimes these databases are updated several times a day. We recommend that you put the update command in your crontab, at least once a day.

This version has data from AWS, Azure, Cloudflare, Digital Ocean, Google Services (Google Bot, Special Crawlers and User Fetchers), Google Cloud, JD Cloud China and Oracle Cloud providers. Some of them provide the names of services and regions, others donĀ“t, like Cloudflare that only provides the network ranges.

We can add other cloud providers, just open an issue at https://github.com/rabuchaim/cloudiplookup/issues. The requirement for addition is that the cloud provider must have a page where its network ranges are published in json, txt or csv format. For example, AWS: https://ip-ranges.amazonaws.com/ip-ranges.json.


## Installation

```bash
pip install cloudiplookup
```
Or cloning from Github
```bash
git clone https://github.com/rabuchaim/cloudiplookup.git
```

## How to use it as a Python library

```bash
# python3
Python 3.11.6 (main, Oct 23 2023, 22:48:54) [GCC 11.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from cloudiplookup import CloudIPLookup
>>> myLookup = CloudIPLookup(verbose=True)
Cloud IP Lookup v1.0.5 is ready! loaded with 48526 networks in 0.00633 seconds and using 4.16 MiB of RAM.
>>> print(myLookup.lookup('52.94.7.24').pp_json())
{
   "ip": "52.94.7.24",
   "cidr": "52.94.7.0/24",
   "region": "sa-east-1",
   "cloud_provider": "AWS",
   "service": "DYNAMODB",
   "elapsed_time": "0.000128607 sec"
}
>>>
>>> result = myLookup.lookup('52.94.7.24')
>>> print(result.cloud_provider)
AWS
>>> print(result.region)
sa-east-1
>>>
>>> result.to_dict()['cloud_provider']
'AWS'
>>> result.to_dict()['region']
'sa-east-1'
>>>
>>> myLookup.get_database_info()
{
   "AWS": {
      "last_updated": "2024-07-24 21:33:10",
      "total_networks": 7632,
      "total_ipv4": 145103465,
      "total_ipv6": 2340885926027723825138381094922
   },
   "Azure": {
      "last_updated": "2024-07-23 10:15:04",
      "total_networks": 44388,
      "total_ipv4": 85522162,
      "total_ipv6": 2787683180039384255618424539
   },
   "Cloudflare": {
      "last_updated": "2024-07-24 23:21:45",
      "total_networks": 22,
      "total_ipv4": 1524736,
      "total_ipv6": 1109194275199700726309615304704
   },
   "Digital Ocean": {
      "last_updated": "2024-07-24 23:04:48",
      "total_networks": 1141,
      "total_ipv4": 2943360,
      "total_ipv6": 2637884402540465881088
   },
   "Google Cloud": {
      "last_updated": "2024-07-24 13:06:03",
      "total_networks": 670,
      "total_ipv4": 13074688,
      "total_ipv6": 832949889714479501372555264
   },
   "Google Services": {
      "last_updated": "2024-07-24 13:06:03",
      "total_networks": 73,
      "total_ipv4": 18049280,
      "total_ipv6": 2060551195390515467569592270848
   },
   "Google Bot": {
      "last_updated": "2024-07-23 22:00:20",
      "total_networks": 229,
      "total_ipv4": 3712,
      "total_ipv6": 1918461383665793368064
   },
   "Google Special Crawlers": {
      "last_updated": "2024-07-23 22:00:20",
      "total_networks": 208,
      "total_ipv4": 3328,
      "total_ipv6": 1918461383665793368064
   },
   "Google User Triggered Fetchers": {
      "last_updated": "2024-07-23 22:00:20",
      "total_networks": 729,
      "total_ipv4": 11680,
      "total_ipv6": 6733061586903986339840
   },
   "JD Cloud": {
      "last_updated": "2024-07-24 23:21:48",
      "total_networks": 91,
      "total_ipv4": 1568,
      "total_ipv6": 121056757983718932480
   },
   "Oracle Cloud": {
      "last_updated": "2024-07-15 09:52:55",
      "total_networks": 745,
      "total_ipv4": 2643530,
      "total_ipv6": 0
   }
}
>>>
>>> from cloudiplookup import update_ip_ranges
>>> update_ip_ranges(verbose=True,debug=False)
Updating AWS - Downloading IP ranges file [0.194571811 sec]
Updating AWS - Parsing IPv4 and IPv6 ranges updated at 2023-11-14 14:13:09 [0.008731522 sec]
Updating AZURE - Downloading IP ranges file [9.597737358 sec]
Updating AZURE - Parsing IPv4 and IPv6 ranges updated at 2023-11-14 12:29:44 [0.064075109 sec]
Updating CLOUDFLARE - Downloading IP ranges file [0.109633796 sec]
Updating CLOUDFLARE - Parsing IPv4 and IPv6 ranges updated at 2023-11-15 05:23:41 [0.000105514 sec]
Updating DIGITAL OCEAN - Downloading IP ranges file [0.447540575 sec]
Updating DIGITAL OCEAN - Parsing IPv4 and IPv6 ranges updated at 2023-11-14 17:43:11 [0.004395924 sec]
Updating GCP - Downloading IP ranges file [0.197874399 sec]
Updating GCP - Parsing IPv4 and IPv6 ranges updated at 2023-11-14 18:04:10 [0.001701975 sec]
Updating GOOGLE SERVICES - Downloading IP ranges file [0.294104148 sec]
Updating GOOGLE SERVICES - Parsing IPv4 and IPv6 ranges updated at 2023-11-14 18:04:10 [0.000351157 sec]
Updating GOOGLE BOT - Downloading IP ranges file [0.396489796 sec]
Updating GOOGLE BOT - Parsing IPv4 and IPv6 ranges updated at 2023-11-14 23:00:21 [0.000692362 sec]
Updating GOOGLE SPECIAL CRAWLERS - Downloading IP ranges file [0.350542481 sec]
Updating GOOGLE SPECIAL CRAWLERS - Parsing IPv4 and IPv6 ranges updated at 2023-11-14 23:00:25 [0.000751040 sec]
Updating GOOGLE USER TRIGGERED FETCHERS - Downloading IP ranges file [0.564765383 sec]
Updating GOOGLE USER TRIGGERED FETCHERS - Parsing IPv4 and IPv6 ranges updated at 2023-11-14 23:00:22 [0.001925866 sec]
Updating JD CLOUD - Downloading IP ranges file [0.375312087 sec]
Updating JD CLOUD - Parsing IPv4 and IPv6 ranges updated at 2023-11-15 05:23:44 [0.000438635 sec]
Updating ORACLE - Downloading IP ranges file [1.007827670 sec]
Updating ORACLE - Parsing IPv4 and IPv6 ranges updated at 2023-10-10 04:47:03 [0.001333245 sec]
Sorting IPv4 and IPv6 data [0.019742529 sec]
Updating all lists... Done! [0.042858025 sec]
Saved file /var/lib/cloudiplookup/cloudiplookup.dat.gz [0.200645894 sec]
Cloud IP Lookup updated with success! [13.629677833 sec]
>>>
```

## The database file

Cloud IP Lookup uses a pickle database that is a bunch of lists of integers. Everything is located at ```/var/lib/cloudiplookup/```. 

> *On Windows systems, these files are located in the same directory as the library files*.

```bash
root@tucupi:/var/lib/cloudiplookup# ll
total 184
drwxr-xr-x  2 root root   4096 Nov  6 00:21 ./
drwxr-xr-x 47 root root   4096 Oct 11 21:11 ../
-rw-r--r--  1 root root 172158 Nov  6 00:15 cloudiplookup.dat.gz
-rw-r--r--  1 root root    942 Sep 29 10:53 cloudiplookup.json
```

There is a file ```/var/lib/cloudiplookup/cloudiplookup.json``` with all cloud providers information and an another file ```/var/lib/cloudiplookup/cloudiplookup.dat.gz``` that is the database created by function ```update_ip_ranges()```.

```bash
root@tambaqui:/var/lib/cloudiplookup# cat cloudiplookup.json
{
    "AWS": {
        "info_page": "https://docs.aws.amazon.com/vpc/latest/userguide/aws-ip-ranges.html",
        "download_url": "https://ip-ranges.amazonaws.com/ip-ranges.json"
    },
    "AZURE": {
        "info_page": "https://www.microsoft.com/en-us/download/details.aspx?id=56519",
        "download_url": "https://download.microsoft.com/download/(...)/ServiceTags_Public_XXXXXXXX.json"
    },
    "CLOUDFLARE": {
        "info_page": "https://www.cloudflare.com/ips/",
        "download_url": "https://api.cloudflare.com/client/v4/ips"
    },
    "DIGITALOCEAN": {
        "info_page": "https://docs.digitalocean.com/products/platform/",
        "download_url": "https://www.digitalocean.com/geo/google.csv"
    },
    "GOOGLECLOUD": {
        "info_page": "https://support.google.com/a/answer/10026322?hl=en",
        "download_url": "https://www.gstatic.com/ipranges/cloud.json"
    },
    "GOOGLESERVICES": {
        "info_page": "https://support.google.com/a/answer/10026322?hl=en",
        "download_url": "https://www.gstatic.com/ipranges/goog.json"
    },    
    "JDCLOUD": {
        "info_page": "https://www.cloudflare.com/ips/",
        "download_url": "https://api.cloudflare.com/client/v4/ips?networks=jdcloud"
    },
    "ORACLE": {
        "info_page": "https://docs.oracle.com/pt-br/iaas/Content/General/Concepts/addressranges.htm",
        "download_url": "https://docs.oracle.com/iaas/tools/public_ip_ranges.json"
    }
}
```

## Use as a command line application

```bash
# cloudiplookup
root@pirarara:/var/lib/cloudiplookup# ./cloudiplookup.py
Usage: cloudiplookup.py [--csv] [--info] [--pretty] [--update] [--show-config-file] [--verbose] [--debug] [--help] [--version] [ipaddr,ipaddrN...]

Cloud IP Lookup v1.0.5 - Public cloud services IP addresses lookup tool

Lookup Parameters:
  ipaddr,ipaddrN...   Supply one or more IP address separated by comma.

Output Options:
  --csv, -c           Print output in csv format (ip,cidr,region,cloud_provider,service,elapsed_time).

Database Options:
  --update, -u        Updates IP ranges directly from cloud service providers. Use -v to see updating progress.
  --info, -i          Shows information about the current database file in json format.
  --pretty, -p        Shows information about the current database file in a table format.
  --show-config-file  Displays the available settings for downloading information about network ranges.

More Options:
  --verbose, -v       Shows useful messages about each step that application is doing.
  --debug, -d         Save all data from cloud providers in the data directory. Debug is not verbose!
  --help, -h, -?      Shows this help message about the allowed commands.
  --version           Shows the application version.
```

```bash
# cloudiplookup 3.2.35.65,5.101.104.55,66.249.66.193,2600:9000:21e8:2600:1:5a19:8b40:93a1,104.198.16.10,13.71.199.112
{
   "ip": "3.2.35.65",
   "cidr": "3.2.35.64/26",
   "region": "sa-east-1",
   "cloud_provider": "AWS",
   "service": "EC2",
   "elapsed_time": "0.000016832 sec"
}
{
   "ip": "5.101.104.55",
   "cidr": "5.101.104.0/22",
   "region": "NL-NH Amsterdam",
   "cloud_provider": "Digital Ocean",
   "service": "",
   "elapsed_time": "0.000002593 sec"
}
{
   "ip": "66.249.66.193",
   "cidr": "66.249.66.192/27",
   "region": "",
   "cloud_provider": "Google",
   "service": "Bot",
   "elapsed_time": "0.000031584 sec"
}
{
   "ip": "2600:9000:21e8:2600:1:5a19:8b40:93a1",
   "cidr": "2600:9000:2000::/36",
   "region": "GLOBAL",
   "cloud_provider": "AWS",
   "service": "CLOUDFRONT",
   "elapsed_time": "0.000024586 sec"
}
{
   "ip": "104.198.16.10",
   "cidr": "104.198.16.0/20",
   "region": "us-central1",
   "cloud_provider": "Google Cloud",
   "service": "Google Cloud",
   "elapsed_time": "0.000026428 sec"
}
{
   "ip": "13.71.199.112",
   "cidr": "13.71.199.112/30",
   "region": "westcentralus",
   "cloud_provider": "Azure",
   "service": "ActionGroup",
   "elapsed_time": "0.000004339 sec"
}
 ```
```bash
# cloudiplookup --csv 3.2.35.65,5.101.104.55,2600:9000:21e8:2600:1:5a19:8b40:93a1,8.35.192.12,13.71.199.112
3.2.35.65,3.2.35.64/26,sa-east-1,AWS,EC2,0.000019659
5.101.104.55,5.101.104.0/22,NL-NH Amsterdam,Digital Ocean,,0.000002078
2600:9000:21e8:2600:1:5a19:8b40:93a1,2600:9000:2000::/36,GLOBAL,AWS,CLOUDFRONT,0.000028556
8.35.192.12,8.35.192.0/20,,Google Cloud,,0.000004661
13.71.199.112,13.71.199.112/30,westcentralus,Azure,ActionGroup,0.000004508
```
```bash
# cloudiplookup --update --verbose
Updating AWS - Downloading IP ranges file [0.247580905 sec]
Updating AWS - Parsing IPv4 and IPv6 ranges updated at 2023-11-14 14:13:09 [0.007899989 sec]
Updating AZURE - Downloading IP ranges file [11.802777994 sec]
Updating AZURE - Parsing IPv4 and IPv6 ranges updated at 2023-11-14 12:29:44 [0.069718062 sec]
Updating CLOUDFLARE - Downloading IP ranges file [0.096246977 sec]
Updating CLOUDFLARE - Parsing IPv4 and IPv6 ranges updated at 2023-11-15 05:24:27 [0.000107779 sec]
Updating DIGITAL OCEAN - Downloading IP ranges file [0.715709110 sec]
Updating DIGITAL OCEAN - Parsing IPv4 and IPv6 ranges updated at 2023-11-14 17:43:11 [0.004408466 sec]
Updating GOOGLE CLOUD - Downloading IP ranges file [0.243777335 sec]
Updating GOOGLE CLOUD - Parsing IPv4 and IPv6 ranges updated at 2023-11-14 18:04:10 [0.000553817 sec]
Updating GOOGLE SERVICES - Downloading IP ranges file [0.219680303 sec]
Updating GOOGLE SERVICES - Parsing IPv4 and IPv6 ranges updated at 2023-11-14 18:04:10 [0.000346342 sec]
Updating GOOGLE BOT - Downloading IP ranges file [0.488023029 sec]
Updating GOOGLE BOT - Parsing IPv4 and IPv6 ranges updated at 2023-11-14 23:00:21 [0.000280338 sec]
Updating GOOGLE SPECIAL CRAWLERS - Downloading IP ranges file [0.362579674 sec]
Updating GOOGLE SPECIAL CRAWLERS - Parsing IPv4 and IPv6 ranges updated at 2023-11-14 23:00:25 [0.000616955 sec]
Updating GOOGLE USER TRIGGERED FETCHERS - Downloading IP ranges file [0.587292662 sec]
Updating GOOGLE USER TRIGGERED FETCHERS - Parsing IPv4 and IPv6 ranges updated at 2023-11-14 23:00:22 [0.001841709 sec]
Updating JD CLOUD - Downloading IP ranges file [0.391410524 sec]
Updating JD CLOUD - Parsing IPv4 and IPv6 ranges updated at 2023-11-15 05:24:30 [0.000430358 sec]
Updating ORACLE - Downloading IP ranges file [0.732044416 sec]
Updating ORACLE - Parsing IPv4 and IPv6 ranges updated at 2023-10-10 04:47:03 [0.001720133 sec]
Sorting IPv4 and IPv6 data [0.021423362 sec]
Updating all lists... Done! [0.028821872 sec]
Saved file /var/lib/cloudiplookup/cloudiplookup.dat.gz [0.203250980 sec]
Cloud IP Lookup updated with success! [15.981186821 sec]
```
```bash
# ./cloudiplookup.py --info --pretty
AWS.............................: 7251 networks   - Last update: 2023-11-14 14:13:09
Azure...........................: 39244 networks  - Last update: 2023-11-14 12:29:44
Cloudflare......................: 22 networks     - Last update: 2023-11-15 05:24:27
Digital Ocean...................: 1683 networks   - Last update: 2023-11-14 17:43:11
Google Cloud....................: 652 networks    - Last update: 2023-11-14 18:04:10
Google Services.................: 61 networks     - Last update: 2023-11-14 18:04:10
Google Bot......................: 231 networks    - Last update: 2023-11-14 23:00:21
Google Special Crawlers.........: 210 networks    - Last update: 2023-11-14 23:00:25
Google User Triggered Fetchers..: 719 networks    - Last update: 2023-11-14 23:00:22
JD Cloud........................: 115 networks    - Last update: 2023-11-15 05:24:30
Oracle Cloud....................: 647 networks    - Last update: 2023-10-10 04:47:03
```
## Debug mode

If you update the data using the ```--debug``` option, all files downloaded from cloud service providers will be available in the ```/var/lib/cloudiplookup``` directory. 

> *On Windows systems, these files are located in the same directory as the library files*.

```bash
root@pirarara:/var/lib/cloudiplookup# ll
total 20368
drwxr-xr-x 3 ricardo ricardo     4096 Nov 15 01:54 ./
drwxr-xr-x 6 ricardo root        4096 Nov  7 23:58 ../
-rw-r--r-- 1 root    root    10484261 Nov 15 01:54 cloudip.json
-rw-r--r-- 1 root    root      177903 Nov 15 01:54 cloudiplookup.dat.gz
-rw-r--r-- 1 root    root     4479551 Nov 15 01:54 cloudiplookup.dat.json
-rw-r--r-- 1 root    root        1448 Nov 15 01:31 cloudiplookup.json
-rw-r--r-- 1 root    root     1666844 Nov 15 02:22 ipranges-aws.json
-rw-r--r-- 1 root    root     3678383 Nov 15 02:22 ipranges-azure.json
-rw-r--r-- 1 root    root         788 Nov 15 02:22 ipranges-cloudflare.json
-rw-r--r-- 1 root    root       71987 Nov 15 02:22 ipranges-digitalocean.csv
-rw-r--r-- 1 root    root       83122 Nov 15 02:22 ipranges-gcp.json
-rw-r--r-- 1 root    root        4934 Nov 15 02:22 ipranges-goog.json.json
-rw-r--r-- 1 root    root       14358 Nov 15 02:22 ipranges-googlebot.json.json
-rw-r--r-- 1 root    root        4527 Nov 15 02:22 ipranges-jdcloud.json
-rw-r--r-- 1 root    root       93165 Nov 15 02:23 ipranges-oracle.json
-rw-r--r-- 1 root    root       13289 Nov 15 02:22 ipranges-special-crawlers.json.json
-rw-r--r-- 1 root    root       43826 Nov 15 02:22 ipranges-user-triggered-fetchers.json.json
```

## Sugestions, feedbacks, bugs, new cloud service provider requests...
E-mail me: ricardoabuchaim at gmail.com


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/rabuchaim/cloudiplookup",
    "name": "cloudiplookup",
    "maintainer": "Ricardo Abuchaim",
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": "ricardoabuchaim@gmail.com",
    "keywords": "cloudiplookup, cloud ip lookup, geoip, aws, azure, gcp, pure-python, purepython, pure python, oracle cloud, oci, digitalocean, digital ocean",
    "author": "Ricardo Abuchaim",
    "author_email": "ricardoabuchaim@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/59/25/e5f3f339ebb150a2e07d6dbfcc9c55bb0cd6116749b689b0f1cce488b882/cloudiplookup-1.0.6.tar.gz",
    "platform": null,
    "description": "# Cloud IP Lookup v1.0.6\nCloud IP Lookup is a Pure Python application and library for Python 3 to verify which cloud platform a given IP address belongs to. Its supports IPv4 and IPv6, and have its own database that can be updated whenever you want with a simple command: ```cloudiplookup --update [--verbose]```\n\n**Cloud IP Lookup does not connect to your cloud services account**. All data is collected from the websites of the most popular cloud service providers. Sometimes these databases are updated several times a day. We recommend that you put the update command in your crontab, at least once a day.\n\nThis version has data from AWS, Azure, Cloudflare, Digital Ocean, Google Services (Google Bot, Special Crawlers and User Fetchers), Google Cloud, JD Cloud China and Oracle Cloud providers. Some of them provide the names of services and regions, others don\u00b4t, like Cloudflare that only provides the network ranges.\n\nWe can add other cloud providers, just open an issue at https://github.com/rabuchaim/cloudiplookup/issues. The requirement for addition is that the cloud provider must have a page where its network ranges are published in json, txt or csv format. For example, AWS: https://ip-ranges.amazonaws.com/ip-ranges.json.\n\n\n## Installation\n\n```bash\npip install cloudiplookup\n```\nOr cloning from Github\n```bash\ngit clone https://github.com/rabuchaim/cloudiplookup.git\n```\n\n## How to use it as a Python library\n\n```bash\n# python3\nPython 3.11.6 (main, Oct 23 2023, 22:48:54) [GCC 11.4.0] on linux\nType \"help\", \"copyright\", \"credits\" or \"license\" for more information.\n>>> from cloudiplookup import CloudIPLookup\n>>> myLookup = CloudIPLookup(verbose=True)\nCloud IP Lookup v1.0.5 is ready! loaded with 48526 networks in 0.00633 seconds and using 4.16 MiB of RAM.\n>>> print(myLookup.lookup('52.94.7.24').pp_json())\n{\n   \"ip\": \"52.94.7.24\",\n   \"cidr\": \"52.94.7.0/24\",\n   \"region\": \"sa-east-1\",\n   \"cloud_provider\": \"AWS\",\n   \"service\": \"DYNAMODB\",\n   \"elapsed_time\": \"0.000128607 sec\"\n}\n>>>\n>>> result = myLookup.lookup('52.94.7.24')\n>>> print(result.cloud_provider)\nAWS\n>>> print(result.region)\nsa-east-1\n>>>\n>>> result.to_dict()['cloud_provider']\n'AWS'\n>>> result.to_dict()['region']\n'sa-east-1'\n>>>\n>>> myLookup.get_database_info()\n{\n   \"AWS\": {\n      \"last_updated\": \"2024-07-24 21:33:10\",\n      \"total_networks\": 7632,\n      \"total_ipv4\": 145103465,\n      \"total_ipv6\": 2340885926027723825138381094922\n   },\n   \"Azure\": {\n      \"last_updated\": \"2024-07-23 10:15:04\",\n      \"total_networks\": 44388,\n      \"total_ipv4\": 85522162,\n      \"total_ipv6\": 2787683180039384255618424539\n   },\n   \"Cloudflare\": {\n      \"last_updated\": \"2024-07-24 23:21:45\",\n      \"total_networks\": 22,\n      \"total_ipv4\": 1524736,\n      \"total_ipv6\": 1109194275199700726309615304704\n   },\n   \"Digital Ocean\": {\n      \"last_updated\": \"2024-07-24 23:04:48\",\n      \"total_networks\": 1141,\n      \"total_ipv4\": 2943360,\n      \"total_ipv6\": 2637884402540465881088\n   },\n   \"Google Cloud\": {\n      \"last_updated\": \"2024-07-24 13:06:03\",\n      \"total_networks\": 670,\n      \"total_ipv4\": 13074688,\n      \"total_ipv6\": 832949889714479501372555264\n   },\n   \"Google Services\": {\n      \"last_updated\": \"2024-07-24 13:06:03\",\n      \"total_networks\": 73,\n      \"total_ipv4\": 18049280,\n      \"total_ipv6\": 2060551195390515467569592270848\n   },\n   \"Google Bot\": {\n      \"last_updated\": \"2024-07-23 22:00:20\",\n      \"total_networks\": 229,\n      \"total_ipv4\": 3712,\n      \"total_ipv6\": 1918461383665793368064\n   },\n   \"Google Special Crawlers\": {\n      \"last_updated\": \"2024-07-23 22:00:20\",\n      \"total_networks\": 208,\n      \"total_ipv4\": 3328,\n      \"total_ipv6\": 1918461383665793368064\n   },\n   \"Google User Triggered Fetchers\": {\n      \"last_updated\": \"2024-07-23 22:00:20\",\n      \"total_networks\": 729,\n      \"total_ipv4\": 11680,\n      \"total_ipv6\": 6733061586903986339840\n   },\n   \"JD Cloud\": {\n      \"last_updated\": \"2024-07-24 23:21:48\",\n      \"total_networks\": 91,\n      \"total_ipv4\": 1568,\n      \"total_ipv6\": 121056757983718932480\n   },\n   \"Oracle Cloud\": {\n      \"last_updated\": \"2024-07-15 09:52:55\",\n      \"total_networks\": 745,\n      \"total_ipv4\": 2643530,\n      \"total_ipv6\": 0\n   }\n}\n>>>\n>>> from cloudiplookup import update_ip_ranges\n>>> update_ip_ranges(verbose=True,debug=False)\nUpdating AWS - Downloading IP ranges file [0.194571811 sec]\nUpdating AWS - Parsing IPv4 and IPv6 ranges updated at 2023-11-14 14:13:09 [0.008731522 sec]\nUpdating AZURE - Downloading IP ranges file [9.597737358 sec]\nUpdating AZURE - Parsing IPv4 and IPv6 ranges updated at 2023-11-14 12:29:44 [0.064075109 sec]\nUpdating CLOUDFLARE - Downloading IP ranges file [0.109633796 sec]\nUpdating CLOUDFLARE - Parsing IPv4 and IPv6 ranges updated at 2023-11-15 05:23:41 [0.000105514 sec]\nUpdating DIGITAL OCEAN - Downloading IP ranges file [0.447540575 sec]\nUpdating DIGITAL OCEAN - Parsing IPv4 and IPv6 ranges updated at 2023-11-14 17:43:11 [0.004395924 sec]\nUpdating GCP - Downloading IP ranges file [0.197874399 sec]\nUpdating GCP - Parsing IPv4 and IPv6 ranges updated at 2023-11-14 18:04:10 [0.001701975 sec]\nUpdating GOOGLE SERVICES - Downloading IP ranges file [0.294104148 sec]\nUpdating GOOGLE SERVICES - Parsing IPv4 and IPv6 ranges updated at 2023-11-14 18:04:10 [0.000351157 sec]\nUpdating GOOGLE BOT - Downloading IP ranges file [0.396489796 sec]\nUpdating GOOGLE BOT - Parsing IPv4 and IPv6 ranges updated at 2023-11-14 23:00:21 [0.000692362 sec]\nUpdating GOOGLE SPECIAL CRAWLERS - Downloading IP ranges file [0.350542481 sec]\nUpdating GOOGLE SPECIAL CRAWLERS - Parsing IPv4 and IPv6 ranges updated at 2023-11-14 23:00:25 [0.000751040 sec]\nUpdating GOOGLE USER TRIGGERED FETCHERS - Downloading IP ranges file [0.564765383 sec]\nUpdating GOOGLE USER TRIGGERED FETCHERS - Parsing IPv4 and IPv6 ranges updated at 2023-11-14 23:00:22 [0.001925866 sec]\nUpdating JD CLOUD - Downloading IP ranges file [0.375312087 sec]\nUpdating JD CLOUD - Parsing IPv4 and IPv6 ranges updated at 2023-11-15 05:23:44 [0.000438635 sec]\nUpdating ORACLE - Downloading IP ranges file [1.007827670 sec]\nUpdating ORACLE - Parsing IPv4 and IPv6 ranges updated at 2023-10-10 04:47:03 [0.001333245 sec]\nSorting IPv4 and IPv6 data [0.019742529 sec]\nUpdating all lists... Done! [0.042858025 sec]\nSaved file /var/lib/cloudiplookup/cloudiplookup.dat.gz [0.200645894 sec]\nCloud IP Lookup updated with success! [13.629677833 sec]\n>>>\n```\n\n## The database file\n\nCloud IP Lookup uses a pickle database that is a bunch of lists of integers. Everything is located at ```/var/lib/cloudiplookup/```. \n\n> *On Windows systems, these files are located in the same directory as the library files*.\n\n```bash\nroot@tucupi:/var/lib/cloudiplookup# ll\ntotal 184\ndrwxr-xr-x  2 root root   4096 Nov  6 00:21 ./\ndrwxr-xr-x 47 root root   4096 Oct 11 21:11 ../\n-rw-r--r--  1 root root 172158 Nov  6 00:15 cloudiplookup.dat.gz\n-rw-r--r--  1 root root    942 Sep 29 10:53 cloudiplookup.json\n```\n\nThere is a file ```/var/lib/cloudiplookup/cloudiplookup.json``` with all cloud providers information and an another file ```/var/lib/cloudiplookup/cloudiplookup.dat.gz``` that is the database created by function ```update_ip_ranges()```.\n\n```bash\nroot@tambaqui:/var/lib/cloudiplookup# cat cloudiplookup.json\n{\n    \"AWS\": {\n        \"info_page\": \"https://docs.aws.amazon.com/vpc/latest/userguide/aws-ip-ranges.html\",\n        \"download_url\": \"https://ip-ranges.amazonaws.com/ip-ranges.json\"\n    },\n    \"AZURE\": {\n        \"info_page\": \"https://www.microsoft.com/en-us/download/details.aspx?id=56519\",\n        \"download_url\": \"https://download.microsoft.com/download/(...)/ServiceTags_Public_XXXXXXXX.json\"\n    },\n    \"CLOUDFLARE\": {\n        \"info_page\": \"https://www.cloudflare.com/ips/\",\n        \"download_url\": \"https://api.cloudflare.com/client/v4/ips\"\n    },\n    \"DIGITALOCEAN\": {\n        \"info_page\": \"https://docs.digitalocean.com/products/platform/\",\n        \"download_url\": \"https://www.digitalocean.com/geo/google.csv\"\n    },\n    \"GOOGLECLOUD\": {\n        \"info_page\": \"https://support.google.com/a/answer/10026322?hl=en\",\n        \"download_url\": \"https://www.gstatic.com/ipranges/cloud.json\"\n    },\n    \"GOOGLESERVICES\": {\n        \"info_page\": \"https://support.google.com/a/answer/10026322?hl=en\",\n        \"download_url\": \"https://www.gstatic.com/ipranges/goog.json\"\n    },    \n    \"JDCLOUD\": {\n        \"info_page\": \"https://www.cloudflare.com/ips/\",\n        \"download_url\": \"https://api.cloudflare.com/client/v4/ips?networks=jdcloud\"\n    },\n    \"ORACLE\": {\n        \"info_page\": \"https://docs.oracle.com/pt-br/iaas/Content/General/Concepts/addressranges.htm\",\n        \"download_url\": \"https://docs.oracle.com/iaas/tools/public_ip_ranges.json\"\n    }\n}\n```\n\n## Use as a command line application\n\n```bash\n# cloudiplookup\nroot@pirarara:/var/lib/cloudiplookup# ./cloudiplookup.py\nUsage: cloudiplookup.py [--csv] [--info] [--pretty] [--update] [--show-config-file] [--verbose] [--debug] [--help] [--version] [ipaddr,ipaddrN...]\n\nCloud IP Lookup v1.0.5 - Public cloud services IP addresses lookup tool\n\nLookup Parameters:\n  ipaddr,ipaddrN...   Supply one or more IP address separated by comma.\n\nOutput Options:\n  --csv, -c           Print output in csv format (ip,cidr,region,cloud_provider,service,elapsed_time).\n\nDatabase Options:\n  --update, -u        Updates IP ranges directly from cloud service providers. Use -v to see updating progress.\n  --info, -i          Shows information about the current database file in json format.\n  --pretty, -p        Shows information about the current database file in a table format.\n  --show-config-file  Displays the available settings for downloading information about network ranges.\n\nMore Options:\n  --verbose, -v       Shows useful messages about each step that application is doing.\n  --debug, -d         Save all data from cloud providers in the data directory. Debug is not verbose!\n  --help, -h, -?      Shows this help message about the allowed commands.\n  --version           Shows the application version.\n```\n\n```bash\n# cloudiplookup 3.2.35.65,5.101.104.55,66.249.66.193,2600:9000:21e8:2600:1:5a19:8b40:93a1,104.198.16.10,13.71.199.112\n{\n   \"ip\": \"3.2.35.65\",\n   \"cidr\": \"3.2.35.64/26\",\n   \"region\": \"sa-east-1\",\n   \"cloud_provider\": \"AWS\",\n   \"service\": \"EC2\",\n   \"elapsed_time\": \"0.000016832 sec\"\n}\n{\n   \"ip\": \"5.101.104.55\",\n   \"cidr\": \"5.101.104.0/22\",\n   \"region\": \"NL-NH Amsterdam\",\n   \"cloud_provider\": \"Digital Ocean\",\n   \"service\": \"\",\n   \"elapsed_time\": \"0.000002593 sec\"\n}\n{\n   \"ip\": \"66.249.66.193\",\n   \"cidr\": \"66.249.66.192/27\",\n   \"region\": \"\",\n   \"cloud_provider\": \"Google\",\n   \"service\": \"Bot\",\n   \"elapsed_time\": \"0.000031584 sec\"\n}\n{\n   \"ip\": \"2600:9000:21e8:2600:1:5a19:8b40:93a1\",\n   \"cidr\": \"2600:9000:2000::/36\",\n   \"region\": \"GLOBAL\",\n   \"cloud_provider\": \"AWS\",\n   \"service\": \"CLOUDFRONT\",\n   \"elapsed_time\": \"0.000024586 sec\"\n}\n{\n   \"ip\": \"104.198.16.10\",\n   \"cidr\": \"104.198.16.0/20\",\n   \"region\": \"us-central1\",\n   \"cloud_provider\": \"Google Cloud\",\n   \"service\": \"Google Cloud\",\n   \"elapsed_time\": \"0.000026428 sec\"\n}\n{\n   \"ip\": \"13.71.199.112\",\n   \"cidr\": \"13.71.199.112/30\",\n   \"region\": \"westcentralus\",\n   \"cloud_provider\": \"Azure\",\n   \"service\": \"ActionGroup\",\n   \"elapsed_time\": \"0.000004339 sec\"\n}\n ```\n```bash\n# cloudiplookup --csv 3.2.35.65,5.101.104.55,2600:9000:21e8:2600:1:5a19:8b40:93a1,8.35.192.12,13.71.199.112\n3.2.35.65,3.2.35.64/26,sa-east-1,AWS,EC2,0.000019659\n5.101.104.55,5.101.104.0/22,NL-NH Amsterdam,Digital Ocean,,0.000002078\n2600:9000:21e8:2600:1:5a19:8b40:93a1,2600:9000:2000::/36,GLOBAL,AWS,CLOUDFRONT,0.000028556\n8.35.192.12,8.35.192.0/20,,Google Cloud,,0.000004661\n13.71.199.112,13.71.199.112/30,westcentralus,Azure,ActionGroup,0.000004508\n```\n```bash\n# cloudiplookup --update --verbose\nUpdating AWS - Downloading IP ranges file [0.247580905 sec]\nUpdating AWS - Parsing IPv4 and IPv6 ranges updated at 2023-11-14 14:13:09 [0.007899989 sec]\nUpdating AZURE - Downloading IP ranges file [11.802777994 sec]\nUpdating AZURE - Parsing IPv4 and IPv6 ranges updated at 2023-11-14 12:29:44 [0.069718062 sec]\nUpdating CLOUDFLARE - Downloading IP ranges file [0.096246977 sec]\nUpdating CLOUDFLARE - Parsing IPv4 and IPv6 ranges updated at 2023-11-15 05:24:27 [0.000107779 sec]\nUpdating DIGITAL OCEAN - Downloading IP ranges file [0.715709110 sec]\nUpdating DIGITAL OCEAN - Parsing IPv4 and IPv6 ranges updated at 2023-11-14 17:43:11 [0.004408466 sec]\nUpdating GOOGLE CLOUD - Downloading IP ranges file [0.243777335 sec]\nUpdating GOOGLE CLOUD - Parsing IPv4 and IPv6 ranges updated at 2023-11-14 18:04:10 [0.000553817 sec]\nUpdating GOOGLE SERVICES - Downloading IP ranges file [0.219680303 sec]\nUpdating GOOGLE SERVICES - Parsing IPv4 and IPv6 ranges updated at 2023-11-14 18:04:10 [0.000346342 sec]\nUpdating GOOGLE BOT - Downloading IP ranges file [0.488023029 sec]\nUpdating GOOGLE BOT - Parsing IPv4 and IPv6 ranges updated at 2023-11-14 23:00:21 [0.000280338 sec]\nUpdating GOOGLE SPECIAL CRAWLERS - Downloading IP ranges file [0.362579674 sec]\nUpdating GOOGLE SPECIAL CRAWLERS - Parsing IPv4 and IPv6 ranges updated at 2023-11-14 23:00:25 [0.000616955 sec]\nUpdating GOOGLE USER TRIGGERED FETCHERS - Downloading IP ranges file [0.587292662 sec]\nUpdating GOOGLE USER TRIGGERED FETCHERS - Parsing IPv4 and IPv6 ranges updated at 2023-11-14 23:00:22 [0.001841709 sec]\nUpdating JD CLOUD - Downloading IP ranges file [0.391410524 sec]\nUpdating JD CLOUD - Parsing IPv4 and IPv6 ranges updated at 2023-11-15 05:24:30 [0.000430358 sec]\nUpdating ORACLE - Downloading IP ranges file [0.732044416 sec]\nUpdating ORACLE - Parsing IPv4 and IPv6 ranges updated at 2023-10-10 04:47:03 [0.001720133 sec]\nSorting IPv4 and IPv6 data [0.021423362 sec]\nUpdating all lists... Done! [0.028821872 sec]\nSaved file /var/lib/cloudiplookup/cloudiplookup.dat.gz [0.203250980 sec]\nCloud IP Lookup updated with success! [15.981186821 sec]\n```\n```bash\n# ./cloudiplookup.py --info --pretty\nAWS.............................: 7251 networks   - Last update: 2023-11-14 14:13:09\nAzure...........................: 39244 networks  - Last update: 2023-11-14 12:29:44\nCloudflare......................: 22 networks     - Last update: 2023-11-15 05:24:27\nDigital Ocean...................: 1683 networks   - Last update: 2023-11-14 17:43:11\nGoogle Cloud....................: 652 networks    - Last update: 2023-11-14 18:04:10\nGoogle Services.................: 61 networks     - Last update: 2023-11-14 18:04:10\nGoogle Bot......................: 231 networks    - Last update: 2023-11-14 23:00:21\nGoogle Special Crawlers.........: 210 networks    - Last update: 2023-11-14 23:00:25\nGoogle User Triggered Fetchers..: 719 networks    - Last update: 2023-11-14 23:00:22\nJD Cloud........................: 115 networks    - Last update: 2023-11-15 05:24:30\nOracle Cloud....................: 647 networks    - Last update: 2023-10-10 04:47:03\n```\n## Debug mode\n\nIf you update the data using the ```--debug``` option, all files downloaded from cloud service providers will be available in the ```/var/lib/cloudiplookup``` directory. \n\n> *On Windows systems, these files are located in the same directory as the library files*.\n\n```bash\nroot@pirarara:/var/lib/cloudiplookup# ll\ntotal 20368\ndrwxr-xr-x 3 ricardo ricardo     4096 Nov 15 01:54 ./\ndrwxr-xr-x 6 ricardo root        4096 Nov  7 23:58 ../\n-rw-r--r-- 1 root    root    10484261 Nov 15 01:54 cloudip.json\n-rw-r--r-- 1 root    root      177903 Nov 15 01:54 cloudiplookup.dat.gz\n-rw-r--r-- 1 root    root     4479551 Nov 15 01:54 cloudiplookup.dat.json\n-rw-r--r-- 1 root    root        1448 Nov 15 01:31 cloudiplookup.json\n-rw-r--r-- 1 root    root     1666844 Nov 15 02:22 ipranges-aws.json\n-rw-r--r-- 1 root    root     3678383 Nov 15 02:22 ipranges-azure.json\n-rw-r--r-- 1 root    root         788 Nov 15 02:22 ipranges-cloudflare.json\n-rw-r--r-- 1 root    root       71987 Nov 15 02:22 ipranges-digitalocean.csv\n-rw-r--r-- 1 root    root       83122 Nov 15 02:22 ipranges-gcp.json\n-rw-r--r-- 1 root    root        4934 Nov 15 02:22 ipranges-goog.json.json\n-rw-r--r-- 1 root    root       14358 Nov 15 02:22 ipranges-googlebot.json.json\n-rw-r--r-- 1 root    root        4527 Nov 15 02:22 ipranges-jdcloud.json\n-rw-r--r-- 1 root    root       93165 Nov 15 02:23 ipranges-oracle.json\n-rw-r--r-- 1 root    root       13289 Nov 15 02:22 ipranges-special-crawlers.json.json\n-rw-r--r-- 1 root    root       43826 Nov 15 02:22 ipranges-user-triggered-fetchers.json.json\n```\n\n## Sugestions, feedbacks, bugs, new cloud service provider requests...\nE-mail me: ricardoabuchaim at gmail.com\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Cloud IP Lookup is a Pure Python application and library for Python 3 to verify which cloud platform a given IP address belongs to (AWS, Azure, Cloudflare, DigitalOcean, Google Services/Cloud, JD Cloud and Oracle Cloud).",
    "version": "1.0.6",
    "project_urls": {
        "Homepage": "https://github.com/rabuchaim/cloudiplookup",
        "Issue Tracker": "https://github.com/rabuchaim/cloudiplookup/issues",
        "Source Code": "https://github.com/rabuchaim/cloudiplookup/tree/main/cloudiplookup"
    },
    "split_keywords": [
        "cloudiplookup",
        " cloud ip lookup",
        " geoip",
        " aws",
        " azure",
        " gcp",
        " pure-python",
        " purepython",
        " pure python",
        " oracle cloud",
        " oci",
        " digitalocean",
        " digital ocean"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "70df18697bc1fd873775de69394a45180d342d76092c1056fdcc67aa41fc5bf0",
                "md5": "37aea1d928abc9be1dcd066257977e6a",
                "sha256": "5e49474dc0af2e33a6193a92bceb672229c26e0d70482b832803fa7a03542b53"
            },
            "downloads": -1,
            "filename": "cloudiplookup-1.0.6-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "37aea1d928abc9be1dcd066257977e6a",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 187997,
            "upload_time": "2024-07-24T23:48:38",
            "upload_time_iso_8601": "2024-07-24T23:48:38.573402Z",
            "url": "https://files.pythonhosted.org/packages/70/df/18697bc1fd873775de69394a45180d342d76092c1056fdcc67aa41fc5bf0/cloudiplookup-1.0.6-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "5925e5f3f339ebb150a2e07d6dbfcc9c55bb0cd6116749b689b0f1cce488b882",
                "md5": "4762abc0e6ce85c17f9619d7cc9ad911",
                "sha256": "18a45a81a1b6b40cd8f3f9098196fb12f60f5323a4a3fbcfbe4ab4d4a573c26b"
            },
            "downloads": -1,
            "filename": "cloudiplookup-1.0.6.tar.gz",
            "has_sig": false,
            "md5_digest": "4762abc0e6ce85c17f9619d7cc9ad911",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 193993,
            "upload_time": "2024-07-24T23:48:40",
            "upload_time_iso_8601": "2024-07-24T23:48:40.982112Z",
            "url": "https://files.pythonhosted.org/packages/59/25/e5f3f339ebb150a2e07d6dbfcc9c55bb0cd6116749b689b0f1cce488b882/cloudiplookup-1.0.6.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-07-24 23:48:40",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "rabuchaim",
    "github_project": "cloudiplookup",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "cloudiplookup"
}
        
Elapsed time: 0.70118s