Is there a way to find client's mac address on Node.js? I have been searching about it and i found node-sigar project but it didn't works because it throws a "cannot find module ./build/Release/sigar" error.
Asked
Active
Viewed 3.1k times
2 Answers
14
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.

WiredPrairie
- 58,954
- 17
- 116
- 143
-
2If the code is running on the same LAN segment as the client, he can try something like [this](https://github.com/bcamarneiro/macfromip) – Bruno Camarneiro Sep 25 '14 at 08:21
-3
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).

broofa
- 37,461
- 11
- 73
- 73
-
4getmac does not return the client's MAC Address (as was requested by the OP), it returns the local machine's MAC Address. – user3507600 Jun 18 '14 at 03:12