testitesti22 / cli

Official Command Line Interface for the IPinfo API (IP geolocation and other types of IP data)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

IPinfo IPinfo CLI

This is the official CLI for the IPinfo.io IP address API, allowing you to:

  • Look up IP details in bulk or one-by-one.
  • Look up ASN details.
  • Summarize the details of up to 1000 IPs at a time.
  • Open a map of IP locations for any set of IPs.
  • Filter IPv4 & IPv6 addresses from any input.
  • Print out IP lists for any CIDR or IP range.
  • And more!

Installation

All CLI tools (e.g. ipinfo, grepip) are available for download via multiple mechanisms.

macOS

$ curl -Ls https://github.com/ipinfo/cli/releases/download/ipinfo-1.1.0/macos.sh | sh

Debian / Ubuntu

$ curl -Ls https://github.com/ipinfo/cli/releases/download/ipinfo-1.1.0/deb.sh | sh

OR

$ curl -LO https://github.com/ipinfo/cli/releases/download/ipinfo-1.1.0/ipinfo_1.1.0.deb
$ sudo dpkg -i ipinfo_1.1.0.deb

Using curl/wget

The pre-built binaries for all platforms are available on GitHub via artifacts in releases. You need to simply download, unpack and move them to your shell's binary search path.

The following OS & arch combinations are supported (if you use one not listed on here, please open an issue):

darwin_amd64
dragonfly_amd64
freebsd_amd64
linux_amd64
netbsd_amd64
openbsd_amd64
plan9_amd64
solaris_amd64
windows_amd64

After choosing a platform PLAT from above, run:

# for Windows, use ".zip" instead of ".tar.gz"
$ curl -LO https://github.com/ipinfo/cli/releases/download/ipinfo-1.1.0/ipinfo_1.1.0_${PLAT}.tar.gz
# OR
$ wget https://github.com/ipinfo/cli/releases/download/ipinfo-1.1.0/ipinfo_1.1.0_${PLAT}.tar.gz

$ tar -xvf ipinfo_1.1.0_${PLAT}.tar.gz
$ mv ipinfo_1.1.0_${PLAT} /usr/local/bin/ipinfo

Using git

Installing from source requires at least the Golang version specified in go.mod. You can install the Golang toolchain from the official site.

Once the correct Golang version is installed, simply clone the repository and install the binary:

$ git clone https://github.com/ipinfo/cli ipinfo-cli
$ cd ipinfo-cli
$ go install ./ipinfo/
$ $GOPATH/bin/ipinfo

You can add $GOPATH/bin to your $PATH to access ipinfo directly from anywhere.

Alternatively, you can do the following to output the binary somewhere specific:

$ git clone https://github.com/ipinfo/cli ipinfo-cli
$ cd ipinfo-cli
$ go build -o <path> ./ipinfo/

Replace <path> with the required location.

Quick Start

Default Help Message

By default, invoking the CLI shows a help message:

ipinfo

Login

If you have a token, log in with it first. You can continue without a token, but there will be limited data output and some features (like bulk lookups) will not be available. Get your token for free at https://ipinfo.io/signup.

$ ipinfo login

My IP

You can quickly look up details of your own IP with myip:

ipinfo myip

Any IP

You can see the details of any IP by specifying it:

ipinfo myip

Piping

You can pipe IPs in and get their results in bulk (this requires a token):

cat ips.txt | ipinfo

Here's the CSV version of that:

cat ips.txt | ipinfo -c

Field Filter

In case you only needed a single field from a bunch of IPs:

cat ips.txt | ipinfo

Bulk

The above commands implicitly run the bulk subcommand on the input. You can manually specify bulk and input IPs on the command line:

ipinfo bulk

Summarize

IP details can be summarized similar to what's provided by https://ipinfo.io/summarize-ips:

ipinfo summarize

There are many more features available, so for full details, consult the -h or --help message for each command. For example:

$ ipinfo 8.8.8.8 --help

Other IPinfo Tools

There are official IPinfo client libraries available for many languages including PHP, Python, Go, Java, Ruby, and many popular frameworks such as Django, Rails and Laravel. There are also many third party libraries and integrations available for our API.

See https://ipinfo.io/developers/libraries for more details.

About IPinfo

Founded in 2013, IPinfo prides itself on being the most reliable, accurate, and in-depth source of IP address data available anywhere. We process terabytes of data to produce our custom IP geolocation, company, carrier and IP type data sets. Our API handles over 12 billion requests a month for 100,000 businesses and developers.

image

About

Official Command Line Interface for the IPinfo API (IP geolocation and other types of IP data)

License:Apache License 2.0


Languages

Language:Go 89.4%Language:Shell 10.6%