Getting remote User Mac address

前端 未结 2 469

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:17

    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:

    • Using Java (with a signed applet)
    • Using signed Javascript, which in FF (and Mozilla in general) gets higher privileges than normal JS (but it is fairly complicated to set up)
    0 讨论(0)
  • 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

    0 讨论(0)
提交回复
热议问题