
IP2Location.io Plugin for Steampipe
Use SQL to retrieve geolocation or WHOIS info in minutes using ip2location.io.
Quick start
Install the plugin with Steampipe:
steampipe plugin install ip2location/ip2locationio
Configure the server address in ~/.steampipe/config/ip2locationio.spc:
connection "ip2locationio" {
plugin = "ip2location/ip2locationio"
# API key for requests. Required.
# Sign up for a free key at https://www.ip2location.io/pricing
# This can also be set via the `IP2LOCATIONIO_API_KEY` environment variable.
# api_key = "Q5Z8QS544RKC2VK4P3ZH7YW3C16MDCBW"
}
Or through environment variables:
export IP2LOCATIONIO_API_KEY=Q5Z8QS544RKC2VK4P3ZH7YW3C16MDCBW
Run steampipe:
steampipe query
Query IP geolocation:
select
country_code,
country_name,
region_name,
city_name
from
ip2locationio_geolocation
where
ip = '8.8.8.8';
+--------------+--------------------------+-------------+---------------+
| country_code | country_name | region_name | city_name |
+--------------+--------------------------+-------------+---------------+
| US | United States of America | California | Mountain View |
+--------------+--------------------------+-------------+---------------+
Query WHOIS data:
select
domain,
domain_id,
status,
create_date
from
ip2locationio_whois
where
domain = 'google.com';
+------------+-------------------------+---------------------------------------------------------------------------+----------------------+
| domain | domain_id | status | create_date |
+------------+-------------------------+---------------------------------------------------------------------------+----------------------+
| google.com | 2138514_DOMAIN_COM-VRSN | clientUpdateProhibited (https://www.icann.org/epp#clientUpdateProhibited) | 1997-09-15T07:00:00Z |
+------------+-------------------------+---------------------------------------------------------------------------+----------------------+
Query IP hosted domains:
select
total_domains,
page,
per_page,
total_pages,
domains
from
ip2locationio_hosted
where
ip = '8.8.8.8';
+---------------+------+----------+-------------+------------------------------------------------------------------------------------------------------------------------------------------->
| total_domains | page | per_page | total_pages | domains >
+---------------+------+----------+-------------+------------------------------------------------------------------------------------------------------------------------------------------->
| 3861 | 1 | 100 | 39 | ["000180.top","00100tet.xyz","001hash.vip","002hash.com","0050500.xyz","007515.com","023mm.net","023mt.net","023sn.net","031000.xyz","0515>
| | | | | xyz","20230406.mov","205566.com","205artemisbet.com","20iiij.cyou","21107ahsfukhweo.com","21hodheoh.cyou","22bahman.space","22howhw.cyou",>
+---------------+------+----------+-------------+------------------------------------------------------------------------------------------------------------------------------------------->
Developing
Prerequisites:
Clone:
git clone https://github.com/ip2location/steampipe-plugin-ip2locationio.git
cd steampipe-plugin-ip2locationio
Build, which automatically installs the new version to your ~/.steampipe/plugins directory:
make
Configure the plugin:
cp config/* ~/.steampipe/config
nano ~/.steampipe/config/ip2locationio.spc
Try it!
steampipe query
> .inspect ip2locationio
Further reading:
Contributing
Please see the contribution guidelines and our code of conduct. All contributions are subject to the Apache 2.0 open source license.
help wanted issues: