systeminformation 5.33.20 → 5.33.22
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 +7 -7
- package/lib/filesystem.js +7 -5
- package/lib/osinfo.js +26 -23
- package/lib/processes.js +18 -3
- package/lib/util.js +3 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -31,17 +31,17 @@
|
|
|
31
31
|
## The Systeminformation Project
|
|
32
32
|
|
|
33
33
|
This is amazing. Started as a small project just for myself, it now has > 20,000
|
|
34
|
-
lines of code, >
|
|
34
|
+
lines of code, > 800 versions published, up to 90 mio downloads per month, > 900
|
|
35
35
|
mio downloads overall. Top 5 NPM ranking for backend packages. Thank you to all
|
|
36
36
|
who contributed to this project!
|
|
37
37
|
|
|
38
38
|
> ### **Version 6** beta just released ⭐️⭐️⭐️
|
|
39
39
|
>
|
|
40
|
-
> 🏆🏆🏆 We're proud to have just released the first beta of the new version 6 of systeminformation.
|
|
40
|
+
> 🏆🏆🏆 We're proud to have just released the first beta of the new version 6 of systeminformation.
|
|
41
41
|
> Version 6 of this package (written completely in TypeScript) is
|
|
42
42
|
> comming with a lot of new features and improvements. We also cleaned up the API so
|
|
43
43
|
> there will also be some breaking changes.
|
|
44
|
-
>
|
|
44
|
+
>
|
|
45
45
|
> **Thanks to everyone testing this new version!**
|
|
46
46
|
|
|
47
47
|
## Please support this project ... ☕️
|
|
@@ -72,7 +72,7 @@ If you want to test the new version 6.0 (currently in beta), you can eather inst
|
|
|
72
72
|
npm i systeminformation@beta
|
|
73
73
|
```
|
|
74
74
|
|
|
75
|
-
Then just test it with your existing code - be sure to check all breaking changes. Docs can be found here:
|
|
75
|
+
Then just test it with your existing code - be sure to check all breaking changes. Docs can be found here:
|
|
76
76
|
|
|
77
77
|
- [V6 Docs][v6-docs-url]
|
|
78
78
|
- [V6 major changes][v6-changes-url]
|
|
@@ -80,12 +80,12 @@ Then just test it with your existing code - be sure to check all breaking change
|
|
|
80
80
|
If you want to run the whole test locally on your machines (without writing any code):
|
|
81
81
|
|
|
82
82
|
```bash
|
|
83
|
-
# clone v6 branch
|
|
83
|
+
# clone v6 branch
|
|
84
84
|
git clone -b v6 https://github.com/sebhildebrandt/systeminformation.git
|
|
85
85
|
cd systeminformation
|
|
86
86
|
|
|
87
87
|
# install dev dependencies and build
|
|
88
|
-
npm ci
|
|
88
|
+
npm ci
|
|
89
89
|
npm run build
|
|
90
90
|
|
|
91
91
|
# run tests
|
|
@@ -1248,4 +1248,4 @@ All other trademarks are the property of their respective owners.
|
|
|
1248
1248
|
[mmon-github-url]: https://github.com/sebhildebrandt/mmon
|
|
1249
1249
|
[smc-code-url]: https://github.com/pcafstockf/smc-reader
|
|
1250
1250
|
[v6-docs-url]: https://systeminformation.io/v6/
|
|
1251
|
-
[v6-changes-url]: https://systeminformation.io/v6/changes.html
|
|
1251
|
+
[v6-changes-url]: https://systeminformation.io/v6/changes.html
|
package/lib/filesystem.js
CHANGED
|
@@ -919,7 +919,7 @@ function fsStats(callback) {
|
|
|
919
919
|
if ((_fs_speed && !_fs_speed.ms) || (_fs_speed && _fs_speed.ms && Date.now() - _fs_speed.ms >= 500)) {
|
|
920
920
|
if (_linux) {
|
|
921
921
|
// exec("df -k | grep /dev/", function(error, stdout) {
|
|
922
|
-
const procLsblk = exec('lsblk -
|
|
922
|
+
const procLsblk = exec('lsblk -rno KNAME,FSTYPE,MOUNTPOINT 2>/dev/null | grep -E "/| zfs_member( |$)" | grep -vE "^zd[0-9]+"', { maxBuffer: 1024 * 1024 }, (error, stdout) => {
|
|
923
923
|
if (!error) {
|
|
924
924
|
const lines = stdout.toString().split('\n');
|
|
925
925
|
const fs_filter = [];
|
|
@@ -933,15 +933,17 @@ function fsStats(callback) {
|
|
|
933
933
|
}
|
|
934
934
|
});
|
|
935
935
|
|
|
936
|
-
const
|
|
937
|
-
const procCat = exec('cat /proc/diskstats | egrep "' + output + '"', { maxBuffer: 1024 * 1024 }, (error, stdout) => {
|
|
936
|
+
const procCat = exec('cat /proc/diskstats', { maxBuffer: 1024 * 1024 }, (error, stdout) => {
|
|
938
937
|
if (!error) {
|
|
939
938
|
const lines = stdout.toString().split('\n');
|
|
940
939
|
lines.forEach((line) => {
|
|
941
940
|
line = line.trim();
|
|
942
941
|
if (line !== '') {
|
|
943
942
|
line = line.replace(/ +/g, ' ').split(' ');
|
|
944
|
-
|
|
943
|
+
// exact device name match (column 3)
|
|
944
|
+
if (fs_filter.indexOf(line[2]) === -1) {
|
|
945
|
+
return;
|
|
946
|
+
}
|
|
945
947
|
rx += parseInt(line[5], 10) * 512;
|
|
946
948
|
wx += parseInt(line[9], 10) * 512;
|
|
947
949
|
}
|
|
@@ -1128,7 +1130,7 @@ function disksIO(callback) {
|
|
|
1128
1130
|
// var cmd = "for mount in `lsblk | grep / | sed -r 's/│ └─//' | cut -d ' ' -f 1`; do cat /sys/block/$mount/stat | sed -r 's/ +/;/g' | sed -r 's/^;//'; done";
|
|
1129
1131
|
// var cmd = "for mount in `lsblk | grep / | sed 's/[│└─├]//g' | awk '{$1=$1};1' | cut -d ' ' -f 1 | sort -u`; do cat /sys/block/$mount/stat | sed -r 's/ +/;/g' | sed -r 's/^;//'; done";
|
|
1130
1132
|
const cmd =
|
|
1131
|
-
'for mount in `lsblk 2>/dev/null | grep " disk " | sed "s/[│└─├]//g" | awk \'{$1=$1};1\' | cut -d " " -f 1 | sort -u`; do cat /sys/block/$mount/stat | sed -r "s/ +/;/g" | sed -r "s/^;//"; done';
|
|
1133
|
+
'for mount in `lsblk 2>/dev/null | grep " disk " | sed "s/[│└─├]//g" | awk \'{$1=$1};1\' | grep -vE "^(zd|nbd|fd|zram)[0-9]+ " | cut -d " " -f 1 | sort -u`; do cat /sys/block/$mount/stat | sed -r "s/ +/;/g" | sed -r "s/^;//"; done';
|
|
1132
1134
|
|
|
1133
1135
|
exec(cmd, { maxBuffer: 1024 * 1024 }, (error, stdout) => {
|
|
1134
1136
|
if (!error) {
|
package/lib/osinfo.js
CHANGED
|
@@ -18,6 +18,7 @@ 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 execFile = require('child_process').execFile;
|
|
21
22
|
|
|
22
23
|
const _platform = process.platform;
|
|
23
24
|
|
|
@@ -207,11 +208,10 @@ function getFQDN() {
|
|
|
207
208
|
}
|
|
208
209
|
}
|
|
209
210
|
if (_windows) {
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
util.noop();
|
|
211
|
+
// read env directly - cmd.exe would interpret metacharacters in expanded values
|
|
212
|
+
const name = process.env.COMPUTERNAME;
|
|
213
|
+
if (name) {
|
|
214
|
+
fqdn = process.env.USERDNSDOMAIN ? name + '.' + process.env.USERDNSDOMAIN : name;
|
|
215
215
|
}
|
|
216
216
|
}
|
|
217
217
|
return fqdn;
|
|
@@ -430,20 +430,25 @@ function isUefiWindows() {
|
|
|
430
430
|
return new Promise((resolve) => {
|
|
431
431
|
process.nextTick(() => {
|
|
432
432
|
try {
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
if (!error) {
|
|
440
|
-
const line = stdout.toString() || '';
|
|
441
|
-
return resolve(line.toLowerCase().indexOf('efi') >= 0);
|
|
442
|
-
} else {
|
|
443
|
-
return resolve(false);
|
|
444
|
-
}
|
|
445
|
-
});
|
|
433
|
+
const logFile = util.WINDIR + '\\Panther\\setupact.log';
|
|
434
|
+
const fwEfi = () => (process.env.firmware_type || '').toLowerCase().indexOf('efi') >= 0;
|
|
435
|
+
fs.stat(logFile, (error, stats) => {
|
|
436
|
+
// skip huge logs
|
|
437
|
+
if (error || stats.size > 50 * 1024 * 1024) {
|
|
438
|
+
return resolve(fwEfi());
|
|
446
439
|
}
|
|
440
|
+
fs.readFile(logFile, 'latin1', (error, content) => {
|
|
441
|
+
const line = !error
|
|
442
|
+
? content
|
|
443
|
+
.split('\n')
|
|
444
|
+
.filter((l) => l.indexOf('Detected boot environment') >= 0)
|
|
445
|
+
.join('\n')
|
|
446
|
+
: '';
|
|
447
|
+
if (line) {
|
|
448
|
+
return resolve(line.toLowerCase().indexOf('efi') >= 0);
|
|
449
|
+
}
|
|
450
|
+
return resolve(fwEfi());
|
|
451
|
+
});
|
|
447
452
|
});
|
|
448
453
|
} catch {
|
|
449
454
|
return resolve(false);
|
|
@@ -1284,14 +1289,12 @@ echo -n "hardware: "; cat /sys/class/dmi/id/product_uuid 2> /dev/null; echo;`;
|
|
|
1284
1289
|
});
|
|
1285
1290
|
}
|
|
1286
1291
|
if (_windows) {
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
sysdir = '%windir%\\sysnative\\cmd.exe /c %windir%\\System32';
|
|
1290
|
-
}
|
|
1292
|
+
// Sysnative: 64-bit reg.exe from a 32-bit node process
|
|
1293
|
+
const sysdir = process.arch === 'ia32' && Object.prototype.hasOwnProperty.call(process.env, 'PROCESSOR_ARCHITEW6432') ? 'Sysnative' : 'System32';
|
|
1291
1294
|
util.powerShell('Get-CimInstance Win32_ComputerSystemProduct | select UUID | fl').then((stdout) => {
|
|
1292
1295
|
let lines = stdout.split('\r\n');
|
|
1293
1296
|
result.hardware = util.getValue(lines, 'uuid', ':').toLowerCase();
|
|
1294
|
-
|
|
1297
|
+
execFile(util.WINDIR + '\\' + sysdir + '\\reg.exe', ['query', 'HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Cryptography', '/v', 'MachineGuid'], util.execOptsWin, (error, stdout) => {
|
|
1295
1298
|
parts = stdout.toString().split('\n\r')[0].split('REG_SZ');
|
|
1296
1299
|
result.os = parts.length > 1 ? parts[1].replace(/\r+|\n+|\s+/gi, '').toLowerCase() : '';
|
|
1297
1300
|
if (callback) {
|
package/lib/processes.js
CHANGED
|
@@ -109,6 +109,19 @@ function parseElapsedTime(etime) {
|
|
|
109
109
|
// pass a comma separated string with services to check (mysql, apache, postgresql, ...)
|
|
110
110
|
// this function gives an array back, if the services are running.
|
|
111
111
|
|
|
112
|
+
// whitelist via char compare - no String/RegExp prototype methods involved
|
|
113
|
+
function psServiceName(srv) {
|
|
114
|
+
const s = String(srv);
|
|
115
|
+
let name = '';
|
|
116
|
+
for (let i = 0; i < s.length; i++) {
|
|
117
|
+
const c = s[i];
|
|
118
|
+
if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9') || c === ' ' || c === '_' || c === '.' || c === '-' || c === '@') {
|
|
119
|
+
name += c;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
return name;
|
|
123
|
+
}
|
|
124
|
+
|
|
112
125
|
function services(srv, callback) {
|
|
113
126
|
callback = util.isFunction(callback) ? callback : null;
|
|
114
127
|
// fallback - if only callback is given
|
|
@@ -136,6 +149,7 @@ function services(srv, callback) {
|
|
|
136
149
|
srvString.__proto__.substring = util.stringSubstring;
|
|
137
150
|
srvString.__proto__.trim = util.stringTrim;
|
|
138
151
|
srvString.__proto__.startsWith = util.stringStartWith;
|
|
152
|
+
srvString.__proto__.split = util.stringSplit;
|
|
139
153
|
} catch (e) {
|
|
140
154
|
Object.setPrototypeOf(srvString, util.stringObj);
|
|
141
155
|
}
|
|
@@ -155,7 +169,7 @@ function services(srv, callback) {
|
|
|
155
169
|
if (util.isPrototypePolluted() && srvString !== '*') {
|
|
156
170
|
srvString = '------';
|
|
157
171
|
}
|
|
158
|
-
let srvs =
|
|
172
|
+
let srvs = util.stringSplit.call(srvString, '|');
|
|
159
173
|
const result = [];
|
|
160
174
|
const dataSrv = [];
|
|
161
175
|
|
|
@@ -362,7 +376,7 @@ function services(srv, callback) {
|
|
|
362
376
|
wincommand += ' -Filter "';
|
|
363
377
|
srvs.forEach((srv) => {
|
|
364
378
|
// whitelist: srv is inserted into a PowerShell string
|
|
365
|
-
wincommand += `Name='${srv
|
|
379
|
+
wincommand += `Name='${psServiceName(srv)}' or `;
|
|
366
380
|
});
|
|
367
381
|
wincommand = `${wincommand.slice(0, -4)}"`;
|
|
368
382
|
}
|
|
@@ -1137,6 +1151,7 @@ function processLoad(proc, callback) {
|
|
|
1137
1151
|
processesString.__proto__.substring = util.stringSubstring;
|
|
1138
1152
|
processesString.__proto__.trim = util.stringTrim;
|
|
1139
1153
|
processesString.__proto__.startsWith = util.stringStartWith;
|
|
1154
|
+
processesString.__proto__.split = util.stringSplit;
|
|
1140
1155
|
} catch {
|
|
1141
1156
|
Object.setPrototypeOf(processesString, util.stringObj);
|
|
1142
1157
|
}
|
|
@@ -1157,7 +1172,7 @@ function processLoad(proc, callback) {
|
|
|
1157
1172
|
if (util.isPrototypePolluted() && processesString !== '*') {
|
|
1158
1173
|
processesString = '------';
|
|
1159
1174
|
}
|
|
1160
|
-
const processes =
|
|
1175
|
+
const processes = util.stringSplit.call(processesString, '|');
|
|
1161
1176
|
const result = [];
|
|
1162
1177
|
|
|
1163
1178
|
const procSanitized = util.isPrototypePolluted() ? '' : util.sanitizeShellString(proc) || '*';
|
package/lib/util.js
CHANGED
|
@@ -92,6 +92,7 @@ const stringSubstr = new String().substr;
|
|
|
92
92
|
const stringSubstring = new String().substring;
|
|
93
93
|
const stringTrim = new String().trim;
|
|
94
94
|
const stringStartWith = new String().startsWith;
|
|
95
|
+
const stringSplit = new String().split;
|
|
95
96
|
const mathMin = Math.min;
|
|
96
97
|
|
|
97
98
|
function isFunction(functionToCheck) {
|
|
@@ -798,6 +799,7 @@ function isPrototypePolluted() {
|
|
|
798
799
|
st.__proto__.toString = stringToString;
|
|
799
800
|
st.__proto__.substr = stringSubstr;
|
|
800
801
|
st.__proto__.substring = stringSubstring;
|
|
802
|
+
st.__proto__.split = stringSplit;
|
|
801
803
|
st.__proto__.trim = stringTrim;
|
|
802
804
|
st.__proto__.startsWith = stringStartWith;
|
|
803
805
|
} catch (e) {
|
|
@@ -2873,6 +2875,7 @@ exports.stringSubstr = stringSubstr;
|
|
|
2873
2875
|
exports.stringSubstring = stringSubstring;
|
|
2874
2876
|
exports.stringTrim = stringTrim;
|
|
2875
2877
|
exports.stringStartWith = stringStartWith;
|
|
2878
|
+
exports.stringSplit = stringSplit;
|
|
2876
2879
|
exports.mathMin = mathMin;
|
|
2877
2880
|
exports.WINDIR = WINDIR;
|
|
2878
2881
|
exports.getFilesInPath = getFilesInPath;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "systeminformation",
|
|
3
|
-
"version": "5.33.
|
|
3
|
+
"version": "5.33.22",
|
|
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)",
|