使用任意一个名称服务器ip映射域名服务器ip列表

发布于 2024-12-16 02:05:16 字数 468 浏览 4 评论 0原文

我可以使用以下代码获取名称服务器 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

笛声青案梦长安 2024-12-23 02:05:16

如果我正确理解您的问题,您希望能够在给定单个名称服务器 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.

池木 2024-12-23 02:05:16

因此,您希望能够找到数组中与某个 IP 地址匹配的所有值。这可以通过 array_keys() (man page) 及其可选的 search_value 参数。

$ip_we_are_searching_for = '192.168.0.1';
$matching_keys = array_keys($ip, $ip_we_are_searching_for);
var_dump($matching_keys);

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 optional search_value parameter.

$ip_we_are_searching_for = '192.168.0.1';
$matching_keys = array_keys($ip, $ip_we_are_searching_for);
var_dump($matching_keys);
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文