cIP | Country IP

cIP – Countries IP | Get IP country Information, Get IPs of countries by name, …

Install

git clone https://github.com/aWolver/cip.git && cd cip

Next step, if your system is Linux, runs:

go generate

with go generate, install.sh moves database to destination

  • destinations:
    • On Linux: /opt/cIP/database.csv
    • Other: needn’t to move

Otherwise, only run this to compile:

go build

How To Use


in command

First see usage:

$ ./cip in -h
Usage: ./cip in [options] [names...]

Description: IPs of countries

Options:
        -limit N         Result limit
        -offset N        Result offset
        -h, -help        Show this message

Example:
    ./cip in "IR" # will print IRAN IPs
    ./cip in "CHN" "US" # will print CHINA & USA IPs

Example of result:

From -          To              Registry        Assigned        Country

1.0.1.0 -       1.0.1.255       apnic           1302739200      CHINA
1.0.2.0 -       1.0.3.255       apnic           1302739200      CHINA
1.0.8.0 -       1.0.15.255      apnic           1302566400      CHINA
1.0.32.0 -      1.0.63.255      apnic           1302566400      CHINA
1.1.0.0 -       1.1.0.255       apnic           1302739200      CHINA

info command

First see usage:

$ ./cip info -h
Usage: ./cip info [options] [ip...]

Description: Get IPs information like country

Options:
        -network            use ip network e.g. "5.2.0.0/24" "192.0.2.0/16"
        -h, -help           show this message

Examples:
        ./cip info 217.221.6.1 # will print 217.221.0.0 ... ITALY
        ./cip info -network "5.2.0.0/24" # will print 5.2.0.0/24: .... ITALY

db command

This command copies database from source to current directory named ‘database.csv’.

GitHub

View Github