GeoIP – IP Location Lookup

Find the location of an IP address with this GeoIP lookup tool.



What is a GeoIP lookup?

IP Geolocation involves attempting to find the location of an IP address in the real world. Due to the fact that IP addresses are assigned to organization and these are ever changing associations it can be difficult to determine exactly where in the world an IP address is located. There are different services that provide databases of this information for public use. Maxmind is one of the most well known and its service is used for many things including fraud prevention. A merchant can use the IP location of a customer to cross reference with Credit Card data in an effort to reduce credit card fraud as an example.

Maxmind has a number of GeoIP databases and services, the commercial options are quite a bit more accurate than the freely available GeoIP lite version of the database especially for locations outside of the United States. The Maxmind API is relatively inexpensive so if you are interested in performing thousands of GeoIP lookups I recommend using that service directly. The tool I have built here is more for ad-hoc lookups, when you are performing security testing or troubleshooting an issue. Note that this service is limited 50 lookups a day and that includes the other IP Tools that HackerTarget.com has made available.

GeoIP API

This tool is built on an simple API that we have provided to the public. No signup or keys are required at this stage, just simply query the API and get your results. Note the system is in beta at the moment and we make no guarantees about accuracy or service availability.

Using the GeoAPI is a simple matter of querying following URL with an IP address appended to the "q" parameter. See below for an example, you could put this URL into a browser, use curl or a scripting language such as php, python or ruby to make the HTTP request.

curl http://api.hackertarget.com/geoip/?q=1.1.1.1

Mapping the Latitude and Longitude on a Google Map

Google has a range of mapping services, here is a simple process to add those co-ordinates you get from the GeoIP API or the tool above to a Google map that is a static exportable image.

http://maps.googleapis.com/maps/api/staticmap?center=38.000000,-97.000000&zoom=5&size=400x400&sensor=false&markers=color:blue|38.000000,-97.000000

While this URL may look a little intimidating it is really simple, the lat / lon are placed as the center of the Google map and also to place the marker. The zoom will affect how much detail the map has and the size is also pretty obvious. Try it, grab a location by finding an IP address, paste the URL above into a browser and swap out the co-ordinates.

The Google Static map API site has all the details regarding the parameters and usage - it is a fast and easy way to whip up a map to add to a blog post, article or website.