code cleanup
This commit is contained in:
parent
78c6e558ec
commit
5093145506
@ -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');
|
||||
|
||||
@ -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) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user