From 509314550662397943b8e2856dc9628fe529d33f Mon Sep 17 00:00:00 2001 From: Sebastian Hildebrandt Date: Fri, 27 Nov 2020 15:05:40 +0100 Subject: [PATCH] code cleanup --- lib/network.js | 6 +++--- lib/processes.js | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/network.js b/lib/network.js index d1e8c60..3d3ed96 100644 --- a/lib/network.js +++ b/lib/network.js @@ -1103,7 +1103,7 @@ function networkStatsSingle(iface) { } } if (_freebsd || _openbsd || _netbsd) { - cmd = 'netstat -ibndI ' + ifaceSanitized; + cmd = 'netstat -ibndI ' + ifaceSanitized; // lgtm [js/shell-command-constructed-from-input] exec(cmd, function (error, stdout) { if (!error) { lines = stdout.toString().split('\n'); @@ -1125,12 +1125,12 @@ function networkStatsSingle(iface) { }); } if (_darwin) { - cmd = 'ifconfig ' + ifaceSanitized + ' | grep "status"'; + cmd = 'ifconfig ' + ifaceSanitized + ' | grep "status"'; // lgtm [js/shell-command-constructed-from-input] exec(cmd, function (error, stdout) { result.operstate = (stdout.toString().split(':')[1] || '').trim(); result.operstate = (result.operstate || '').toLowerCase(); result.operstate = (result.operstate === 'active' ? 'up' : (result.operstate === 'inactive' ? 'down' : 'unknown')); - cmd = 'netstat -bdI ' + ifaceSanitized; + cmd = 'netstat -bdI ' + ifaceSanitized; // lgtm [js/shell-command-constructed-from-input] exec(cmd, function (error, stdout) { if (!error) { lines = stdout.toString().split('\n'); diff --git a/lib/processes.js b/lib/processes.js index 81eadcb..10e942b 100644 --- a/lib/processes.js +++ b/lib/processes.js @@ -137,7 +137,7 @@ function services(srv, callback) { } let comm = (_darwin) ? 'ps -caxo pcpu,pmem,pid,command' : 'ps -axo pcpu,pmem,pid,command'; if (srvString !== '' && srvs.length > 0) { - exec(comm + ' | grep -v grep | grep -iE "' + srvString + '"', { maxBuffer: 1024 * 20000 }, function (error, stdout) { + exec(comm + ' | grep -v grep | grep -iE "' + srvString + '"', { maxBuffer: 1024 * 20000 }, function (error, stdout) { // lgtm [js/shell-command-constructed-from-input] if (!error) { let lines = stdout.toString().replace(/ +/g, ' ').replace(/,+/g, '.').split('\n'); srvs.forEach(function (srv) { @@ -233,7 +233,7 @@ function services(srv, callback) { resolve(result); } } else { - exec('ps -o comm | grep -v grep | egrep "' + srvString + '"', { maxBuffer: 1024 * 20000 }, function (error, stdout) { + exec('ps -o comm | grep -v grep | egrep "' + srvString + '"', { maxBuffer: 1024 * 20000 }, function (error, stdout) { // lgtm [js/shell-command-constructed-from-input] if (!error) { let lines = stdout.toString().replace(/ +/g, ' ').replace(/,+/g, '.').split('\n'); srvs.forEach(function (srv) {