如何使用 PHP 检测访问我们网站的用户的 MAC 地址?

发布于 2024-09-05 05:31:16 字数 62 浏览 5 评论 0原文

我知道如何追踪 IP 地址,但我需要追踪查看我的页面的用户的 MAC 地址。

如何做到这一点?

I know how to track down an IP address, but I need to track down the MAC address of the users viewing my page.

How to accomplish this?

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

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

发布评论

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

评论(3

束缚m 2024-09-12 05:31:16

除非用户与网络服务器位于同一 LAN 上,否则无法执行此操作。 MAC 地址位于 TCP/IP 下面的以太网层,并且不包含在从用户本地网络路由出去的 TCP/IP 数据包中。

在某些环境中,可能可以使用客户端插件来允许 Javascript 访问 MAC 地址,并将该信息传输到服务器。

如果这是某种基于 LAN 的 Web 应用程序,您可以尝试从 ARP 缓存中获取 MAC 地址。如何执行此操作取决于操作系统,但在 Linux 下您可以解析 arp -n 的输出

Unless the user is on the same LAN as the webserver, you cannot do this. MAC addresses are on the ethernet layer below TCP/IP, and are not included in TCP/IP packets routed off the users local network.

In some environments, it might be possible use to a client-side plugin to allow Javascript access to the MAC address, and transmit that information to the server.

If this is some kind of LAN based web application, you could try getting the MAC address out of the ARP cache. How you do this will depend on the operating system, but under Linux you could parse the output of arp -n

⒈起吃苦の倖褔 2024-09-12 05:31:16

你不能。
...好吧,如果没有一些完全可信的客户端软件(也称为浏览器插件)的帮助,就无法实现这一点。

MAC 地址不是由浏览器作为其请求的一部分提供的,也不能通过客户端 JavaScript 访问。

收集此类信息的唯一方法是提供可以代表您检索此类详细信息的浏览器插件。对于大多数浏览器/操作系统组合,这将要求您的用户信任并安装插件。

这实际上意味着可以为企业环境设计这样的解决方案......但极不可能适用于面向公众的网站。

如果您希望实现身份验证(出于访问或审核的目的),那么我建议您研究其他选项,例如证书等。

You can't.
... Well not without the aid of some fully trusted client software (aka a browser plug-in) to help.

The MAC address is not supplied by the browser as part of it's request and is not accessible via client side javascript either.

The only way to gather such information is to supply a browser plug-in that can retrieve such details on your behalf. In the case of most browser / operating system combinations, this will require your users trusting and installing the plug-in.

This effectively means that it's possible to engineer such a solution for an enterprise environment... but extremely unlikely to work for a public facing website.

If you're looking to achieve authentication (for the purposes of either access or auditing) then I would suggest investigating other options such as certificates and the like.

叫嚣ゝ 2024-09-12 05:31:16

你不能。一般来说,您无法知道用户的 MAC 地址。

但是,对于受信任网站上的 IE,请参阅 这个

You can't. In general, you can't know the MAC address of your users.

However, for IE on trusted websites, see this.

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