systeminformation 5.12.6 → 5.12.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/lib/audio.js +0 -3
- package/lib/battery.js +1 -2
- package/lib/cpu.js +1 -24
- package/lib/network.js +0 -7
- package/lib/osinfo.js +13 -21
- package/lib/printer.js +0 -2
- package/lib/processes.js +14 -36
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
[![Sponsoring][sponsor-badge]][sponsor-url]
|
|
31
31
|
[![MIT license][license-img]][license-url]
|
|
32
32
|
|
|
33
|
-
This is amazing. Started as a small project just for myself, it now has > 15,000 lines of code, > 500 versions published,
|
|
33
|
+
This is amazing. Started as a small project just for myself, it now has > 15,000 lines of code, > 500 versions published, up to 5 mio downloads per month, > 100 mio downloads overall. #1 NPM ranking for backend packages. Thank you to all who contributed to this project!
|
|
34
34
|
|
|
35
35
|
## New Version 5.0
|
|
36
36
|
|
|
@@ -208,7 +208,7 @@ Full function reference with examples can be found at [https://systeminformation
|
|
|
208
208
|
| | governor | X | | | | | e.g. 'powersave' |
|
|
209
209
|
| | cores | X | X | X | X | | # cores |
|
|
210
210
|
| | physicalCores | X | X | X | X | | # physical cores |
|
|
211
|
-
| | efficiencyCores | X | | X | | | #
|
|
211
|
+
| | efficiencyCores | X | | X | | | # efficiency cores |
|
|
212
212
|
| | performanceCores | X | | X | | | # performance cores |
|
|
213
213
|
| | processors | X | X | X | X | | # processors |
|
|
214
214
|
| | socket | X | X | | X | | socket type e.g. "LGA1356" |
|
package/lib/audio.js
CHANGED
|
@@ -16,7 +16,6 @@
|
|
|
16
16
|
const exec = require('child_process').exec;
|
|
17
17
|
const execSync = require('child_process').execSync;
|
|
18
18
|
const util = require('./util');
|
|
19
|
-
// const fs = require('fs');
|
|
20
19
|
|
|
21
20
|
let _platform = process.platform;
|
|
22
21
|
|
|
@@ -79,7 +78,6 @@ function parseLinuxAudioPciMM(lines, audioPCI) {
|
|
|
79
78
|
|
|
80
79
|
result.id = slotId;
|
|
81
80
|
result.name = util.getValue(lines, 'SDevice');
|
|
82
|
-
// result.type = util.getValue(lines, 'Class');
|
|
83
81
|
result.manufacturer = util.getValue(lines, 'SVendor');
|
|
84
82
|
result.revision = util.getValue(lines, 'Rev');
|
|
85
83
|
result.driver = pciMatch && pciMatch.length === 1 && pciMatch[0].driver ? pciMatch[0].driver : '';
|
|
@@ -128,7 +126,6 @@ function parseDarwinAudio(audioObject, id) {
|
|
|
128
126
|
function parseWindowsAudio(lines) {
|
|
129
127
|
const result = {};
|
|
130
128
|
const status = util.getValue(lines, 'StatusInfo', ':');
|
|
131
|
-
// const description = util.getValue(lines, 'Description', ':');
|
|
132
129
|
|
|
133
130
|
result.id = util.getValue(lines, 'DeviceID', ':'); // PNPDeviceID??
|
|
134
131
|
result.name = util.getValue(lines, 'name', ':');
|
package/lib/battery.js
CHANGED
|
@@ -51,7 +51,7 @@ function parseWinBatteryPart(lines, designedCapacity, fullChargeCapacity) {
|
|
|
51
51
|
result.capacityUnit = 'mWh';
|
|
52
52
|
result.percent = parseInt(util.getValue(lines, 'EstimatedChargeRemaining', ':') || 0);
|
|
53
53
|
result.currentCapacity = parseInt(result.maxCapacity * result.percent / 100);
|
|
54
|
-
result.isCharging = (statusValue >= 6 && statusValue <= 9) || statusValue === 11 || (
|
|
54
|
+
result.isCharging = (statusValue >= 6 && statusValue <= 9) || statusValue === 11 || ((statusValue !== 3) && (statusValue !== 1) && result.percent < 100);
|
|
55
55
|
result.acConnected = result.isCharging || statusValue === 2;
|
|
56
56
|
result.model = util.getValue(lines, 'DeviceID', ':');
|
|
57
57
|
} else {
|
|
@@ -232,7 +232,6 @@ module.exports = function (callback) {
|
|
|
232
232
|
workload
|
|
233
233
|
).then(data => {
|
|
234
234
|
if (data) {
|
|
235
|
-
// let parts = data.results[0].split(/\n\s*\n/);
|
|
236
235
|
let parts = data.results[0].split(/\n\s*\n/);
|
|
237
236
|
let batteries = [];
|
|
238
237
|
const hasValue = value => /\S/.test(value);
|
package/lib/cpu.js
CHANGED
|
@@ -617,14 +617,6 @@ function getCpu() {
|
|
|
617
617
|
cpuFlags().then(flags => {
|
|
618
618
|
result.flags = flags;
|
|
619
619
|
result.virtualization = flags.indexOf('vmx') > -1 || flags.indexOf('svm') > -1;
|
|
620
|
-
// if (_windows) {
|
|
621
|
-
// try {
|
|
622
|
-
// const systeminfo = execSync('systeminfo', util.execOptsWin).toString();
|
|
623
|
-
// result.virtualization = result.virtualization || (systeminfo.indexOf('Virtualization Enabled In Firmware: Yes') !== -1) || (systeminfo.indexOf('Virtualisierung in Firmware aktiviert: Ja') !== -1) || (systeminfo.indexOf('Virtualisation activée dans le microprogramme : Qiu') !== -1);
|
|
624
|
-
// } catch (e) {
|
|
625
|
-
// util.noop();
|
|
626
|
-
// }
|
|
627
|
-
// }
|
|
628
620
|
if (_darwin) {
|
|
629
621
|
exec('sysctl machdep.cpu hw.cpufrequency_max hw.cpufrequency_min hw.packages hw.physicalcpu_max hw.ncpu hw.tbfrequency hw.cpufamily hw.cpusubfamily', function (error, stdout) {
|
|
630
622
|
let lines = stdout.toString().split('\n');
|
|
@@ -695,12 +687,9 @@ function getCpu() {
|
|
|
695
687
|
|
|
696
688
|
result = cpuBrandManufacturer(result);
|
|
697
689
|
result.vendor = cpuManufacturer(util.getValue(lines, 'vendor id'));
|
|
698
|
-
// if (!result.vendor) { result.vendor = util.getValue(lines, 'anbieterkennung'); }
|
|
699
690
|
|
|
700
691
|
result.family = util.getValue(lines, 'cpu family');
|
|
701
|
-
// if (!result.family) { result.family = util.getValue(lines, 'prozessorfamilie'); }
|
|
702
692
|
result.model = util.getValue(lines, 'model:');
|
|
703
|
-
// if (!result.model) { result.model = util.getValue(lines, 'modell:'); }
|
|
704
693
|
result.stepping = util.getValue(lines, 'stepping');
|
|
705
694
|
result.revision = util.getValue(lines, 'cpu revision');
|
|
706
695
|
result.cache.l1d = util.getValue(lines, 'l1d cache');
|
|
@@ -713,11 +702,9 @@ function getCpu() {
|
|
|
713
702
|
if (result.cache.l3) { result.cache.l3 = parseInt(result.cache.l3) * (result.cache.l3.indexOf('M') !== -1 ? 1024 * 1024 : (result.cache.l3.indexOf('K') !== -1 ? 1024 : 1)); }
|
|
714
703
|
|
|
715
704
|
const threadsPerCore = util.getValue(lines, 'thread(s) per core') || '1';
|
|
716
|
-
// const coresPerSocketInt = parseInt(util.getValue(lines, 'cores(s) per socket') || '1', 10);
|
|
717
705
|
const processors = util.getValue(lines, 'socket(s)') || '1';
|
|
718
706
|
let threadsPerCoreInt = parseInt(threadsPerCore, 10); // threads per code (normally only for performance cores)
|
|
719
707
|
let processorsInt = parseInt(processors, 10) || 1; // number of sockets / processor units in machine (normally 1)
|
|
720
|
-
// const cpus = (parseInt(util.getValue(lines, 'cpu(s)'), 10) || 1); // overall number of cores (e.g. 24 on i12900)
|
|
721
708
|
const coresPerSocket = parseInt(util.getValue(lines, 'core(s) per socket'), 10); // number of cores (e.g. 16 on i12900)
|
|
722
709
|
result.physicalCores = coresPerSocket ? coresPerSocket * processorsInt : result.cores / threadsPerCoreInt;
|
|
723
710
|
result.performanceCores = threadsPerCoreInt > 1 ? result.cores - result.physicalCores : result.cores;
|
|
@@ -779,7 +766,7 @@ function getCpu() {
|
|
|
779
766
|
result.vendor = cpuManufacturer(util.getValue(lines, 'manufacturer'));
|
|
780
767
|
let sig = util.getValue(lines, 'signature');
|
|
781
768
|
sig = sig.split(',');
|
|
782
|
-
for (
|
|
769
|
+
for (let i = 0; i < sig.length; i++) {
|
|
783
770
|
sig[i] = sig[i].trim();
|
|
784
771
|
}
|
|
785
772
|
result.family = util.getValue(sig, 'Family', ' ', true);
|
|
@@ -825,7 +812,6 @@ function getCpu() {
|
|
|
825
812
|
const workload = [];
|
|
826
813
|
workload.push(util.powerShell('Get-WmiObject Win32_processor | select Name, Revision, L2CacheSize, L3CacheSize, Manufacturer, MaxClockSpeed, Description, UpgradeMethod, Caption, NumberOfLogicalProcessors, NumberOfCores | fl'));
|
|
827
814
|
workload.push(util.powerShell('Get-WmiObject Win32_CacheMemory | select CacheType,InstalledSize,Level | fl'));
|
|
828
|
-
// workload.push(util.powerShell('Get-ComputerInfo -property "HyperV*"'));
|
|
829
815
|
workload.push(util.powerShell('(Get-CimInstance Win32_ComputerSystem).HypervisorPresent'));
|
|
830
816
|
|
|
831
817
|
Promise.all(
|
|
@@ -915,9 +901,6 @@ function getCpu() {
|
|
|
915
901
|
result.cache.l1d = parseInt(installedSize, 10) / 2;
|
|
916
902
|
}
|
|
917
903
|
});
|
|
918
|
-
// lines = data[2].split('\r\n');
|
|
919
|
-
// result.virtualization = (util.getValue(lines, 'HyperVRequirementVirtualizationFirmwareEnabled').toLowerCase() === 'true');
|
|
920
|
-
// result.virtualization = (util.getValue(lines, 'HyperVisorPresent').toLowerCase() === 'true');
|
|
921
904
|
const hyperv = data[2] ? data[2].toString().toLowerCase() : '';
|
|
922
905
|
result.virtualization = hyperv.indexOf('true') !== -1;
|
|
923
906
|
|
|
@@ -1067,9 +1050,7 @@ function cpuTemperature(callback) {
|
|
|
1067
1050
|
});
|
|
1068
1051
|
|
|
1069
1052
|
if (result.cores.length > 0) {
|
|
1070
|
-
// if (result.main === null) {
|
|
1071
1053
|
result.main = Math.round(result.cores.reduce((a, b) => a + b, 0) / result.cores.length);
|
|
1072
|
-
// }
|
|
1073
1054
|
let maxtmp = Math.max.apply(Math, result.cores);
|
|
1074
1055
|
result.max = (maxtmp > result.main) ? maxtmp : result.main;
|
|
1075
1056
|
}
|
|
@@ -1123,9 +1104,7 @@ function cpuTemperature(callback) {
|
|
|
1123
1104
|
}
|
|
1124
1105
|
});
|
|
1125
1106
|
if (result.cores.length > 0) {
|
|
1126
|
-
// if (result.main === null) {
|
|
1127
1107
|
result.main = Math.round(result.cores.reduce((a, b) => a + b, 0) / result.cores.length);
|
|
1128
|
-
// }
|
|
1129
1108
|
let maxtmp = Math.max.apply(Math, result.cores);
|
|
1130
1109
|
result.max = (maxtmp > result.main) ? maxtmp : result.main;
|
|
1131
1110
|
} else {
|
|
@@ -1702,8 +1681,6 @@ function getFullLoad() {
|
|
|
1702
1681
|
let totalTicks = totalIdle + totalIrq + totalNice + totalSystem + totalUser;
|
|
1703
1682
|
result = (totalTicks - totalIdle) / totalTicks * 100.0;
|
|
1704
1683
|
|
|
1705
|
-
} else {
|
|
1706
|
-
result = 0;
|
|
1707
1684
|
}
|
|
1708
1685
|
resolve(result);
|
|
1709
1686
|
});
|
package/lib/network.js
CHANGED
|
@@ -108,7 +108,6 @@ function getDefaultNetworkInterface() {
|
|
|
108
108
|
if (_linux) { cmd = 'ip route 2> /dev/null | grep default | awk \'{print $5}\''; }
|
|
109
109
|
if (_darwin) { cmd = 'route -n get default 2>/dev/null | grep interface: | awk \'{print $2}\''; }
|
|
110
110
|
if (_freebsd || _openbsd || _netbsd || _sunos) { cmd = 'route get 0.0.0.0 | grep interface:'; }
|
|
111
|
-
// console.log('SYNC - default darwin 3');
|
|
112
111
|
let result = execSync(cmd);
|
|
113
112
|
ifacename = result.toString().split('\n')[0];
|
|
114
113
|
if (ifacename.indexOf(':') > -1) {
|
|
@@ -173,7 +172,6 @@ function getMacAddresses() {
|
|
|
173
172
|
if (_darwin) {
|
|
174
173
|
try {
|
|
175
174
|
const cmd = '/sbin/ifconfig';
|
|
176
|
-
// console.log('SYNC - macAde darwin 6');
|
|
177
175
|
let res = execSync(cmd);
|
|
178
176
|
const lines = res.toString().split('\n');
|
|
179
177
|
for (let i = 0; i < lines.length; i++) {
|
|
@@ -247,8 +245,6 @@ function parseLinesWindowsNics(sections, nconfigsections) {
|
|
|
247
245
|
}
|
|
248
246
|
|
|
249
247
|
function getWindowsNics() {
|
|
250
|
-
// const cmd = util.getWmic() + ' nic get /value';
|
|
251
|
-
// const cmdnicconfig = util.getWmic() + ' nicconfig get dhcpEnabled /value';
|
|
252
248
|
return new Promise((resolve) => {
|
|
253
249
|
process.nextTick(() => {
|
|
254
250
|
let cmd = 'Get-WmiObject Win32_NetworkAdapter | fl *' + '; echo \'#-#-#-#\';';
|
|
@@ -394,7 +390,6 @@ function getWindowsIEEE8021x(connectionType, iface, ifaces) {
|
|
|
394
390
|
i8021x.state = 'Enabled';
|
|
395
391
|
}
|
|
396
392
|
} catch (error) {
|
|
397
|
-
// console.log('Error getting wired information:', error);
|
|
398
393
|
return i8021x;
|
|
399
394
|
}
|
|
400
395
|
} else if (connectionType == 'wireless') {
|
|
@@ -416,7 +411,6 @@ function getWindowsIEEE8021x(connectionType, iface, ifaces) {
|
|
|
416
411
|
i8021x.protocol = i8021xProtocol.split(':').pop();
|
|
417
412
|
}
|
|
418
413
|
} catch (error) {
|
|
419
|
-
// console.log('Error getting wireless information:', error);
|
|
420
414
|
if (error.status === 1 && error.stdout.includes('AutoConfig')) {
|
|
421
415
|
i8021x.state = 'Disabled';
|
|
422
416
|
i8021x.protocol = 'Not defined';
|
|
@@ -1409,7 +1403,6 @@ function networkConnections(callback) {
|
|
|
1409
1403
|
peerip = peeraddress.join(':');
|
|
1410
1404
|
}
|
|
1411
1405
|
let connstate = line[5];
|
|
1412
|
-
// if (connstate === 'VERBUNDEN') connstate = 'ESTABLISHED';
|
|
1413
1406
|
let proc = line[6].split('/');
|
|
1414
1407
|
|
|
1415
1408
|
if (connstate) {
|
package/lib/osinfo.js
CHANGED
|
@@ -18,7 +18,6 @@ const fs = require('fs');
|
|
|
18
18
|
const util = require('./util');
|
|
19
19
|
const exec = require('child_process').exec;
|
|
20
20
|
const execSync = require('child_process').execSync;
|
|
21
|
-
// const execPromise = util.promisify(require('child_process').exec);
|
|
22
21
|
|
|
23
22
|
let _platform = process.platform;
|
|
24
23
|
|
|
@@ -222,7 +221,6 @@ function osInfo(callback) {
|
|
|
222
221
|
if (_linux) {
|
|
223
222
|
|
|
224
223
|
exec('cat /etc/*-release; cat /usr/lib/os-release; cat /etc/openwrt_release', function (error, stdout) {
|
|
225
|
-
//if (!error) {
|
|
226
224
|
/**
|
|
227
225
|
* @namespace
|
|
228
226
|
* @property {string} DISTRIB_ID
|
|
@@ -260,7 +258,6 @@ function osInfo(callback) {
|
|
|
260
258
|
resolve(result);
|
|
261
259
|
});
|
|
262
260
|
});
|
|
263
|
-
//}
|
|
264
261
|
});
|
|
265
262
|
}
|
|
266
263
|
if (_freebsd || _openbsd || _netbsd) {
|
|
@@ -332,8 +329,6 @@ function osInfo(callback) {
|
|
|
332
329
|
try {
|
|
333
330
|
const workload = [];
|
|
334
331
|
workload.push(util.powerShell('Get-WmiObject Win32_OperatingSystem | select Caption,SerialNumber,BuildNumber,ServicePackMajorVersion,ServicePackMinorVersion | fl'));
|
|
335
|
-
// workload.push(execPromise('systeminfo', util.execOptsWin));
|
|
336
|
-
// workload.push(util.powerShell('Get-ComputerInfo -property "HyperV*"'));
|
|
337
332
|
workload.push(util.powerShell('(Get-CimInstance Win32_ComputerSystem).HypervisorPresent'));
|
|
338
333
|
workload.push(util.powerShell('Add-Type -AssemblyName System.Windows.Forms; [System.Windows.Forms.SystemInformation]::TerminalServerSession'));
|
|
339
334
|
util.promiseAll(
|
|
@@ -345,10 +340,6 @@ function osInfo(callback) {
|
|
|
345
340
|
result.build = util.getValue(lines, 'BuildNumber', ':').trim();
|
|
346
341
|
result.servicepack = util.getValue(lines, 'ServicePackMajorVersion', ':').trim() + '.' + util.getValue(lines, 'ServicePackMinorVersion', ':').trim();
|
|
347
342
|
result.codepage = util.getCodepage();
|
|
348
|
-
// const systeminfo = data.results[1] ? data.results[1].toString() : '';
|
|
349
|
-
// result.hypervisor = (systeminfo.indexOf('hypervisor has been detected') !== -1) || (systeminfo.indexOf('ein Hypervisor erkannt') !== -1) || (systeminfo.indexOf('Un hyperviseur a ') !== -1);
|
|
350
|
-
// const hyperv = data.results[1] ? data.results[1].toString().split('\r\n') : [];
|
|
351
|
-
// result.hypervisor = (util.getValue(hyperv, 'HyperVisorPresent').toLowerCase() === 'true');
|
|
352
343
|
const hyperv = data.results[1] ? data.results[1].toString().toLowerCase() : '';
|
|
353
344
|
result.hypervisor = hyperv.indexOf('true') !== -1;
|
|
354
345
|
const term = data.results[2] ? data.results[2].toString() : '';
|
|
@@ -741,7 +732,6 @@ function versions(apps, callback) {
|
|
|
741
732
|
}
|
|
742
733
|
functionProcessed();
|
|
743
734
|
});
|
|
744
|
-
functionProcessed();
|
|
745
735
|
}
|
|
746
736
|
});
|
|
747
737
|
} else {
|
|
@@ -1004,17 +994,21 @@ function versions(apps, callback) {
|
|
|
1004
994
|
}
|
|
1005
995
|
}
|
|
1006
996
|
if ({}.hasOwnProperty.call(appsObj.versions, 'dotnet')) {
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
997
|
+
if (_windows) {
|
|
998
|
+
util.powerShell('gci "HKLM:\\SOFTWARE\\Microsoft\\NET Framework Setup\\NDP" -recurse | gp -name Version,Release -EA 0 | where { $_.PSChildName -match "^(?!S)\\p{L}"} | select PSChildName, Version, Release').then(stdout => {
|
|
999
|
+
const lines = stdout.toString().split('\r\n');
|
|
1000
|
+
let dotnet = '';
|
|
1001
|
+
lines.forEach(line => {
|
|
1002
|
+
line = line.replace(/ +/g, ' ');
|
|
1003
|
+
const parts = line.split(' ');
|
|
1004
|
+
dotnet = dotnet || (parts[0].toLowerCase().startsWith('client') && parts.length > 2 ? parts[1].trim() : (parts[0].toLowerCase().startsWith('full') && parts.length > 2 ? parts[1].trim() : ''));
|
|
1005
|
+
});
|
|
1006
|
+
appsObj.versions.dotnet = dotnet.trim();
|
|
1007
|
+
functionProcessed();
|
|
1014
1008
|
});
|
|
1015
|
-
|
|
1009
|
+
} else {
|
|
1016
1010
|
functionProcessed();
|
|
1017
|
-
}
|
|
1011
|
+
}
|
|
1018
1012
|
}
|
|
1019
1013
|
} catch (e) {
|
|
1020
1014
|
if (callback) { callback(appsObj.versions); }
|
|
@@ -1090,7 +1084,6 @@ function uuid(callback) {
|
|
|
1090
1084
|
const jsonObj = JSON.parse(stdout.toString());
|
|
1091
1085
|
if (jsonObj.SPHardwareDataType && jsonObj.SPHardwareDataType.length > 0) {
|
|
1092
1086
|
const spHardware = jsonObj.SPHardwareDataType[0];
|
|
1093
|
-
// result.os = parts.length > 1 ? parts[1].trim().toLowerCase() : '';
|
|
1094
1087
|
result.os = spHardware.platform_UUID.toLowerCase();
|
|
1095
1088
|
result.hardware = spHardware.serial_number;
|
|
1096
1089
|
}
|
|
@@ -1142,7 +1135,6 @@ echo -n "hardware: "; cat /sys/class/dmi/id/product_uuid 2> /dev/null; echo;`;
|
|
|
1142
1135
|
sysdir = '%windir%\\sysnative\\cmd.exe /c %windir%\\System32';
|
|
1143
1136
|
}
|
|
1144
1137
|
util.powerShell('Get-WmiObject Win32_ComputerSystemProduct | select UUID | fl').then((stdout) => {
|
|
1145
|
-
// let lines = stdout.split('\r\n').filter(line => line.trim() !== '').filter((line, idx) => idx > 0)[0].trim().split(/\s\s+/);
|
|
1146
1138
|
let lines = stdout.split('\r\n');
|
|
1147
1139
|
result.hardware = util.getValue(lines, 'uuid', ':').toLowerCase();
|
|
1148
1140
|
exec(`${sysdir}\\reg query "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Cryptography" /v MachineGuid`, util.execOptsWin, function (error, stdout) {
|
package/lib/printer.js
CHANGED
|
@@ -14,9 +14,7 @@
|
|
|
14
14
|
// ----------------------------------------------------------------------------------
|
|
15
15
|
|
|
16
16
|
const exec = require('child_process').exec;
|
|
17
|
-
// const execSync = require('child_process').execSync;
|
|
18
17
|
const util = require('./util');
|
|
19
|
-
// const fs = require('fs');
|
|
20
18
|
|
|
21
19
|
let _platform = process.platform;
|
|
22
20
|
|
package/lib/processes.js
CHANGED
|
@@ -135,7 +135,7 @@ function services(srv, callback) {
|
|
|
135
135
|
|
|
136
136
|
const s = util.sanitizeShellString(srv);
|
|
137
137
|
for (let i = 0; i <= util.mathMin(s.length, 2000); i++) {
|
|
138
|
-
if (
|
|
138
|
+
if (s[i] !== undefined) {
|
|
139
139
|
srvString = srvString + s[i];
|
|
140
140
|
}
|
|
141
141
|
}
|
|
@@ -150,7 +150,6 @@ function services(srv, callback) {
|
|
|
150
150
|
let srvs = srvString.split('|');
|
|
151
151
|
let result = [];
|
|
152
152
|
let dataSrv = [];
|
|
153
|
-
// let allSrv = [];
|
|
154
153
|
|
|
155
154
|
if (_linux || _freebsd || _openbsd || _netbsd || _darwin) {
|
|
156
155
|
if ((_linux || _freebsd || _openbsd || _netbsd) && srvString === '*') {
|
|
@@ -172,7 +171,6 @@ function services(srv, callback) {
|
|
|
172
171
|
const parts = s.split(']');
|
|
173
172
|
if (parts.length === 2) {
|
|
174
173
|
srvString += (srvString !== '' ? '|' : '') + parts[1].trim();
|
|
175
|
-
// allSrv.push({ name: parts[1].trim(), running: parts[0].indexOf('+') > 0 });
|
|
176
174
|
}
|
|
177
175
|
}
|
|
178
176
|
srvs = srvString.split('|');
|
|
@@ -186,13 +184,11 @@ function services(srv, callback) {
|
|
|
186
184
|
const name = s.trim();
|
|
187
185
|
if (name) {
|
|
188
186
|
srvString += (srvString !== '' ? '|' : '') + name;
|
|
189
|
-
// allSrv.push({ name: name, running: null });
|
|
190
187
|
}
|
|
191
188
|
}
|
|
192
189
|
srvs = srvString.split('|');
|
|
193
190
|
}
|
|
194
191
|
} catch (f) {
|
|
195
|
-
// allSrv = [];
|
|
196
192
|
srvString = '';
|
|
197
193
|
srvs = [];
|
|
198
194
|
}
|
|
@@ -220,7 +216,6 @@ function services(srv, callback) {
|
|
|
220
216
|
return (e.toLowerCase().indexOf(' ' + srv + ':') !== -1) || (e.toLowerCase().indexOf('/' + srv) !== -1);
|
|
221
217
|
});
|
|
222
218
|
}
|
|
223
|
-
// let singleSrv = allSrv.filter(item => { return item.name === srv; });
|
|
224
219
|
const pids = [];
|
|
225
220
|
for (const p of ps) {
|
|
226
221
|
const pid = p.trim().split(' ')[2];
|
|
@@ -230,7 +225,6 @@ function services(srv, callback) {
|
|
|
230
225
|
}
|
|
231
226
|
result.push({
|
|
232
227
|
name: srv,
|
|
233
|
-
// running: (allSrv.length && singleSrv.length && singleSrv[0].running !== null ? singleSrv[0].running : ps.length > 0),
|
|
234
228
|
running: ps.length > 0,
|
|
235
229
|
startmode: '',
|
|
236
230
|
pids: pids,
|
|
@@ -289,10 +283,8 @@ function services(srv, callback) {
|
|
|
289
283
|
|
|
290
284
|
// store old values
|
|
291
285
|
_services_cpu.all = all;
|
|
292
|
-
// _services_cpu.list = list_new;
|
|
293
286
|
_services_cpu.list = Object.assign({}, list_new);
|
|
294
287
|
_services_cpu.ms = Date.now() - _services_cpu.ms;
|
|
295
|
-
// _services_cpu.result = result;
|
|
296
288
|
_services_cpu.result = Object.assign({}, result);
|
|
297
289
|
if (callback) { callback(result); }
|
|
298
290
|
resolve(result);
|
|
@@ -787,10 +779,8 @@ function processes(callback) {
|
|
|
787
779
|
|
|
788
780
|
// store old values
|
|
789
781
|
_processes_cpu.all = all;
|
|
790
|
-
// _processes_cpu.list = list_new;
|
|
791
782
|
_processes_cpu.list = Object.assign({}, list_new);
|
|
792
783
|
_processes_cpu.ms = Date.now() - _processes_cpu.ms;
|
|
793
|
-
// _processes_cpu.result = result;
|
|
794
784
|
_processes_cpu.result = Object.assign({}, result);
|
|
795
785
|
if (callback) { callback(result); }
|
|
796
786
|
resolve(result);
|
|
@@ -839,8 +829,6 @@ function processes(callback) {
|
|
|
839
829
|
let list_new = {};
|
|
840
830
|
let allcpuu = 0;
|
|
841
831
|
let allcpus = 0;
|
|
842
|
-
// let allcpuu = _processes_cpu.all_utime;
|
|
843
|
-
// let allcpus = _processes_cpu.all_stime;
|
|
844
832
|
for (let i = 0; i < processSections.length; i++) {
|
|
845
833
|
if (processSections[i].trim() !== '') {
|
|
846
834
|
let lines = processSections[i].trim().split('\r\n');
|
|
@@ -849,14 +837,24 @@ function processes(callback) {
|
|
|
849
837
|
let statusValue = util.getValue(lines, 'ExecutionState', ':');
|
|
850
838
|
let name = util.getValue(lines, 'Caption', ':', true);
|
|
851
839
|
let commandLine = util.getValue(lines, 'CommandLine', ':', true);
|
|
840
|
+
// get additional command line data
|
|
841
|
+
let additionalCommand = false;
|
|
842
|
+
lines.forEach((line) => {
|
|
843
|
+
if (additionalCommand && line.toLowerCase().startsWith(' ')) {
|
|
844
|
+
commandLine = commandLine + line.trim();
|
|
845
|
+
} else {
|
|
846
|
+
additionalCommand = false;
|
|
847
|
+
}
|
|
848
|
+
if (line.toLowerCase().startsWith('commandline')) {
|
|
849
|
+
additionalCommand = true;
|
|
850
|
+
}
|
|
851
|
+
});
|
|
852
852
|
let commandPath = util.getValue(lines, 'ExecutablePath', ':', true);
|
|
853
853
|
let utime = parseInt(util.getValue(lines, 'UserModeTime', ':', true), 10);
|
|
854
854
|
let stime = parseInt(util.getValue(lines, 'KernelModeTime', ':', true), 10);
|
|
855
855
|
let memw = parseInt(util.getValue(lines, 'WorkingSetSize', ':', true), 10);
|
|
856
856
|
allcpuu = allcpuu + utime;
|
|
857
857
|
allcpus = allcpus + stime;
|
|
858
|
-
// allcpuu += utime - (_processes_cpu.list[pid] ? _processes_cpu.list[pid].utime : 0);
|
|
859
|
-
// allcpus += stime - (_processes_cpu.list[pid] ? _processes_cpu.list[pid].stime : 0);
|
|
860
858
|
result.all++;
|
|
861
859
|
if (!statusValue) { result.unknown++; }
|
|
862
860
|
if (statusValue === '3') { result.running++; }
|
|
@@ -917,10 +915,8 @@ function processes(callback) {
|
|
|
917
915
|
_processes_cpu.all = allcpuu + allcpus;
|
|
918
916
|
_processes_cpu.all_utime = allcpuu;
|
|
919
917
|
_processes_cpu.all_stime = allcpus;
|
|
920
|
-
// _processes_cpu.list = list_new;
|
|
921
918
|
_processes_cpu.list = Object.assign({}, list_new);
|
|
922
919
|
_processes_cpu.ms = Date.now() - _processes_cpu.ms;
|
|
923
|
-
// _processes_cpu.result = result;
|
|
924
920
|
_processes_cpu.result = Object.assign({}, result);
|
|
925
921
|
}
|
|
926
922
|
if (callback) {
|
|
@@ -1010,8 +1006,6 @@ function processLoad(proc, callback) {
|
|
|
1010
1006
|
let list_new = {};
|
|
1011
1007
|
let allcpuu = 0;
|
|
1012
1008
|
let allcpus = 0;
|
|
1013
|
-
// let allcpuu = _process_cpu.all_utime;
|
|
1014
|
-
// let allcpus = _process_cpu.all_stime;
|
|
1015
1009
|
|
|
1016
1010
|
// go through all processes
|
|
1017
1011
|
for (let i = 0; i < processSections.length; i++) {
|
|
@@ -1024,8 +1018,6 @@ function processLoad(proc, callback) {
|
|
|
1024
1018
|
let mem = parseInt(util.getValue(lines, 'WorkingSetSize', ':', true), 10);
|
|
1025
1019
|
allcpuu = allcpuu + utime;
|
|
1026
1020
|
allcpus = allcpus + stime;
|
|
1027
|
-
// allcpuu += utime - (_process_cpu.list[pid] ? _process_cpu.list[pid].utime : 0);
|
|
1028
|
-
// allcpus += stime - (_process_cpu.list[pid] ? _process_cpu.list[pid].stime : 0);
|
|
1029
1021
|
|
|
1030
1022
|
procStats.push({
|
|
1031
1023
|
pid: pid,
|
|
@@ -1040,9 +1032,6 @@ function processLoad(proc, callback) {
|
|
|
1040
1032
|
let pname = '';
|
|
1041
1033
|
let inList = false;
|
|
1042
1034
|
processes.forEach(function (proc) {
|
|
1043
|
-
// console.log(proc)
|
|
1044
|
-
// console.log(item)
|
|
1045
|
-
// inList = inList || item.name.toLowerCase() === proc.toLowerCase();
|
|
1046
1035
|
if (name.toLowerCase().indexOf(proc.toLowerCase()) >= 0 && !inList) {
|
|
1047
1036
|
inList = true;
|
|
1048
1037
|
pname = proc;
|
|
@@ -1073,7 +1062,6 @@ function processLoad(proc, callback) {
|
|
|
1073
1062
|
// add missing processes
|
|
1074
1063
|
if (processesString !== '*') {
|
|
1075
1064
|
let processesMissing = processes.filter(function (name) {
|
|
1076
|
-
// return procStats.filter(function(item) { return item.name.toLowerCase() === name }).length === 0;
|
|
1077
1065
|
return procStats.filter(function (item) { return item.name.toLowerCase().indexOf(name) >= 0; }).length === 0;
|
|
1078
1066
|
|
|
1079
1067
|
});
|
|
@@ -1112,7 +1100,6 @@ function processLoad(proc, callback) {
|
|
|
1112
1100
|
_process_cpu.all = allcpuu + allcpus;
|
|
1113
1101
|
_process_cpu.all_utime = allcpuu;
|
|
1114
1102
|
_process_cpu.all_stime = allcpus;
|
|
1115
|
-
// _process_cpu.list = list_new;
|
|
1116
1103
|
_process_cpu.list = Object.assign({}, list_new);
|
|
1117
1104
|
_process_cpu.ms = Date.now() - _process_cpu.ms;
|
|
1118
1105
|
_process_cpu.result = JSON.parse(JSON.stringify(result));
|
|
@@ -1160,24 +1147,17 @@ function processLoad(proc, callback) {
|
|
|
1160
1147
|
let inList = false;
|
|
1161
1148
|
let name = '';
|
|
1162
1149
|
for (let j = 0; j < result.length; j++) {
|
|
1163
|
-
// if (result[j].proc.toLowerCase() === item.name.toLowerCase()) {
|
|
1164
|
-
// if (result[j].proc.toLowerCase().indexOf(item.name.toLowerCase()) >= 0) {
|
|
1165
1150
|
if (item.name.toLowerCase().indexOf(result[j].proc.toLowerCase()) >= 0) {
|
|
1166
1151
|
listPos = j;
|
|
1167
1152
|
}
|
|
1168
1153
|
}
|
|
1169
|
-
// console.log(listPos);
|
|
1170
1154
|
processes.forEach(function (proc) {
|
|
1171
|
-
|
|
1172
|
-
// console.log(item)
|
|
1173
|
-
// inList = inList || item.name.toLowerCase() === proc.toLowerCase();
|
|
1155
|
+
|
|
1174
1156
|
if (item.name.toLowerCase().indexOf(proc.toLowerCase()) >= 0 && !inList) {
|
|
1175
1157
|
inList = true;
|
|
1176
1158
|
name = proc;
|
|
1177
1159
|
}
|
|
1178
1160
|
});
|
|
1179
|
-
// console.log(item);
|
|
1180
|
-
// console.log(listPos);
|
|
1181
1161
|
if ((processesString === '*') || inList) {
|
|
1182
1162
|
if (listPos < 0) {
|
|
1183
1163
|
result.push({
|
|
@@ -1265,10 +1245,8 @@ function processLoad(proc, callback) {
|
|
|
1265
1245
|
});
|
|
1266
1246
|
|
|
1267
1247
|
_process_cpu.all = all;
|
|
1268
|
-
// _process_cpu.list = list_new;
|
|
1269
1248
|
_process_cpu.list = Object.assign({}, list_new);
|
|
1270
1249
|
_process_cpu.ms = Date.now() - _process_cpu.ms;
|
|
1271
|
-
// _process_cpu.result = result;
|
|
1272
1250
|
_process_cpu.result = Object.assign({}, result);
|
|
1273
1251
|
if (callback) { callback(result); }
|
|
1274
1252
|
resolve(result);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "systeminformation",
|
|
3
|
-
"version": "5.12.
|
|
3
|
+
"version": "5.12.8",
|
|
4
4
|
"description": "Advanced, lightweight system and OS information library",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Sebastian Hildebrandt <hildebrandt@plus-innovations.com> (https://plus-innovations.com)",
|