github.com/emc-advanced-dev/unik@v0.0.0-20190717152701-a58d3e8e33b7/containers/compilers/rump/nodejs/node-wrapper/node_modules/macaddress/lib/unix.js (about) 1 var exec = require('child_process').exec; 2 3 module.exports = function (iface, callback) { 4 exec("ifconfig " + iface, function (err, out) { 5 if (err) { 6 callback(err, null); 7 return; 8 } 9 var match = /[a-f0-9]{2}(:[a-f0-9]{2}){5}/.exec(out.toLowerCase()); 10 if (!match) { 11 callback("did not find a mac address", null); 12 return; 13 } 14 callback(null, match[0].toLowerCase()); 15 }); 16 };