Last active
October 1, 2021 21:03
-
-
Save JamoCA/83dc9aeaaa34ffd605cb to your computer and use it in GitHub Desktop.
Better ColdFusion DNS Look-ups using dnsjava.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<cfscript> | |
/* add dnsjava-*.jar to java path. Download from http://www.dnsjava.org/ */ | |
thisDomain = "google.com"; | |
dnsjava = createobject("java", "org.xbill.DNS.Address"); | |
dnsResponse = dnsjava.getAllByName(thisDomain); | |
ips = []; | |
if (isArray(dnsResponse)){ | |
for(i=1; i <= ArrayLen(dnsResponse); i++){ | |
arrayappend(ips, dnsResponse[i].getHostAddress()); | |
} | |
} | |
writeoutput(ThisDomain & " = " & arraylen(ips) & " IPs (" & arraytolist(ips, ", ") & ")"); | |
</cfscript> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment