does anyone know how to programmatically quiery the list of web sites sitting at a given server IP address? And, by the way, how to prevent others from seeing what other sites your server hosts??
migrated from stackoverflow.com Nov 3 '09 at 14:03
This question came from our site for professional and enthusiast programmers.
|
You can't hide a site if its in the interweb DNS - would be like having an ex-directory phone number that is in the directory. Of course you can run a server that is not associated with anything in DNS. | |||
|
feedback
|
|
I don't think there's any way to do this from the outside. As long as your server configuration is secure (it should be anyway), there's no reasonable way to do it. Someone could always do an ip address lookup for every possible domain name and compare the ip addresses. There's no way you could prevent them from doing that, but it's not very realistic. | |||||
feedback
|
|
This isn't programmatic, but this site attempts to answer that question. Here's the page for stackoverflow.com's IP http://onsamehost.com/69.59.196.211/ EDIT: That is, it tries to answer your first question. | |||||
feedback
|
|
This is knows as a reverse DNS lookup (or simply, rDNS). You can use the host command to do an rDNS on Linux:
You can use the nslookup command on Windows/Linux:
Most networking libraries provide some way to get this information. For example, you can use the following in Java:
But please note that you might not get a list of all the domain names that are pointing to the specified IP address. For example, the IP address in the above examples belongs to one of my servers which has several domains pointing to it but an rDNS lookup only returns a single record. Perhaps further investigation of this behaviour can help you figure out how to prevent your domain names from showing up in the rDNS lookups. | |||||
feedback
|
|
From the "outsite" or in an anonymous manner, there is no way to programatically request the list of domain names that are bound to a particular web server's IP address. Stock security built into IIS/Apache/others prevent such a thing from happening. The ability to have a web server listen for multiple domain names on a single IP address is credited to HTTP 1.1's Host Header implementation. Websites like http://www.sitedossier.com maintain a database of domain names and their respective "www" DNS A record, then allow us to query by IP address. They likely scrape search engine results by requesting a large sampling of fake queries (say straight from a dictionary), or have implemented a basic spider themselves (which would be by far more efficient). | |||
|
feedback
|
|
Perform a port scan using nmap and look for web servers. | |||||
feedback
|
|
Another site I have used with good results is http://www.sitedossier.com/ip/69.59.196.211 | |||
|
feedback
|