I am working on a project using mongodb, express and nodejs to build an intranet based webapp. The goal of the project is to acquire a user mac address upon authentication and r
I imagine you would have to do this client side and pass it back.
By the sounds of this SO answer you can't do it easily in in Javascript but the answer suggests:
Doesn't seem like you can get the MAC address from a IP.
The documentation of getMac doesn't have anything related to .getMac('192.168.1.100')
A way I would see this working is having a database with the IPs and their MAC address.
This would require something to save those each MAC address in the database. Probably a script running on startup on each computer.
Someone asked this question on security.stackexchange.com. As it is on the same network, if you use the command ping
on the command line, the MAC address of that IP would be registered on ARP list.
ping your_ip_address
And with this you should be able to get the MAC Addresses:
arp -a
With that in mind, I found these 2 nodejs packages that might interest you: https://www.npmjs.com/package/ping and https://www.npmjs.com/package/node-arp