使用 PHP 进行反向 IP 查找

发布于 2024-09-13 02:58:48 字数 159 浏览 2 评论 0原文

在 PHP 中,有一个函数可以对域名进行反向查找,以找出托管该域名的特定共享托管服务器上托管了多少个网站。或者,有办法用 PHP 来做到这一点吗?

现在,我已经知道提供此服务的在线服务。不过,我想自己写一个脚本来完成。我就是想不通。

任何不建议使用第三方服务的建议都很好。

In PHP is there a function to do a reverse lookup on a domain name to find out how many websites are hosted on the particular shared hosting server that domain name is hosted on. Or, a way to do this with PHP?

Now, I'm already aware of the online services that offer this. However, I want to write a script to do it myself. I just can't figure it out.

Any suggestions that are not suggesting the use of a 3rd party service would be great.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(5

百善笑为先 2024-09-20 02:58:48

在 PHP 中,祝你

$domain = gethostbyaddr($ip);

好运!

In PHP just use

$domain = gethostbyaddr($ip);

good luck!

寄意 2024-09-20 02:58:48

它是可行的...我知道使用它的示例程序是用 Python 编写的
darkjumper

我不知道它是如何工作的,但它就是有效的..你可以阅读源代码在Python中并将该软件重写为php

您可以尝试使用-mverseonly选项执行该软件的反向ip功能

./darkjumper.py -t stackoverflow.com -mverseonly
返回结果

[+] Target set : stackoverflow.com
[+] Use proxy  : None
[+] Verbocity  : False
[+] Trying reverse your target's ip...
[+] Please wait...
-----------------------------------------
http://stackoverflow.com
http://gadgets.stackexchange.com
http://webmasters.stackexchange.com
http://stats.stackexchange.com
http://gaming.stackexchange.com
http://gamedev.stackexchange.com
http://photo.stackexchange.com
http://cooking.stackexchange.com
http://chat.meta.stackoverflow.com
http://stackoverflow.com
http://stackoverflow.com

----------------------------------------
[+] Found : 12  Domains hosted at this IP
----------------------------------------

it is do able... sample program that use it is in Python that I know
darkjumper

I don't know how it works, but it just works.. you can read the source code in Python and rewrite the software into php

You can try executing the reverse ip feature of this software by using -m reverseonly option

./darkjumper.py -t stackoverflow.com -m reverseonly
returning results

[+] Target set : stackoverflow.com
[+] Use proxy  : None
[+] Verbocity  : False
[+] Trying reverse your target's ip...
[+] Please wait...
-----------------------------------------
http://stackoverflow.com
http://gadgets.stackexchange.com
http://webmasters.stackexchange.com
http://stats.stackexchange.com
http://gaming.stackexchange.com
http://gamedev.stackexchange.com
http://photo.stackexchange.com
http://cooking.stackexchange.com
http://chat.meta.stackoverflow.com
http://stackoverflow.com
http://stackoverflow.com

----------------------------------------
[+] Found : 12  Domains hosted at this IP
----------------------------------------
归途 2024-09-20 02:58:48

没有万无一失的方法可以满足您的要求。

在 DNS 中,站点的 IP 地址(例如“1.5.7.9”)与域名(例如“9.7.5.1.in-addr.arpa”)相关联。该反向名称可能具有指向该域名的 PTR 记录。因此,“example.com”可能会映射到带有 A 记录的“1.5.7.9”,而“9.7.5.1.in-addr.arpa”可能会指向“example.com”。

一个 IP 地址可能有多个 PTR 记录。但一般来说,他们不会。因此,了解共享一个 IP 的所有域名的唯一方法是搜索并记住所有域名(不可行),或者从其他来源获取信息。

此外,一台给定的计算机可能分配有许多 IP。没有办法知道有多少。

There is no sure-fire way to do what you are asking.

In DNS, a site's IP address, such as "1.5.7.9", has associated with it a domain name like "9.7.5.1.in-addr.arpa". This reverse name may have PTR records pointing to the domain name. So, "example.com" may map to "1.5.7.9" with an A record, and "9.7.5.1.in-addr.arpa" may point back to "example.com".

An IP address may have more than one PTR record. But, generally, they do not. So the only way to know all the domain names that share one IP is to either search and remember all domain names (not feasible), or to get the information from some other source.

Furthermore, a given computer may have many IPs assigned to it. There's no way to know how many.

残疾 2024-09-20 02:58:48

也许我错了,但我认为(第一种)方法是单独查询每个域名并存储相应的 IP 地址。

当有人查询任何给定的域/IP 地址时,您只需显示共享同一 IP 的所有其他域,如果您没有列出域,则只需解析 IP 并存储它。

通过简单地更新与正在查询的域的同一 IP 地址中的所有域,或者仅更新域本身,可能限制为 1,解决@sarnold 提到的问题也非常容易(并且相对较快)。每天更新或类似的东西。

Maybe I'm wrong but I think (the / one) way to do it is to query each domain name individually and store the corresponding IP address.

When someone queries any given domain / IP address you just have to show all the other domains that share the same IP, if you don't have the domain listed yet you just have to resolve the IP and store it.

It would also be pretty easy (and relatively quick) to solve the problem @sarnold mentioned, by simply updating all the domains that are in the same IP address of the domain being queried - or just the domain itself, maybe with a limit of 1 update per day or something like that.

寄居者 2024-09-20 02:58:48

我很好奇怎么会有人知道:托管网站可以在 IP 上快速运行。很容易在这一分钟添加几千个域,并在下一分钟再次将它们全部删除。

您看过http://pink.bikeshed.com吗?或者http://red.bikeshed.com?或者http://white.bikeshed.com?将其扩展到我的 X11 rgb.txt 文件中的所有 754 个条目是非常容易的,尽管他们似乎没有这样做。支持用户动态创建“新网站”需要做更多的工作......

I'm curious how anyone would know: hosted web sites can come and go on IPs quite quickly. It is easy to add a few thousand domains this minute and remove them all again next minute.

Have you seen http://pink.bikeshed.com? Or http://red.bikeshed.com? Or http://white.bikeshed.com? It'd be super-easy to extend it to all 754 entries in my X11 rgb.txt file, though it doesn't appear that they have done so. It'd be a wee bit more work to support on-the-fly user creation of 'new websites' there...

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