SkillAgentSearch skills...

Mmdbinspect

look up records for one or more IPs/networks in one or more .mmdb databases

Install / Use

/learn @maxmind/Mmdbinspect
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

mmdbinspect

mmdbinspect - look up records for one or more IPs/networks in one or more .mmdb databases

<!-- vim-markdown-toc GFM --> <!-- vim-markdown-toc -->

Usage

mmdbinspect [-include-aliased-networks] [-include-build-time] [-include-empty-values] [-include-networks-without-data] [-jsonl] -db path/to/db [IP|network] [IP|network]...
  -db value            Path to an mmdb file. You may pass this arg more than once.
                       This may also be a glob pattern matching one or more MMDB files.
  -include-aliased-networks
                       Include aliased networks (e.g. 6to4, Teredo). This option may
                       cause IPv4 networks to be listed more than once via aliases.
  -include-build-time  Include the build time of the database in the output.
  -include-empty-values
                       Include networks whose data is an empty map or empty array.
                       By default, such networks are skipped.
  -include-networks-without-data
                       Include networks that have no data in the database.
                       The "record" will be null for these.
  -jsonl               Output as JSONL instead of YAML.
  [IP|network]         An IP address, or network in CIDR notation. Can be
                       specified multiple times.

Description

Any IPs specified will be treated as their single-host network counterparts (e.g. 1.2.3.4 => 1.2.3.4/32).

mmdbinspect will look up each IP/network in each database specified. For each IP/network looked up in a database, the program will select all records for networks which are contained within the looked up IP/network. If no records for contained networks are found in the datafile, the program will select the record that is contained by the looked up IP/network. If no such records are found, none are selected.

By default, networks with empty map or empty array data are skipped from the output. This is useful for databases that use empty values for networks without meaningful data (e.g., public IPs in some databases). Use -include-empty-values to include these networks in the output.

The program outputs the selected records in YAML format by default (use -jsonl for JSONL format). Each output item corresponds to a single IP/network being looked up in a single DB. Each record contains the following keys: database_path, requested_lookup, network, and record. This format allows for efficient streaming of large lookups and makes the key naming more consistent.

Installation

Installing via binary release

Release binaries have been made available for several popular platforms. Simply download the binary for your platform and run it.

Installing on Linux via the tarball

Download and extract the appropriate tarball for your system. You will end up with a directory named something like mmdbinspect_0.0.0_linux_amd64 depending on the version and architecture.

Copy mmdbinspect to where you want it to live. To install it into /usr/local/bin/mmdbinspect, run the equivalent of sudo cp mmdbinspect_0.0.0_linux_amd64/mmdbinspect /usr/local/bin.

Installing on Ubuntu or Debian via the .deb

(N.B. You can also use the tarball.)

Download the appropriate .deb for your system.

Run dpkg -i path/to/mmdbinspect_0.0.0_linux_amd64.deb (replacing the version number and architecture as necessary). You will need to be root. For Ubuntu you can prefix the command with sudo. This will install mmdbinspect to /usr/bin/mmdbinspect.

Installing on RedHat or CentOS via the rpm

(N.B. You can also use the tarball.)

Run rpm -i path/to/mmdbinspect_0.0.0_linux_amd64.rpm (replacing the version number and architecture as necessary). You will need to be root. This will install mmdbinspect to /usr/bin/mmdbinspect.

Installing on macOS (darwin) via the tarball

This is the same as installing on Linux via the tarball, except choose a tarball with "darwin" in the name.

Installing on Windows

Download and extract the appropriate zip for your system. You will end up with a directory named something like mmdbinspect_0.0.0_windows_amd64 depending on the version and architecture.

Copy mmdbinspect.exe to where you want it to live.

Installing from source or Git

We aim always to support the current and penultimate major releases of the Go compiler. You can get it at the Go website.

The easiest way is via go install:

$ go install github.com/maxmind/mmdbinspect/v2/cmd/mmdbinspect@latest

This installs mmdbinspect to $GOPATH/bin/mmdbinspect.

Examples

<details> <summary>A simple lookup (one IP/network, one DB)</summary>
$ mmdbinspect -db GeoIP2-Country.mmdb 152.216.7.110
database_path: GeoIP2-Country.mmdb
requested_lookup: 152.216.7.110
network: 152.208.0.0/12
record:
  continent:
    code: NA
    geoname_id: 6255149
    names:
      de: Nordamerika
      en: North America
      es: Norteamérica
      fr: Amérique du Nord
      ja: 北アメリカ
      pt-BR: América do Norte
      ru: Северная Америка
      zh-CN: 北美洲
  country:
    geoname_id: 6252001
    iso_code: US
    names:
      de: USA
      en: United States
      es: Estados Unidos
      fr: États Unis
      ja: アメリカ
      pt-BR: EUA
      ru: США
      zh-CN: 美国
  registered_country:
    geoname_id: 6252001
    iso_code: US
    names:
      de: USA
      en: United States
      es: Estados Unidos
      fr: États Unis
      ja: アメリカ
      pt-BR: EUA
      ru: США
      zh-CN: 美国
</details> <details> <summary>Look up one IP/network in multiple databases</summary>
$ mmdbinspect -db GeoIP2-Country.mmdb -db GeoIP2-City.mmdb 152.216.7.110
database_path: GeoIP2-Country.mmdb
requested_lookup: 152.216.7.110
network: 152.208.0.0/12
record:
  continent:
    code: NA
    geoname_id: 6255149
    names:
      de: Nordamerika
      en: North America
      es: Norteamérica
      fr: Amérique du Nord
      ja: 北アメリカ
      pt-BR: América do Norte
      ru: Северная Америка
      zh-CN: 北美洲
  country:
    geoname_id: 6252001
    iso_code: US
    names:
      de: USA
      en: United States
      es: Estados Unidos
      fr: États Unis
      ja: アメリカ
      pt-BR: EUA
      ru: США
      zh-CN: 美国
  registered_country:
    geoname_id: 6252001
    iso_code: US
    names:
      de: USA
      en: United States
      es: Estados Unidos
      fr: États Unis
      ja: アメリカ
      pt-BR: EUA
      ru: США
      zh-CN: 美国
---
database_path: GeoIP2-City.mmdb
requested_lookup: 152.216.7.110
network: 152.216.4.0/22
record:
  continent:
    code: NA
    geoname_id: 6255149
    names:
      de: Nordamerika
      en: North America
      es: Norteamérica
      fr: Amérique du Nord
      ja: 北アメリカ
      pt-BR: América do Norte
      ru: Северная Америка
      zh-CN: 北美洲
  country:
    geoname_id: 6252001
    iso_code: US
    names:
      de: USA
      en: United States
      es: Estados Unidos
      fr: États Unis
      ja: アメリカ
      pt-BR: EUA
      ru: США
      zh-CN: 美国
  registered_country:
    geoname_id: 6252001
    iso_code: US
    names:
      de: USA
      en: United States
      es: Estados Unidos
      fr: États Unis
      ja: アメリカ
      pt-BR: EUA
      ru: США
      zh-CN: 美国
</details> <details> <summary>Look up multiple IPs/networks in a single database</summary>
$ mmdbinspect -db GeoIP2-Connection-Type.mmdb 152.216.7.110/20 2001:0:98d8::/64
database_path: GeoIP2-Connection-Type.mmdb
requested_lookup: 152.216.7.110/20
network: 152.216.0.0/19
record:
  connection_type: Corporate
---
database_path: GeoIP2-Connection-Type.mmdb
requested_lookup: 2001:0:98d8::/64
network: 2001:0:98d8::/51
record:
  connection_type: Corporate
</details> <details> <summary>Look up multiple IPs/networks in multiple databases</summary>
$ mmdbinspect -db GeoLite2-ASN.mmdb -db GeoIP2-Connection-Type.mmdb 152.216.7.110/20 2001:0:98d8::/64
database_path: GeoIP/GeoLite2-ASN.mmdb
requested_lookup: 152.216.7.110/20
network: 152.216.0.0/19
record:
  autonomous_system_number: 30313
  autonomous_system_organization: IRS
---
database_path: GeoIP/GeoLite2-ASN.mmdb
requested_lookup: 2001:0:98d8::/64
network: 2001:0:98d8::/51
record:
  autonomous_system_number: 30313
  autonomous_system_organization: IRS
---
database_path: GeoIP2-Connection-Type.mmdb
requested_lookup: 152.216.7.110/20
network: 152.216.0.0/19
record:
  connection_type: Cable/DSL
---
database_path: GeoIP2-Connection-Type.mmdb
requested_lookup: 2001:0:98d8::/64
network: 2001:0:98d8::/51
record:
  connection_type: Cable/DSL
</details> <details> <summary>Using glob patterns to match multiple database files</summary>
$ mmdbinspect -db "GeoIP2-*.mmdb" 152.216.7.110
database_path: GeoIP2-Country.mmdb
requested_lookup: 152.216.7.110
network: 152.208.0.0/12
record:
  continent:
    code: NA
    geoname_id: 6255149
    names:
      de: Nordamerika
      en: North America
      # ... more names
  country:
    geoname_id: 6252001
    iso_code: US
    # ... more country data
---
database_path: GeoIP2-City.mmdb
requested_lookup: 152.216.7.110
network: 152.216.4.0/22
record:
  # ... city data
</details> <details> <sum

Related Skills

View on GitHub
GitHub Stars197
CategoryData
Updated2d ago
Forks20

Languages

Go

Security Score

95/100

Audited on Mar 24, 2026

No findings