Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

License

NotificationsYou must be signed in to change notification settings

hegedusjudit840-netizen/cli

 
 

Repository files navigation

IPinfo IPinfo CLI

This is the official CLI for theIPinfo.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

Theipinfo CLI is available for download via multiple mechanisms.

macOS

brew install ipinfo-cli

OR to install the latestamd64 version without automatic updates:

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

Ubuntu PPA

Note: this installs our full suite of binaries and keeps them up-to-date.

echo"deb [trusted=yes] https://ppa.ipinfo.net/ /"| sudo tee"/etc/apt/sources.list.d/ipinfo.ppa.list"sudo apt updatesudo apt install ipinfo

Debian / Ubuntu

Note: this is a one-time installation; updates are not automatic. Use the PPAfor automatic updates.

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

OR

curl -LO https://github.com/ipinfo/cli/releases/download/ipinfo-3.3.1/ipinfo_3.3.1_linux_{arch}.debsudo dpkg -i ipinfo_3.3.1_linux_{arch}.deb

where{arch} can be 386, amd64, arm, or arm64.

FreeBSD

cd /usr/ports/net/ipinfo-cli&& make install clean

Arch linux

git clone https://aur.archlinux.org/ipinfo-cli.gitmakepkg -si

Windows Powershell

Note: run powershell as administrator before executing this command.

iwr -useb https://github.com/ipinfo/cli/releases/download/ipinfo-3.3.1/windows.ps1| iex

Scoop

scoop install ipinfo-cli

Docker

docker run --rm -it ipinfo/ipinfo:3.3.1

To save the CLI's config, add-v "/path_to_config:/root/.config/ipinfo". Forexample, the following command saves the config to theipinfo directory inthe current working directory.

docker run --rm -it -v"$PWD/ipinfo:/root/.config/ipinfo" ipinfo/ipinfo:3.3.1

Usinggo install

Make sure that$GOPATH/bin is in your$PATH, because that's where this getsinstalled:

go install github.com/ipinfo/cli/ipinfo@latest

Usingcurl/wget

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

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

darwin_amd64darwin_arm64dragonfly_amd64freebsd_386freebsd_amd64freebsd_armfreebsd_arm64linux_386linux_amd64linux_armlinux_arm64netbsd_386netbsd_amd64netbsd_armnetbsd_arm64openbsd_386openbsd_amd64openbsd_armopenbsd_arm64solaris_amd64windows_386windows_amd64windows_armwindows_arm64

After choosing a platformPLAT from above, run:

# for Windows, use ".zip" instead of ".tar.gz"curl -LO https://github.com/ipinfo/cli/releases/download/ipinfo-3.3.1/ipinfo_3.3.1_${PLAT}.tar.gz# ORwget https://github.com/ipinfo/cli/releases/download/ipinfo-3.3.1/ipinfo_3.3.1_${PLAT}.tar.gztar -xvf ipinfo_3.3.1_${PLAT}.tar.gzsudo mv ipinfo_3.3.1_${PLAT} /usr/local/bin/ipinfo

Usinggit

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

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

git clone https://github.com/ipinfo/cli ipinfo-clicd ipinfo-cligo install ./ipinfo/$GOPATH/bin/ipinfo

You can add$GOPATH/bin to your$PATH to accessipinfo directly fromanywhere.

Alternatively, you can do the following to output the binary somewherespecific:

git clone https://github.com/ipinfo/cli ipinfo-clicd ipinfo-cligo build -o<path> ./ipinfo/

Replace<path> with the required location.

Additional CLIs

Theipinfo CLI has some subcommands likegrepip,grepdomain,matchip,prips,cidr2range,cidr2ip,range2cidr,range2ip,splitcidr,randip andmmdb which are also shipped as standalone binaries.

These binaries are available via all thesame installation methods asmentioned above foripinfo, except you must change only the name to the nameof the subcommand, and choose the appropriate version.

Currently these subcommands are separately shipped:

CLIVersion
grepip1.2.3
grepdomain1.0.0
matchip1.0.0
prips1.0.0
cidr2range1.2.0
cidr2ip1.0.0
range2cidr1.3.0
range2ip1.0.0
randip1.1.0
splitcidr1.0.0
mmdb1.4.2

Quick Start

This will help you quickly get started with theipinfo CLI.

Default Help Message

By default, invoking the CLI shows a help message:

ipinfo

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 athttps://ipinfo.io/signup.

ipinfo init

My IP

You can quickly look up details of your own IP withmyip:

ipinfo myip

ipinfo myip

Any IP

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

ipinfo 8.8.8.8

ipinfo myip

Piping

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

cat ips.txt| ipinfo| less

cat ips.txt | ipinfo

Here's the CSV version of that:

cat ips.txt| ipinfo -c| less

cat ips.txt | ipinfo -c

Field Filter

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

cat ips.txt| ipinfo -f hostname

cat ips.txt | ipinfo

Bulk

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

ipinfo bulk 1.1.1.0/30 8.8.8.0/30 9.9.9.0/30| less

ipinfo bulk

Summarize

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

cat lk-ips.txt| ipinfo summarize

ipinfo summarize

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

ipinfo 8.8.8.8 --help

Auto-Completion

Auto-completion is supported for at least the following shells:

bashzshfish

NOTE: it may work for other shells as well because the implementation is inGolang and is not necessarily shell-specific.

Installation

Installing auto-completions is as simple as running one command (works forbash,zsh andfish shells):

ipinfo completion install

If you want to customize the installation process (e.g. in case theauto-installation doesn't work as expected), you can request the actualcompletion script for each shell:

# get bash completion scriptipinfo completion bash# get zsh completion scriptipinfo completion zsh# get fish completion scriptipinfo completion fish

Shell not listed?

If your shell is not listed here, you can open an issue.

Note that as long as theCOMP_LINE environment variable is provided to thebinary itself, it will output completion results. So if your shell provides away to passCOMP_LINE on auto-completion attempts to a binary, then have yourshell do that with theipinfo binary itself (or any of our binaries).

Data

The amount of data you get back per lookup depends upon how much data you haveenabled on your token via thehttps://ipinfo.io site.

If you have an account, see ourplans andaddons.

All examples in this document use a token with all data enabled.

Color Output

Disabling Color Output

All our CLIs respect either the--nocolor flag or theNO_COLOR environment variable to disable coloroutput.

Color on Windows

To enable color support for the Windows command prompt, run the following toenableConsole Virtual Terminal Sequences.

REG ADD HKCU\CONSOLE /f /v VirtualTerminalLevel /t REG_DWORD /d1

You can disable this by running the following:

REG DELETE HKCU\CONSOLE /f /v VirtualTerminalLevel

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.

Seehttps://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, VPN detection, hosted domains, and IP type data sets. Our API handles over 40 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)

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go89.2%
  • Shell7.0%
  • PowerShell3.5%
  • Dockerfile0.3%

[8]ページ先頭

©2009-2025 Movatter.jp