Python: 使用 bottle 框架获取客户端的 Mac 地址

Python: Retrieve the Mac Address of the client using bottle framework

我想检索访问我的应用程序的用户的 Mac_Address。 我试过以下代码:

import uuid
from uuid import getnode as get_mac
mac_address = get_mac()
mac_address = ':'.join(("%012X" % mac_address)[i:i+2] for i in range(0, 12, 2))

这工作正常,但 returns 服务器的 mac 地址,而不是客户端的地址。有没有办法检索客户端的 mac 地址?

HTTP 协议不会将客户端的 MAC 地址发送到服务器,因此您的 server-side 应用程序无法访问它。

客户端的 MAC 地址永远不会透露给外部网络。因此不可能得到它。唯一的方法是在用户的机器上安装您的应用程序。

您将只能检索恰好与您位于同一 LAN 网段的用户的 MAC 地址,因此假设您可以依靠用户的 MAC 地址可用。