@@ -0,0 +1,2144 @@
+import javax.naming.directory.Attributes;%0Aimport javax.naming.directory.DirContext;%0Aimport javax.naming.directory.InitialDirContext;%0Aimport javax.naming.Context;%0Aimport javax.naming.NamingEnumeration;%0Aimport javax.naming.NamingException;%0Aimport java.net.InetAddress;%0Aimport java.net.UnknownHostException;%0Aimport java.util.Hashtable;%0Aimport java.util.Scanner;%0A%0Apublic class DNSLookup%0A%7B%0A    public static void main(String args%5B%5D)%0A    %7B%0A      Scanner scan = new Scanner(System.in);%0A      String host = scan.nextLine();%0A        try%0A        %7B%0A            InetAddress inetAddress = InetAddress.getByName(host);%0A            // show the Internet Address as name/address%0A            System.out.println(inetAddress.getHostName() + %22 %22 + inetAddress.getHostAddress());%0A%0A            Hashtable%3CString, String%3E env = new Hashtable%3CString, String%3E();%0A            //env.put(Context.INITIAL_CONTEXT_FACTORY,%22com.sun.jndi.ldap.LdapCtxFactory%22);%0A            //env.put(Context.PROVIDER_URL, %22ldap://localhost:389/o=JNDITutorial%22);%0A%0A            env.put(Context.INITIAL_CONTEXT_FACTORY,%22com.sun.jndi.dns.DnsContextFactory%22);%0A            //env.put(Context.PROVIDER_URL, %22dns://google.com%22);%0A%0A            // get the default initial Directory Context%0A            InitialDirContext iDirC = new InitialDirContext(env);%0A            // get the DNS records for inetAddress%0A            Attributes attributes = iDirC.getAttributes(%22dns:/%22+inetAddress.getHostName());%0A            // get an enumeration of the attributes and print them out%0A            NamingEnumeration%3C?%3E attributeEnumeration = attributes.getAll();%0A            System.out.println(%22%22);%0A            while (attributeEnumeration.hasMore())%0A            %7B%0A                System.out.println(%22%22 + attributeEnumeration.next());%0A            %7D%0A            attributeEnumeration.close();%0A        %7D%0A        catch (UnknownHostException exception)%0A        %7B%0A            System.err.println(%22ERROR: Cannot access '%22 + host + %22'%22);%0A        %7D%0A        catch (NamingException exception)%0A        %7B%0A            System.err.println(%22ERROR: No DNS record for '%22 + host + %22'%22);%0A            exception.printStackTrace();%0A        %7D%0A    %7D%0A%7D%0A

Create DNSLookup.java