code cleanup, updated docs
This commit is contained in:
@@ -108,7 +108,6 @@ function getDefaultNetworkInterface() {
|
||||
if (_linux) { cmd = 'ip route 2> /dev/null | grep default | awk \'{print $5}\''; }
|
||||
if (_darwin) { cmd = 'route -n get default 2>/dev/null | grep interface: | awk \'{print $2}\''; }
|
||||
if (_freebsd || _openbsd || _netbsd || _sunos) { cmd = 'route get 0.0.0.0 | grep interface:'; }
|
||||
// console.log('SYNC - default darwin 3');
|
||||
let result = execSync(cmd);
|
||||
ifacename = result.toString().split('\n')[0];
|
||||
if (ifacename.indexOf(':') > -1) {
|
||||
@@ -173,7 +172,6 @@ function getMacAddresses() {
|
||||
if (_darwin) {
|
||||
try {
|
||||
const cmd = '/sbin/ifconfig';
|
||||
// console.log('SYNC - macAde darwin 6');
|
||||
let res = execSync(cmd);
|
||||
const lines = res.toString().split('\n');
|
||||
for (let i = 0; i < lines.length; i++) {
|
||||
@@ -247,8 +245,6 @@ function parseLinesWindowsNics(sections, nconfigsections) {
|
||||
}
|
||||
|
||||
function getWindowsNics() {
|
||||
// const cmd = util.getWmic() + ' nic get /value';
|
||||
// const cmdnicconfig = util.getWmic() + ' nicconfig get dhcpEnabled /value';
|
||||
return new Promise((resolve) => {
|
||||
process.nextTick(() => {
|
||||
let cmd = 'Get-WmiObject Win32_NetworkAdapter | fl *' + '; echo \'#-#-#-#\';';
|
||||
@@ -394,7 +390,6 @@ function getWindowsIEEE8021x(connectionType, iface, ifaces) {
|
||||
i8021x.state = 'Enabled';
|
||||
}
|
||||
} catch (error) {
|
||||
// console.log('Error getting wired information:', error);
|
||||
return i8021x;
|
||||
}
|
||||
} else if (connectionType == 'wireless') {
|
||||
@@ -416,7 +411,6 @@ function getWindowsIEEE8021x(connectionType, iface, ifaces) {
|
||||
i8021x.protocol = i8021xProtocol.split(':').pop();
|
||||
}
|
||||
} catch (error) {
|
||||
// console.log('Error getting wireless information:', error);
|
||||
if (error.status === 1 && error.stdout.includes('AutoConfig')) {
|
||||
i8021x.state = 'Disabled';
|
||||
i8021x.protocol = 'Not defined';
|
||||
@@ -1409,7 +1403,6 @@ function networkConnections(callback) {
|
||||
peerip = peeraddress.join(':');
|
||||
}
|
||||
let connstate = line[5];
|
||||
// if (connstate === 'VERBUNDEN') connstate = 'ESTABLISHED';
|
||||
let proc = line[6].split('/');
|
||||
|
||||
if (connstate) {
|
||||
|
||||
@@ -18,7 +18,6 @@ const fs = require('fs');
|
||||
const util = require('./util');
|
||||
const exec = require('child_process').exec;
|
||||
const execSync = require('child_process').execSync;
|
||||
// const execPromise = util.promisify(require('child_process').exec);
|
||||
|
||||
let _platform = process.platform;
|
||||
|
||||
@@ -1090,7 +1089,6 @@ function uuid(callback) {
|
||||
const jsonObj = JSON.parse(stdout.toString());
|
||||
if (jsonObj.SPHardwareDataType && jsonObj.SPHardwareDataType.length > 0) {
|
||||
const spHardware = jsonObj.SPHardwareDataType[0];
|
||||
// result.os = parts.length > 1 ? parts[1].trim().toLowerCase() : '';
|
||||
result.os = spHardware.platform_UUID.toLowerCase();
|
||||
result.hardware = spHardware.serial_number;
|
||||
}
|
||||
|
||||
@@ -14,9 +14,7 @@
|
||||
// ----------------------------------------------------------------------------------
|
||||
|
||||
const exec = require('child_process').exec;
|
||||
// const execSync = require('child_process').execSync;
|
||||
const util = require('./util');
|
||||
// const fs = require('fs');
|
||||
|
||||
let _platform = process.platform;
|
||||
|
||||
|
||||
+1
-9
@@ -150,7 +150,6 @@ function services(srv, callback) {
|
||||
let srvs = srvString.split('|');
|
||||
let result = [];
|
||||
let dataSrv = [];
|
||||
// let allSrv = [];
|
||||
|
||||
if (_linux || _freebsd || _openbsd || _netbsd || _darwin) {
|
||||
if ((_linux || _freebsd || _openbsd || _netbsd) && srvString === '*') {
|
||||
@@ -1166,18 +1165,13 @@ function processLoad(proc, callback) {
|
||||
listPos = j;
|
||||
}
|
||||
}
|
||||
// console.log(listPos);
|
||||
processes.forEach(function (proc) {
|
||||
// console.log(proc)
|
||||
// console.log(item)
|
||||
// inList = inList || item.name.toLowerCase() === proc.toLowerCase();
|
||||
|
||||
if (item.name.toLowerCase().indexOf(proc.toLowerCase()) >= 0 && !inList) {
|
||||
inList = true;
|
||||
name = proc;
|
||||
}
|
||||
});
|
||||
// console.log(item);
|
||||
// console.log(listPos);
|
||||
if ((processesString === '*') || inList) {
|
||||
if (listPos < 0) {
|
||||
result.push({
|
||||
@@ -1265,10 +1259,8 @@ function processLoad(proc, callback) {
|
||||
});
|
||||
|
||||
_process_cpu.all = all;
|
||||
// _process_cpu.list = list_new;
|
||||
_process_cpu.list = Object.assign({}, list_new);
|
||||
_process_cpu.ms = Date.now() - _process_cpu.ms;
|
||||
// _process_cpu.result = result;
|
||||
_process_cpu.result = Object.assign({}, result);
|
||||
if (callback) { callback(result); }
|
||||
resolve(result);
|
||||
|
||||
Reference in New Issue
Block a user