Getting remote User Mac address

前端 未结 2 470

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

2条回答
  •  说谎
    说谎 (楼主)
    2021-01-26 00:24

    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

提交回复
热议问题