Automating Reverse IP Lookup
I recently found the need to analyze a list of IP addresses to determine which companies were visiting a client’s website. While there are services that provide this data for a fee, I thought I would take a crack at automating the reverse IP address lookup process with code. In short, I wanted to create a simple application that could take a list of IP addresses as input and determine their owners.
My first thought was to do this with a simple Automated Reverse IP lookup. After a few tests, I noticed that many addresses returned information for the Internet Service Provider. Some addresses returned no results at all. This was far from ideal. However, I decided to leave the reverse IP address lookup code in the application should I ever want to use it for anything in the future.
Next, I decided to add geographical IP information into the mix. I found a great public API at http://ip-api.com. This allowed me to retrieve a variety of useful information such as organization name and location data. However, several of the results were still returning the Internet Service Provider data, rather than the company data.
Finally, I discovered the ARIN Whois API. This public API allowed me to pull some useful WhoIs data. One of the key datapoints I could now pull was the customer name for the IP address. This filled in one of the key gaps left by the geographical IP information.
The last step was to add a csv export. For this I used a great csv export library. This allowed me to take json results of my IP Address queries and export them into a user friendly format.
I have added the code to GitHub: