uuid added mac addresses
This commit is contained in:
+25
-1
@@ -960,13 +960,37 @@ function shell(callback) {
|
||||
|
||||
exports.shell = shell;
|
||||
|
||||
function getUniqueMacAdresses() {
|
||||
const ifaces = os.networkInterfaces();
|
||||
let macs = [];
|
||||
for (let dev in ifaces) {
|
||||
if ({}.hasOwnProperty.call(ifaces, dev)) {
|
||||
ifaces[dev].forEach(function (details) {
|
||||
if (details && details.mac && details.mac !== '00:00:00:00:00:00') {
|
||||
const mac = details.mac.toLowerCase();
|
||||
if (macs.indexOf(mac) === -1) {
|
||||
macs.push(mac);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
macs = macs.sort(function (a, b) {
|
||||
if (a < b) { return -1; }
|
||||
if (a > b) { return 1; }
|
||||
return 0;
|
||||
});
|
||||
return macs;
|
||||
}
|
||||
|
||||
function uuid(callback) {
|
||||
return new Promise((resolve) => {
|
||||
process.nextTick(() => {
|
||||
|
||||
let result = {
|
||||
os: '',
|
||||
hardware: ''
|
||||
hardware: '',
|
||||
macs: getUniqueMacAdresses()
|
||||
};
|
||||
let parts;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user