使用任意一个名称服务器ip映射域名服务器ip列表
我可以使用以下代码获取名称服务器 IP:
$result = exec("host -t NS google.com", $outputLines);
foreach ($outputLines as $outputLine)
{
$buffer = explode(" ", $outputLine);
$nsList[] = $buffer[3];
}
$ipList = array_map("gethostbyname", $nsList);
print_r($ipList);
现在 $ipList
保存 IP 列表。有没有办法通过输入$ipList
中的任意一个IP来获取所有这些IP。
这就像逆向过程,我想通过输入 $ipList
变量中存在的任何一个 IP 来获取 $ipList
变量保存的所有 IP。
I'm able to get the nameserver ip by using this code:
$result = exec("host -t NS google.com", $outputLines);
foreach ($outputLines as $outputLine)
{
$buffer = explode(" ", $outputLine);
$nsList[] = $buffer[3];
}
$ipList = array_map("gethostbyname", $nsList);
print_r($ipList);
Now $ipList
holds the IP list. Is there any way to get all these IP by inputting any one of the IP in $ipList
.
It is like reverse process, I want to get all the IP which $ipList
variable holds by inputting any one of the IP present in the $ipList
variable.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果我正确理解您的问题,您希望能够在给定单个名称服务器 IP 地址的一组名称服务器(即 NS1、NS2、NS3...)中找到名称服务器的所有 IP 地址?
这不是......很容易实现的,但是它是可以做到的,尽管你必须花很长的时间来解决这个问题才能做到这一点。您必须连接到外部服务来尝试获取驻留在 IP 地址上的名称服务器所使用的 DNS 名称,然后尝试找到该名称服务器正在使用的一组域,然后分析正在使用的名称服务器通过这些域(祈祷你能获得所有这些域),然后基本上针对它们运行现有的脚本。
也许我错了,但我认为你可能正在以错误的方式解决任何问题,我曾经在域管理领域工作,一直会遇到此类问题,不幸的是,它最终成为大量 DNS 数据聚合和分析工作以便轻松解决此类问题。
If i understand correctly what you are asking which is that you want to be able to find all of the IP addresses of the nameservers in a group of nameservers (ie, NS1, NS2, NS3...) given a single nameservers IP address?
This isnt... quite easily possible, however it IS possible to do although you would have to go a LONG way around the problem to do it. You would have to hook into external services to try and get the DNS name being used by the nameserver residing on an IP address, and then try and find a group of domains that are being used by the nameserver, and then analyze the nameservers being used by those domains (crossing your fingers that you get them all) and then essentially run your existing script against them.
Maybe im wrong but i think you may be approaching whatever problem you have the wrong way, i used to work in domain management and would run into these kinds of problems all the time and unfortunately it ends being alot of DNS data aggregation and analysis work in order to solve these kinds of problems easily.
因此,您希望能够找到数组中与某个 IP 地址匹配的所有值。这可以通过
array_keys()
(man page) 及其可选的search_value
参数。So you want to be able to find all the values in an array that match a certain IP address. This can be done with
array_keys()
(man page) and its optionalsearch_value
parameter.