You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

17 lines
480 B

var execFile = require('child_process').execFile;
module.exports = function (iface, callback) {
execFile("ifconfig", [iface], function (err, out) {
if (err) {
callback(err, null);
return;
}
var match = /[a-f0-9]{2}(:[a-f0-9]{2}){5}/.exec(out.toLowerCase());
if (!match) {
callback("did not find a mac address", null);
return;
}
callback(null, match[0].toLowerCase());
});
};