2

I'm using the following code (dnsjava) to retrieve records from dns.

Record[] records1 = null;
Lookup look;
try {
    look = new Lookup(domainName,Type.A);
    try {
        look.setResolver(new SimpleResolver(ipAddress));
        } catch (UnknownHostException e) {
            e.printStackTrace();
        }
    records1 = look.run();
    for(int i=0;i<records1.length;i++){
        System.out.println(records1[i]);
    }
    } catch (TextParseException e) {
        e.printStackTrace();
    }

The above returns only the A records that gives the ipaddress of the domain's domain controller. Other A records were not retrieved. Also I have some other records (AAAA,MX,ATM Address,ISDN). Those records are also not retrieved even though I have specified the proper type. Can anyone tell me why is it so?

Anu
  • 177
  • 1
  • 1
  • 12
  • What other addresses did you expect it to retrieve? – Alnitak Aug 04 '14 at 13:13
  • I want to retrieve all the records. I have IPaddresses of other workstations and servers in the domain. I want to retrieve them too – Anu Aug 05 '14 at 04:14
  • DNS doesn't work that way - unless zone transfer is supported you have to know the name of a machine to get its address. Alternately, if reverse DNS is correctly set up you could enumerate every local IP address and lookup the PTR records to find the name associated without. – Alnitak Aug 05 '14 at 07:45
  • Actually I dont need the ipaddress. I just want to retrieve all records in DNS. But I could not retrieve AAAA,MX,etc records from DNS – Anu Aug 05 '14 at 09:14

1 Answers1

4

Change it to

look = new Lookup(domain,Type.ANY);

it fetches all record

Ajay Chaudhary
  • 298
  • 2
  • 14