Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
exports.mac_address_for(nic_name, function(err, mac){
if (err || !mac)
return cb(err || new Error('No MAC Address found.'));
wmic.get_value('nicconfig', what, 'MACAddress = \'' + mac + '\'', function(err, out){
if (err) return cb(err);
cb(null, out.split(',')[0].replace(/[^0-9\.]/g, ''));
});
})
}
exports.find_logged_user = function(callback) {
wmic.get_value('computersystem', 'username', null, function(err, stdout) {
if (err || stdout.toString().trim() == '')
return callback(err || new Error('No logged user found.'));
var out = stdout.toString().split("\\"),
user = clean_string(out[out.length-1]);
if (!user || user == '' || user == 'undefined')
return callback(err || new Error('No logged user found.'));
callback(null, user);
});
};
var fetch = function(key, section, value){
wmic.get_value(section, value, null, function(err, res){
if (key == 'device_type'){
res = err ? 'Desktop' : 'Laptop'
data[key] = res;
}
if (!err && res)
data[key] = res;
--count || callback(null, data)
})
}
exports.mac_address_for = function(nic_name, cb) {
var cond = 'NetConnectionID = \'' + nic_name + '\'';
wmic.get_value('nic', 'MACAddress', cond, cb);
}