如何从JAVA应用程序中获取所有DNS条目? [英] How to fetch all DNS entries from JAVA application?

查看:466
本文介绍了如何从JAVA应用程序中获取所有DNS条目?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

到目前为止,我使用下面的代码获取给定IPAddress的DNS名称。而不是为网络中的每个IPAddress提取它,我想一​​次从DNS服务器获取所有DNS条目(IPAddress - HostName映射)。可能吗?如果是这样,怎么办?

As of now, I'm using the below code to get DNS name of the given IPAddress. Instead of fetching it for each IPAddress in the network, I want to fetch all the DNS entries (IPAddress - HostName mapping) from the DNS Server in one go. Is it possible? If so, how to do it?

InetAddress addr = InetAddress.getByName(address);
dnsname = addr.getCanonicalHostName().trim();


推荐答案

从公共DNS服务器,没有办法拉出所有数据。枚举所有IP地址是唯一的解决方案。

From a public DNS server, there is no way to pull out all the data it holds. Enumerating all the IP addresses one by one is the only solution.

如果您与DNS服务器有特殊关系(例如,由您的雇主管理)您可以向DNS管理员请求传输整个区域(称为AXFR的DNS请求)的权利。他们可以授权您的IP地址或给您一个TSIG密钥来验证自己。

If you have a special relationship with the DNS server (for instance, it is managed by your employer), you may request from the DNS administrator a right to transfer the whole zone (the DNS request known as AXFR). They may authorize your IP address or gives you a TSIG key to authentify yourself.

然后,您将不得不找到一种方法来进行区域传输(可能使用TSIG认证)在Java。使用这些关键字,我发现一些代码< a>和文档。使用代码搜索引擎,如 Google代码搜索 Krugle 查找使用示例。

Then, you will have to find a way to do a zone transfer (possibly with TSIG authentication) in Java. Using these keywords, I find some code and documentation. Use a code search engine like Google Code Search or Krugle to find examples of use.

[DNS专家可能会尖叫在NSEC上使用区域走但大多数DNS区域并未与NSEC签名。]

[DNS experts will probably scream "Use zone walking on NSEC" but most DNS zones are not signed with NSEC.]

这篇关于如何从JAVA应用程序中获取所有DNS条目?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆