Ok, here's an update.
First of all - thanks, guys, you've been really helpful.
I've gone through a lot of tools and options and I finally came to a conclusion that there are pretty awesome tools that do that already. None of them seem to be 100% accurate, but it's to be expected given the nature of the task.
I'm not sure whether it's worth implementing another tool, especially since it will rely on others to work, and will not yield much better results than the rest. But if I were to, I'd have it do the following:
- Do a preliminary filtering out IPs which don't have HTTP and HTTPS ports open
- Use a number of tools (listed later) which will return a list of domains
- Check each of the domain's A records (because the tools may have old information)
A tool like that would mostly be useful for a large amount of IPs which one would not want to do manually. If we want to do just a handful of check one can just do it manually with the following tools:
https://www.robtex.com/en/advisory/dns/127/0/0/1/ - provides lots of information including up to a 100 domains associated with an ip, but doesn't work all of the time - I get a lot of bad gateway errors
http://viewdns.info/ - lots of useful tools, and a very simple but very accurate reverse DNS lookup, free api with up to 250 requests monthly, probably the most accurate tool out there, still not 100% up-to-date
http://reverseip.domaintools.com/search/?q=127.0.0.1 - another very accurate reverse DNS tool, which provides up to 3 results for free - very useful for another layer of preliminary filtering. If it doesn't return anything, there probably isn't anything.
Here are a couple of IP neighbourhood checkers, which are really useful:
http://www.ipneighbour.com/ - returns accurate results
https://majestic.com/reports/neighbourhood-checker - returns nice results for reverse DNS look up as part of neighbors, allows only so many checks before asks for registration
And a list of tools which don't do anything much different than what a simple gethostbyaddr() would return:
http://mxtoolbox.com/http://remote.12dt.com/https://www.dnswatch.info/http://ping.eu/rev-lookup/http://www.dnsgoodies.com/If I decide to actually develop the class (it will probably be PHP or JAVA) I'll share it, but at the moment I don't think it's worth the time invested. Still had fun doing the research though.