ip2geo – a handy script for geoip lookups
This script reads IP addresses from STDIN and uses the MaxMind GeoIP databases to output various data points for each source IP. The script uses the GeoCityLite and ASN databases for enrichment. The user can specify various fields for output in a format string. You can use this script to download the GeoIP database files if needed as well.
Look up a single IP address with default output format string:
echo 126.96.36.199 | ./ip2geo.py