Package: cloudiplookup
Cloud IP Lookup v1.0.5Cloud 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 athttps://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.What's new in v1.0.5 - 15/Nov/2023
- Updated Google Services (Google Bot, Special Crawlers and User Fetchers), 
  Cloudflare and JD Cloud China.InstallationpipinstallcloudiplookupOr cloning from Githubgitclonehttps://github.com/rabuchaim/cloudiplookup.gitHow to use it as a Python library# python3Python3.11.6(main,Oct232023,22:48:54)[GCC11.4.0]onlinux
Type"help","copyright","credits"or"license"formoreinformation.
>>>fromcloudiplookupimportCloudIPLookup
>>>myLookup=CloudIPLookup(verbose=True)CloudIPLookupv1.0.5isready!loadedwith48526networksin0.00633secondsandusing4.16MiBofRAM.
>>>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":"2023-11-14 14:13:09","total_networks":7251},"Azure":{"last_updated":"2023-11-14 12:29:44","total_networks":39244},"Cloudflare":{"last_updated":"2023-11-15 05:24:27","total_networks":22},"Digital Ocean":{"last_updated":"2023-11-14 17:43:11","total_networks":1683},"Google Cloud":{"last_updated":"2023-11-14 18:04:10","total_networks":652},"Google Services":{"last_updated":"2023-11-14 18:04:10","total_networks":61},"Google Bot":{"last_updated":"2023-11-14 23:00:21","total_networks":231},"Google Special Crawlers":{"last_updated":"2023-11-14 23:00:25","total_networks":210},"Google User Triggered Fetchers":{"last_updated":"2023-11-14 23:00:22","total_networks":719},"JD Cloud":{"last_updated":"2023-11-15 05:24:30","total_networks":115},"Oracle Cloud":{"last_updated":"2023-10-10 04:47:03","total_networks":647}}>>>
>>>fromcloudiplookupimportupdate_ip_ranges
>>>update_ip_ranges(verbose=True,debug=False)UpdatingAWS-DownloadingIPrangesfile[0.194571811sec]UpdatingAWS-ParsingIPv4andIPv6rangesupdatedat2023-11-1414:13:09[0.008731522sec]UpdatingAZURE-DownloadingIPrangesfile[9.597737358sec]UpdatingAZURE-ParsingIPv4andIPv6rangesupdatedat2023-11-1412:29:44[0.064075109sec]UpdatingCLOUDFLARE-DownloadingIPrangesfile[0.109633796sec]UpdatingCLOUDFLARE-ParsingIPv4andIPv6rangesupdatedat2023-11-1505:23:41[0.000105514sec]UpdatingDIGITALOCEAN-DownloadingIPrangesfile[0.447540575sec]UpdatingDIGITALOCEAN-ParsingIPv4andIPv6rangesupdatedat2023-11-1417:43:11[0.004395924sec]UpdatingGCP-DownloadingIPrangesfile[0.197874399sec]UpdatingGCP-ParsingIPv4andIPv6rangesupdatedat2023-11-1418:04:10[0.001701975sec]UpdatingGOOGLEGOOGLESERVICES-DownloadingIPrangesfile[0.294104148sec]UpdatingGOOGLEGOOGLESERVICES-ParsingIPv4andIPv6rangesupdatedat2023-11-1418:04:10[0.000351157sec]UpdatingGOOGLEGOOGLEBOT-DownloadingIPrangesfile[0.396489796sec]UpdatingGOOGLEGOOGLEBOT-ParsingIPv4andIPv6rangesupdatedat2023-11-1423:00:21[0.000692362sec]UpdatingGOOGLEGOOGLESPECIALCRAWLERS-DownloadingIPrangesfile[0.350542481sec]UpdatingGOOGLEGOOGLESPECIALCRAWLERS-ParsingIPv4andIPv6rangesupdatedat2023-11-1423:00:25[0.000751040sec]UpdatingGOOGLEGOOGLEUSERTRIGGEREDFETCHERS-DownloadingIPrangesfile[0.564765383sec]UpdatingGOOGLEGOOGLEUSERTRIGGEREDFETCHERS-ParsingIPv4andIPv6rangesupdatedat2023-11-1423:00:22[0.001925866sec]UpdatingJDCLOUD-DownloadingIPrangesfile[0.375312087sec]UpdatingJDCLOUD-ParsingIPv4andIPv6rangesupdatedat2023-11-1505:23:44[0.000438635sec]UpdatingORACLE-DownloadingIPrangesfile[1.007827670sec]UpdatingORACLE-ParsingIPv4andIPv6rangesupdatedat2023-10-1004:47:03[0.001333245sec]SortingIPv4andIPv6data[0.019742529sec]Updatingalllists...Done![0.042858025sec]Savedfile/var/lib/cloudiplookup/cloudiplookup.dat.gz[0.200645894sec]CloudIPLookupupdatedwithsuccess![13.629677833sec]>>>The database fileCloud 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.root@tucupi:/var/lib/cloudiplookup#ll
total184drwxr-xr-x2rootroot4096Nov600:21./
drwxr-xr-x47rootroot4096Oct1121:11../
-rw-r--r--1rootroot172158Nov600:15cloudiplookup.dat.gz
-rw-r--r--1rootroot942Sep2910:53cloudiplookup.jsonThere is a file/var/lib/cloudiplookup/cloudiplookup.jsonwith all cloud providers information and an another file/var/lib/cloudiplookup/cloudiplookup.dat.gzthat is the database created by functionupdate_ip_ranges().root@tambaqui:/var/lib/cloudiplookup#catcloudiplookup.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# cloudiplookuproot@pirarara:/var/lib/cloudiplookup#./cloudiplookup.py
Usage:cloudiplookup.py[--csv][--info][--pretty][--update][--show-config-file][--verbose][--debug][--help][--version][ipaddr,ipaddrN...]CloudIPLookupv1.0.5-PubliccloudservicesIPaddresseslookuptool

LookupParameters:ipaddr,ipaddrN...SupplyoneormoreIPaddressseparatedbycomma.

OutputOptions:--csv,-cPrintoutputincsvformat(ip,cidr,region,cloud_provider,service,elapsed_time).

DatabaseOptions:--update,-uUpdatesIPrangesdirectlyfromcloudserviceproviders.Use-vtoseeupdatingprogress.--info,-iShowsinformationaboutthecurrentdatabasefileinjsonformat.--pretty,-pShowsinformationaboutthecurrentdatabasefileinatableformat.--show-config-fileDisplaystheavailablesettingsfordownloadinginformationaboutnetworkranges.

MoreOptions:--verbose,-vShowsusefulmessagesabouteachstepthatapplicationisdoing.--debug,-dSavealldatafromcloudprovidersinthedatadirectory.Debugisnotverbose!--help,-h,-?Showsthishelpmessageabouttheallowedcommands.--versionShowstheapplicationversion.# 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"}# 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.1123.2.35.65,3.2.35.64/26,sa-east-1,AWS,EC2,0.0000196595.101.104.55,5.101.104.0/22,NL-NHAmsterdam,DigitalOcean,,0.0000020782600:9000:21e8:2600:1:5a19:8b40:93a1,2600:9000:2000::/36,GLOBAL,AWS,CLOUDFRONT,0.0000285568.35.192.12,8.35.192.0/20,,GoogleCloud,,0.00000466113.71.199.112,13.71.199.112/30,westcentralus,Azure,ActionGroup,0.000004508# cloudiplookup --update --verboseUpdatingAWS-DownloadingIPrangesfile[0.247580905sec]UpdatingAWS-ParsingIPv4andIPv6rangesupdatedat2023-11-1414:13:09[0.007899989sec]UpdatingAZURE-DownloadingIPrangesfile[11.802777994sec]UpdatingAZURE-ParsingIPv4andIPv6rangesupdatedat2023-11-1412:29:44[0.069718062sec]UpdatingCLOUDFLARE-DownloadingIPrangesfile[0.096246977sec]UpdatingCLOUDFLARE-ParsingIPv4andIPv6rangesupdatedat2023-11-1505:24:27[0.000107779sec]UpdatingDIGITALOCEAN-DownloadingIPrangesfile[0.715709110sec]UpdatingDIGITALOCEAN-ParsingIPv4andIPv6rangesupdatedat2023-11-1417:43:11[0.004408466sec]UpdatingGOOGLECLOUD-DownloadingIPrangesfile[0.243777335sec]UpdatingGOOGLECLOUD-ParsingIPv4andIPv6rangesupdatedat2023-11-1418:04:10[0.000553817sec]UpdatingGOOGLEGOOGLESERVICES-DownloadingIPrangesfile[0.219680303sec]UpdatingGOOGLEGOOGLESERVICES-ParsingIPv4andIPv6rangesupdatedat2023-11-1418:04:10[0.000346342sec]UpdatingGOOGLEGOOGLEBOT-DownloadingIPrangesfile[0.488023029sec]UpdatingGOOGLEGOOGLEBOT-ParsingIPv4andIPv6rangesupdatedat2023-11-1423:00:21[0.000280338sec]UpdatingGOOGLEGOOGLESPECIALCRAWLERS-DownloadingIPrangesfile[0.362579674sec]UpdatingGOOGLEGOOGLESPECIALCRAWLERS-ParsingIPv4andIPv6rangesupdatedat2023-11-1423:00:25[0.000616955sec]UpdatingGOOGLEGOOGLEUSERTRIGGEREDFETCHERS-DownloadingIPrangesfile[0.587292662sec]UpdatingGOOGLEGOOGLEUSERTRIGGEREDFETCHERS-ParsingIPv4andIPv6rangesupdatedat2023-11-1423:00:22[0.001841709sec]UpdatingJDCLOUD-DownloadingIPrangesfile[0.391410524sec]UpdatingJDCLOUD-ParsingIPv4andIPv6rangesupdatedat2023-11-1505:24:30[0.000430358sec]UpdatingORACLE-DownloadingIPrangesfile[0.732044416sec]UpdatingORACLE-ParsingIPv4andIPv6rangesupdatedat2023-10-1004:47:03[0.001720133sec]SortingIPv4andIPv6data[0.021423362sec]Updatingalllists...Done![0.028821872sec]Savedfile/var/lib/cloudiplookup/cloudiplookup.dat.gz[0.203250980sec]CloudIPLookupupdatedwithsuccess![15.981186821sec]# ./cloudiplookup.py --info --prettyAWS.............................:7251networks-Lastupdate:2023-11-1414:13:09
Azure...........................:39244networks-Lastupdate:2023-11-1412:29:44
Cloudflare......................:22networks-Lastupdate:2023-11-1505:24:27
DigitalOcean...................:1683networks-Lastupdate:2023-11-1417:43:11
GoogleCloud....................:652networks-Lastupdate:2023-11-1418:04:10
GoogleServices.................:61networks-Lastupdate:2023-11-1418:04:10
GoogleBot......................:231networks-Lastupdate:2023-11-1423:00:21
GoogleSpecialCrawlers.........:210networks-Lastupdate:2023-11-1423:00:25
GoogleUserTriggeredFetchers..:719networks-Lastupdate:2023-11-1423:00:22
JDCloud........................:115networks-Lastupdate:2023-11-1505:24:30
OracleCloud....................:647networks-Lastupdate:2023-10-1004:47:03Debug modeIf you update the data using the--debugoption, all files downloaded from cloud service providers will be available in the/var/lib/cloudiplookupdirectory.On Windows systems, these files are located in the same directory as the library files.root@pirarara:/var/lib/cloudiplookup#ll
total20368drwxr-xr-x3ricardoricardo4096Nov1501:54./
drwxr-xr-x6ricardoroot4096Nov723:58../
-rw-r--r--1rootroot10484261Nov1501:54cloudip.json
-rw-r--r--1rootroot177903Nov1501:54cloudiplookup.dat.gz
-rw-r--r--1rootroot4479551Nov1501:54cloudiplookup.dat.json
-rw-r--r--1rootroot1448Nov1501:31cloudiplookup.json
-rw-r--r--1rootroot1666844Nov1502:22ipranges-aws.json
-rw-r--r--1rootroot3678383Nov1502:22ipranges-azure.json
-rw-r--r--1rootroot788Nov1502:22ipranges-cloudflare.json
-rw-r--r--1rootroot71987Nov1502:22ipranges-digitalocean.csv
-rw-r--r--1rootroot83122Nov1502:22ipranges-gcp.json
-rw-r--r--1rootroot4934Nov1502:22ipranges-goog.json.json
-rw-r--r--1rootroot14358Nov1502:22ipranges-googlebot.json.json
-rw-r--r--1rootroot4527Nov1502:22ipranges-jdcloud.json
-rw-r--r--1rootroot93165Nov1502:23ipranges-oracle.json
-rw-r--r--1rootroot13289Nov1502:22ipranges-special-crawlers.json.json
-rw-r--r--1rootroot43826Nov1502:22ipranges-user-triggered-fetchers.json.jsonSugestions, feedbacks, bugs, new cloud service provider requests...E-mail me: ricardoabuchaim at gmail.com