Skip to content
Projects

About

IP geolocation databases tool and library. IP 地理位置数据库工具。

Data & Analytics

How these counts are measured

Measured star growth

in 24h
0
in 7 days
0
in 15 days
0
in 1 month
Collecting history

Net star changes over overlapping periods, not daily totals. Missing measurements are left blank. Stars measure attention, not software quality.

README_en.md

Original

IPS

Go Report Card GoDoc GitHub release GitHub license

ips is a command-line tool and library that facilitates the querying, dumping, and packaging of IP geolocation databases.

中文 | English

Download And Install

Installation from Source

go install github.com/sjzar/ips@latest

Binary Installation

Windows Unix MacOS

Download the latest binary files from GitHub Releases.

Homebrew Installation

brew tap sjzar/tap
brew install ips

Features

  • One-click querying, dumping, and packaging of IP geolocation databases
  • Compatibility with multiple database formats
  • Querying through command-line arguments or piping
  • Output in both text and JSON formats
  • Customizable query fields with persistent configuration
  • Flexible database field rewriting: add or remove fields and modify content as needed

Supported Databases

Database Query Dump Pack Official Website Command
txt ✅ ✅ ✅ - Used for project dumps
ipdb ✅ ✅ ✅ Link
mmdb ✅ ✅ ✅ Link
awdb ✅ ✅ - Link
qqwry ✅ ✅ - Link IPv4 only
czdb ✅ ✅ - Link
zxinc ✅ ✅ - Link IPv6 only
ip2region ✅ ✅ - Link IPv4 only

Usage

For more detailed usage instructions, please refer to usage_en.md.

Query

# Basic query
ips <ip or text> [flags]

# Query IP
ips 61.144.235.160
# Output:61.144.235.160 [中国 广东 深圳 电信]

# Query IP using pipeline
echo "61.144.235.160" | ips
# Output:61.144.235.160 [中国 广东 深圳 电信]

# Query IP using a specific database file
ips -d ./GeoLite2-City.mmdb 61.144.235.160
# Output:61.144.235.160 [中国 广州]

# Query IP using a specific database file and fields
ips -d ./GeoLite2-City.mmdb --fields country 61.144.235.160
# Output:61.144.235.160 [中国]

# Query IP using a specific database file and output in JSON format
ips -d ./GeoLite2-City.mmdb --fields '*' -j 61.144.235.160
# Output:{"ip":"61.144.235.160","net":"61.144.192.0/18","data":{"city":"广州市","continent":"亚洲","country":"中国","latitude":"23.1181","longitude":"113.2539","utcOffset":"Asia/Shanghai"}}

Dump

# Basic dump command, output dump content
ips dump -i ./qqwry.dat
# Output:
#    # Dump Time: 2023-10-20 00:00:00
#    # Fields: country,area
#    ... <omitted part of the output> ...

# Specify fields for dumping
ips dump -i ./qqwry.dat -f country
# Output:
#    # Dump Time: 2023-10-20 00:00:00
#    # Fields: country
#    ... <omitted part of the output> ...

# Dump content and save to a file
ips dump -i ./qqwry.dat -o 1.txt

Pack

# Package from dump file
ips pack -i qqwry.txt -o qqwry.ipdb

# Package from database file
ips pack -i qqwry.dat -o qqwry.ipdb

# Package from database file specifying fields
ips pack -i qqwry.dat -f country -o country.ipdb

License

ips is open-source software licensed under the Apache-2.0 License.

Acknowledgments

Explore related projects

Loading…