- Notifications
You must be signed in to change notification settings - Fork0
Official Command Line Interface for the IPinfo API (IP geolocation and other types of IP data)
License
hegedusjudit840-netizen/cli
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
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!
Theipinfo CLI is available for download via multiple mechanisms.
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| shNote: 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
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| shOR
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}.debwhere{arch} can be 386, amd64, arm, or arm64.
cd /usr/ports/net/ipinfo-cli&& make install clean
git clone https://aur.archlinux.org/ipinfo-cli.gitmakepkg -si
Note: run powershell as administrator before executing this command.
iwr -useb https://github.com/ipinfo/cli/releases/download/ipinfo-3.3.1/windows.ps1| iexscoop install ipinfo-cli
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.1Make sure that$GOPATH/bin is in your$PATH, because that's where this getsinstalled:
go install github.com/ipinfo/cli/ipinfo@latest
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_arm64After 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
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.
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:
| CLI | Version |
|---|---|
| grepip | 1.2.3 |
| grepdomain | 1.0.0 |
| matchip | 1.0.0 |
| prips | 1.0.0 |
| cidr2range | 1.2.0 |
| cidr2ip | 1.0.0 |
| range2cidr | 1.3.0 |
| range2ip | 1.0.0 |
| randip | 1.1.0 |
| splitcidr | 1.0.0 |
| mmdb | 1.4.2 |
This will help you quickly get started with theipinfo CLI.
By default, invoking the CLI shows a help message:
ipinfo
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
You can quickly look up details of your own IP withmyip:
ipinfo myip
You can see the details of any IP by specifying it:
ipinfo 8.8.8.8
You can pipe IPs in and get their results in bulk (this requires a token):
cat ips.txt| ipinfo| less
Here's the CSV version of that:
cat ips.txt| ipinfo -c| less
In case you only needed a single field from a bunch of IPs:
cat ips.txt| ipinfo -f hostnameThe 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| lessIP details can be summarized similar to what's provided byhttps://ipinfo.io/tools/summarize-ips:
cat lk-ips.txt| ipinfo summarizeThere 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 is supported for at least the following shells:
bashzshfishNOTE: it may work for other shells as well because the implementation is inGolang and is not necessarily shell-specific.
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
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).
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.
All our CLIs respect either the--nocolor flag or theNO_COLOR environment variable to disable coloroutput.
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 VirtualTerminalLevelThere 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.
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.
About
Official Command Line Interface for the IPinfo API (IP geolocation and other types of IP data)
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Languages
- Go89.2%
- Shell7.0%
- PowerShell3.5%
- Dockerfile0.3%







