LLMNR (Local Multicast Name Resolution) Java Responder

Do you know if a Java library exists for the LLMNR responder? I was looking for the jmDns library, but it looks like it is only for Bonjour services.

If not, can I make a UDP responder, but is there a library for recording / recording DNS records?

+4
source share
1 answer

I do not know the LLMNR Java responder (*), but to your second question for the library, analyze / record DNS records, there dnsjava .

Record[] records = new Lookup("stackoverflow.com", Type.A).run();
for (Record record : records) {
    ARecord a = (ARecord) record;
    System.out.println("Host " + a.getName() + " has address " + a.getAddress().getHostAddress());
}
byte[] ip = {(byte)192, (byte)168, (byte)0, (byte)10};
Name zone = Name.fromString("dyn.test.example.");
Name host = Name.fromString("host", zone);
InetAddress address = InetAddress.getByAddress(ip);
ARecord r = new ARecord(host, DClass.IN, 3600, address);
System.out.println(new sun.misc.HexDumpEncoder().encode(r.toWireCanonical()));

(yes, I use the Sun-private API to print a hex dump, sue me)

Result:

Host stackoverflow.com. has address 151.101.193.69
Host stackoverflow.com. has address 151.101.129.69
Host stackoverflow.com. has address 151.101.1.69
Host stackoverflow.com. has address 151.101.65.69
0000: 04 68 6F 73 74 03 64 79   6E 04 74 65 73 74 07 65  .host.dyn.test.e
0010: 78 61 6D 70 6C 65 00 00   01 00 01 00 00 0E 10 00  xample..........
0020: 04 C0 A8 00 0A 

(*) , , mdnsjava? ( dnsjava). , , , , - . , , , , , .

0

Source: https://habr.com/ru/post/1659983/


All Articles