Reverse IP Address Lookup with ColdFusion + Java

I needed to do a reverse lookup on some IP addresses in a database today. I found that you can do this pretty easily with java, and just as easily with ColdFusion. Here it is:
<cfset inet_address = CreateObject("java", "java.net.InetAddress")>
<cfset host_name = inet_address.getByName("66.249.66.99").getHostName()>
<cfoutput>#host_name#</cfoutput>
In java this would simply be:
System.out.println( java.net.InetAddress.getByName("66.249.66.99").getHostName() );
Tweet
Related Entries
- DNS Query with ColdFusion - October 27, 2005
- CFML on Google App Engine for Java - April 10, 2009
- Serializing CFC's in ColdFusion 8 - August 6, 2007
- Null Java References in CF 6 vs 7 - January 10, 2006
- Thread Priority, and Yielding - April 6, 2005
Trackbacks
Comments
<cfscript> writeOutput(CreateObject("java", "java.net.InetAddress").getByName("66.249.66.99").getHostName()); </cfscript>
[ ]'s great post =)
As well =))
Using the Java method is quicker. If an ISP has set reverse DNS records, the library gives you the rDNS in a few milliseconds. A lookup will always take longer.
rDNS is good data to have when you're tracking down CSRFs or badly behaving web spiders. Sometimes content writers won't add a rel="nofollow" to a link or form tag to keep spiders out. Or someone forgets to disallow a page. Googlebot & others are good but don't post data to forms.
(Cross site request forgery [CSRF or XSRF] is *still* the #1 security issue on web apps even in 2011. Visit OWASP to get the top 10 security issues affecting web apps.)
Post a Comment
Recent Entries
- Nginx redirect www to non www domain
- HashDOS and ColdFusion
- HackMyCF Updated for APSB11-29 Security Hotfix
- Adobe eSeminar on FuseGuard
- Determining Which Cumulative Hotfixes are Installed on ColdFusion
- Adding Two Factor Authentication to ColdFusion Administrator
- ColdFusion Developer Week at Adobe.com
- Bug Loading Scripts for CFFileUpload and CFMediaPlayer


add to del.icio.us



