Getting client's MAC address on node.js

烂漫一生 提交于 2019-12-01 03:37:55

Unless your code is running on the same LAN segment as the client, you cannot obtain the MAC address of a client. You'd need to likely shell out to a command line tool or native support to gain addresses on the local LAN segment.

For nodejs: https://npmjs.org/search?q=Arp

If you try to get remote clients' MAC addresses, you'll end up with the address of a router more than likely.

The getmac module will do this. It calls out to the command line to get the system's network config info and then uses a regex to parse output to find the mac address. The system commands it uses are getmac (Windows) or ifconfig (other platforms).

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!