ip2location / steampipe-plugin-ip2locationio

Use SQL to instantly query ip2location.io for IP address or WHOIS information. Open source CLI. No DB required.
https://hub.steampipe.io/plugins/ip2location/ip2locationio
Apache License 2.0
4 stars 2 forks source link

image

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 |
+------------+-------------------------+---------------------------------------------------------------------------+----------------------+

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: