Skip to content

Instantly share code, notes, and snippets.

@tinshade
Created December 23, 2020 08:56
Show Gist options
  • Select an option

  • Save tinshade/12f27809446491f4da38c3132fadc07a to your computer and use it in GitHub Desktop.

Select an option

Save tinshade/12f27809446491f4da38c3132fadc07a to your computer and use it in GitHub Desktop.
Get the MAC address of a local system. This can be used to ID systems on your network. MAC addresses can be spoofed but are not in most cases and are static unless tampered with so it makes a better ID than a client's IP address.
/*
Get the MAC address of a local system.
This can be used to ID systems on your network.
MAC addresses can be spoofed but are not in most cases
and are static unless tampered with so it makes a better ID than a client's IP address.
*/
const getmac = require('getmac'); //https://www.npmjs.com/package/getmac
const callMac = () =>{
return getmac.default(); //You can also do getmac('eth0') for a specific inteface
}
console.log(callMac());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment