Reputation: 103
I am trying to check the validity of a website being visited. My plan to do this was to look for packets sent/received to a remote port 443, and then get the SSL certificate using the IP address of the remote host. I can look for the packets reliably, however I am having trouble using the IP address to retrive the SSL certificate. I tried implementing the reverse DNS lookup code found here: Reverse IP Domain Check? to get a domain name for retreiving the SSl certificate but this only returns values for my computer and routers name.
Is there anyway to retrive SSL certificates using IP? Or is there any other way I can get the website URI?
Thanks
Upvotes: 0
Views: 396
Reputation: 771
Generally speaking, there is not way to get web-site host portion of its URL from an IP address. It's a common situation, when hundreds of web-sites are hosted at the same IP. A shared web-server looks into host header value to retrieve a particular web-site. Reverse DNS lookup doesn't have to return matching value for direct lookup (unlike names used in MX records, for instance). However, it's easy to test cert validity if you know a proper DNS host name, can provide code for that.
Upvotes: 1