maxmind / libmaxminddb

C library for the MaxMind DB file format
https://maxmind.github.io/libmaxminddb/
Apache License 2.0
912 stars 239 forks source link

mmdblookup error on specific ip address #278

Closed urgordeadbeef closed 3 years ago

urgordeadbeef commented 3 years ago

When trying to exec mmdblookup -i 192.42.116.18 -f ./GeoIP2-City.mmdb country iso_code mmdblookup throwing following error Got an error looking up the entry data - The lookup path does not match the data (key that doesn't exist, array index bigger than the array, expected array or map where none exists)

With any other ip work just fine, but this one always produce this error.

PatrickCronin commented 3 years ago

Hi @urgordeadbeef, I'm not sure of your use case, but you may be interested in a combination of mmdbinspect and jq, which will just say null when the requested key doesn't exist:

$ mmdbinspect -db GeoIP2-City.mmdb 192.42.116.18 | jq -r '.[].Records[].Record.country.isocode'
null