systeminformation 5.9.10 → 5.9.14
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/lib/cpu.js +20 -10
- package/lib/filesystem.js +1 -1
- package/lib/network.js +1 -2
- package/lib/osinfo.js +13 -9
- package/lib/users.js +24 -22
- package/lib/util.js +22 -0
- package/package.json +2 -2
package/lib/cpu.js
CHANGED
|
@@ -781,7 +781,7 @@ function getCpu() {
|
|
|
781
781
|
try {
|
|
782
782
|
const workload = [];
|
|
783
783
|
workload.push(util.powerShell('Get-WmiObject Win32_processor | fl *'));
|
|
784
|
-
workload.push(util.powerShell('Get-WmiObject Win32_CacheMemory | select CacheType,InstalledSize,
|
|
784
|
+
workload.push(util.powerShell('Get-WmiObject Win32_CacheMemory | select CacheType,InstalledSize,Level | fl *'));
|
|
785
785
|
// workload.push(util.powerShell('Get-ComputerInfo -property "HyperV*"'));
|
|
786
786
|
workload.push(util.powerShell('(Get-CimInstance Win32_ComputerSystem).HypervisorPresent'));
|
|
787
787
|
|
|
@@ -852,16 +852,21 @@ function getCpu() {
|
|
|
852
852
|
parts.forEach(function (part) {
|
|
853
853
|
lines = part.split('\r\n');
|
|
854
854
|
const cacheType = util.getValue(lines, 'CacheType');
|
|
855
|
-
const
|
|
855
|
+
const level = util.getValue(lines, 'Level');
|
|
856
856
|
const installedSize = util.getValue(lines, 'InstalledSize');
|
|
857
857
|
// L1 Instructions
|
|
858
|
-
if (
|
|
858
|
+
if (level === '3' && cacheType === '3') {
|
|
859
859
|
result.cache.l1i = parseInt(installedSize, 10);
|
|
860
860
|
}
|
|
861
861
|
// L1 Data
|
|
862
|
-
if (
|
|
862
|
+
if (level === '3' && cacheType === '4') {
|
|
863
863
|
result.cache.l1d = parseInt(installedSize, 10);
|
|
864
864
|
}
|
|
865
|
+
// L1 all
|
|
866
|
+
if (level === '3' && cacheType === '5' && !result.cache.l1i && !result.cache.l1d) {
|
|
867
|
+
result.cache.l1i = parseInt(installedSize, 10) / 2;
|
|
868
|
+
result.cache.l1d = parseInt(installedSize, 10) / 2;
|
|
869
|
+
}
|
|
865
870
|
});
|
|
866
871
|
// lines = data[2].split('\r\n');
|
|
867
872
|
// result.virtualization = (util.getValue(lines, 'HyperVRequirementVirtualizationFirmwareEnabled').toLowerCase() === 'true');
|
|
@@ -1413,21 +1418,26 @@ function cpuCache(callback) {
|
|
|
1413
1418
|
if (result.l2) { result.l2 = parseInt(result.l2, 10) * 1024; }
|
|
1414
1419
|
if (result.l3) { result.l3 = parseInt(result.l3, 10) * 1024; }
|
|
1415
1420
|
}
|
|
1416
|
-
util.powerShell('Get-WmiObject Win32_CacheMemory | select CacheType,InstalledSize,
|
|
1421
|
+
util.powerShell('Get-WmiObject Win32_CacheMemory | select CacheType,InstalledSize,Level | fl ').then((stdout, error) => {
|
|
1417
1422
|
if (!error) {
|
|
1418
1423
|
const parts = stdout.split(/\n\s*\n/);
|
|
1419
1424
|
parts.forEach(function (part) {
|
|
1420
1425
|
const lines = part.split('\r\n');
|
|
1421
1426
|
const cacheType = util.getValue(lines, 'CacheType');
|
|
1422
|
-
const
|
|
1427
|
+
const level = util.getValue(lines, 'Level');
|
|
1423
1428
|
const installedSize = util.getValue(lines, 'InstalledSize');
|
|
1424
1429
|
// L1 Instructions
|
|
1425
|
-
if (
|
|
1426
|
-
result.l1i = parseInt(installedSize, 10);
|
|
1430
|
+
if (level === '3' && cacheType === '3') {
|
|
1431
|
+
result.cache.l1i = parseInt(installedSize, 10);
|
|
1427
1432
|
}
|
|
1428
1433
|
// L1 Data
|
|
1429
|
-
if (
|
|
1430
|
-
result.l1d = parseInt(installedSize, 10);
|
|
1434
|
+
if (level === '3' && cacheType === '4') {
|
|
1435
|
+
result.cache.l1d = parseInt(installedSize, 10);
|
|
1436
|
+
}
|
|
1437
|
+
// L1 all
|
|
1438
|
+
if (level === '3' && cacheType === '5' && !result.cache.l1i && !result.cache.l1d) {
|
|
1439
|
+
result.cache.l1i = parseInt(installedSize, 10) / 2;
|
|
1440
|
+
result.cache.l1d = parseInt(installedSize, 10) / 2;
|
|
1431
1441
|
}
|
|
1432
1442
|
});
|
|
1433
1443
|
}
|
package/lib/filesystem.js
CHANGED
package/lib/network.js
CHANGED
|
@@ -773,7 +773,6 @@ function networkInterfaces(callback, rescan) {
|
|
|
773
773
|
let mtu = '';
|
|
774
774
|
let speed = null;
|
|
775
775
|
let carrierChanges = 0;
|
|
776
|
-
let operstate = 'down';
|
|
777
776
|
let dhcp = false;
|
|
778
777
|
let dnsSuffix = '';
|
|
779
778
|
let ieee8021xAuth = '';
|
|
@@ -852,7 +851,7 @@ function networkInterfaces(callback, rescan) {
|
|
|
852
851
|
speed = isNaN(myspeed) ? null : myspeed;
|
|
853
852
|
}
|
|
854
853
|
carrierChanges = parseInt(util.getValue(lines, 'carrier_changes'), 10);
|
|
855
|
-
operstate = util.getValue(lines, 'operstate');
|
|
854
|
+
const operstate = util.getValue(lines, 'operstate');
|
|
856
855
|
type = operstate === 'up' ? (util.getValue(lines, 'wireless').trim() ? 'wireless' : 'wired') : 'unknown';
|
|
857
856
|
if (iface === 'lo' || iface.startsWith('bond')) { type = 'virtual'; }
|
|
858
857
|
|
package/lib/osinfo.js
CHANGED
|
@@ -35,12 +35,11 @@ const _sunos = (_platform === 'sunos');
|
|
|
35
35
|
|
|
36
36
|
function time() {
|
|
37
37
|
let t = new Date().toString().split(' ');
|
|
38
|
-
|
|
39
38
|
return {
|
|
40
39
|
current: Date.now(),
|
|
41
40
|
uptime: os.uptime(),
|
|
42
41
|
timezone: (t.length >= 7) ? t[5] : '',
|
|
43
|
-
timezoneName: (t.length >= 7) ? t.slice(6).join(' ').replace(/\(/g, '').replace(/\)/g, '') : ''
|
|
42
|
+
timezoneName: Intl ? Intl.DateTimeFormat().resolvedOptions().timeZone : (t.length >= 7) ? t.slice(6).join(' ').replace(/\(/g, '').replace(/\)/g, '') : ''
|
|
44
43
|
};
|
|
45
44
|
}
|
|
46
45
|
|
|
@@ -596,7 +595,7 @@ function versions(apps, callback) {
|
|
|
596
595
|
}
|
|
597
596
|
if ({}.hasOwnProperty.call(appsObj.versions, 'git')) {
|
|
598
597
|
if (_darwin) {
|
|
599
|
-
const gitHomebrewExists = fs.existsSync('/usr/local/Cellar/git');
|
|
598
|
+
const gitHomebrewExists = fs.existsSync('/usr/local/Cellar/git') || fs.existsSync('/opt/homebrew/bin/git');
|
|
600
599
|
if (util.darwinXcodeExists() || gitHomebrewExists) {
|
|
601
600
|
exec('git --version', function (error, stdout) {
|
|
602
601
|
if (!error) {
|
|
@@ -781,9 +780,14 @@ function versions(apps, callback) {
|
|
|
781
780
|
}
|
|
782
781
|
if ({}.hasOwnProperty.call(appsObj.versions, 'python')) {
|
|
783
782
|
if (_darwin) {
|
|
784
|
-
const
|
|
785
|
-
|
|
786
|
-
|
|
783
|
+
const stdout = execSync('sw_vers');
|
|
784
|
+
const lines = stdout.toString().split('\n');
|
|
785
|
+
const osVersion = util.getValue(lines, 'ProductVersion', ':');
|
|
786
|
+
const gitHomebrewExists1 = fs.existsSync('/usr/local/Cellar/python');
|
|
787
|
+
const gitHomebrewExists2 = fs.existsSync('/opt/homebrew/bin/python');
|
|
788
|
+
if ((util.darwinXcodeExists() && util.semverCompare('12.0.1', osVersion) < 0) || gitHomebrewExists1 || gitHomebrewExists2) {
|
|
789
|
+
const cmd = gitHomebrewExists1 ? '/usr/local/Cellar/python -V 2>&1' : (gitHomebrewExists2 ? '/opt/homebrew/bin/python -V 2>&1' : 'python -V 2>&1');
|
|
790
|
+
exec(cmd, function (error, stdout) {
|
|
787
791
|
if (!error) {
|
|
788
792
|
const python = stdout.toString().split('\n')[0] || '';
|
|
789
793
|
appsObj.versions.python = python.toLowerCase().replace('python', '').trim();
|
|
@@ -805,7 +809,7 @@ function versions(apps, callback) {
|
|
|
805
809
|
}
|
|
806
810
|
if ({}.hasOwnProperty.call(appsObj.versions, 'python3')) {
|
|
807
811
|
if (_darwin) {
|
|
808
|
-
const gitHomebrewExists = fs.existsSync('/usr/local/Cellar/python3');
|
|
812
|
+
const gitHomebrewExists = fs.existsSync('/usr/local/Cellar/python3') || fs.existsSync('/opt/homebrew/bin/python3');
|
|
809
813
|
if (util.darwinXcodeExists() || gitHomebrewExists) {
|
|
810
814
|
exec('python3 -V 2>&1', function (error, stdout) {
|
|
811
815
|
if (!error) {
|
|
@@ -829,7 +833,7 @@ function versions(apps, callback) {
|
|
|
829
833
|
}
|
|
830
834
|
if ({}.hasOwnProperty.call(appsObj.versions, 'pip')) {
|
|
831
835
|
if (_darwin) {
|
|
832
|
-
const gitHomebrewExists = fs.existsSync('/usr/local/Cellar/pip');
|
|
836
|
+
const gitHomebrewExists = fs.existsSync('/usr/local/Cellar/pip') || fs.existsSync('/opt/homebrew/bin/pip');
|
|
833
837
|
if (util.darwinXcodeExists() || gitHomebrewExists) {
|
|
834
838
|
exec('pip -V 2>&1', function (error, stdout) {
|
|
835
839
|
if (!error) {
|
|
@@ -855,7 +859,7 @@ function versions(apps, callback) {
|
|
|
855
859
|
}
|
|
856
860
|
if ({}.hasOwnProperty.call(appsObj.versions, 'pip3')) {
|
|
857
861
|
if (_darwin) {
|
|
858
|
-
const gitHomebrewExists = fs.existsSync('/usr/local/Cellar/pip3');
|
|
862
|
+
const gitHomebrewExists = fs.existsSync('/usr/local/Cellar/pip3') || fs.existsSync('/opt/homebrew/bin/pip3');
|
|
859
863
|
if (util.darwinXcodeExists() || gitHomebrewExists) {
|
|
860
864
|
exec('pip3 -V 2>&1', function (error, stdout) {
|
|
861
865
|
if (!error) {
|
package/lib/users.js
CHANGED
|
@@ -297,34 +297,36 @@ function users(callback) {
|
|
|
297
297
|
util.powerShell(cmd).then(data => {
|
|
298
298
|
// controller + vram
|
|
299
299
|
// let accounts = parseWinAccounts(data[0].split(/\n\s*\n/));
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
if ({}.hasOwnProperty.call(loggedons, id)) {
|
|
306
|
-
loggedons[id].dateTime = {}.hasOwnProperty.call(sessions, id) ? sessions[id] : '';
|
|
307
|
-
}
|
|
308
|
-
}
|
|
309
|
-
users.forEach(user => {
|
|
310
|
-
let dateTime = '';
|
|
300
|
+
if (data) {
|
|
301
|
+
data = data.split('#-#-#-#');
|
|
302
|
+
let sessions = parseWinSessions(data[0].split(/\n\s*\n/));
|
|
303
|
+
let loggedons = parseWinLoggedOn(data[1].split(/\n\s*\n/));
|
|
304
|
+
let users = parseWinUsers(data[2].split(/\n\s*\n/));
|
|
311
305
|
for (let id in loggedons) {
|
|
312
306
|
if ({}.hasOwnProperty.call(loggedons, id)) {
|
|
313
|
-
|
|
314
|
-
dateTime = loggedons[id].dateTime;
|
|
315
|
-
}
|
|
307
|
+
loggedons[id].dateTime = {}.hasOwnProperty.call(sessions, id) ? sessions[id] : '';
|
|
316
308
|
}
|
|
317
309
|
}
|
|
310
|
+
users.forEach(user => {
|
|
311
|
+
let dateTime = '';
|
|
312
|
+
for (let id in loggedons) {
|
|
313
|
+
if ({}.hasOwnProperty.call(loggedons, id)) {
|
|
314
|
+
if (loggedons[id].user === user.user && (!dateTime || dateTime < loggedons[id].dateTime)) {
|
|
315
|
+
dateTime = loggedons[id].dateTime;
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
}
|
|
318
319
|
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
320
|
+
result.push({
|
|
321
|
+
user: user.user,
|
|
322
|
+
tty: '',
|
|
323
|
+
date: `${dateTime.substr(0, 4)}-${dateTime.substr(4, 2)}-${dateTime.substr(6, 2)}`,
|
|
324
|
+
time: `${dateTime.substr(8, 2)}:${dateTime.substr(10, 2)}`,
|
|
325
|
+
ip: '',
|
|
326
|
+
command: ''
|
|
327
|
+
});
|
|
326
328
|
});
|
|
327
|
-
}
|
|
329
|
+
}
|
|
328
330
|
if (callback) { callback(result); }
|
|
329
331
|
resolve(result);
|
|
330
332
|
|
package/lib/util.js
CHANGED
|
@@ -1089,6 +1089,27 @@ function plistParser(xmlStr) {
|
|
|
1089
1089
|
}
|
|
1090
1090
|
}
|
|
1091
1091
|
|
|
1092
|
+
function semverCompare(v1, v2) {
|
|
1093
|
+
let res = 0;
|
|
1094
|
+
const parts1 = v1.split('.');
|
|
1095
|
+
const parts2 = v2.split('.');
|
|
1096
|
+
if (parts1[0] < parts2[0]) { res = 1; }
|
|
1097
|
+
else if (parts1[0] > parts2[0]) { res = -1; }
|
|
1098
|
+
else if (parts1[0] === parts2[0] && parts1.length >= 2 && parts2.length >= 2) {
|
|
1099
|
+
if (parts1[1] < parts2[1]) { res = 1; }
|
|
1100
|
+
else if (parts1[1] > parts2[1]) { res = -1; }
|
|
1101
|
+
else if (parts1[1] === parts2[1]) {
|
|
1102
|
+
if (parts1.length >= 3 && parts2.length >= 3) {
|
|
1103
|
+
if (parts1[2] < parts2[2]) { res = 1; }
|
|
1104
|
+
else if (parts1[2] > parts2[2]) { res = -1; }
|
|
1105
|
+
} else if (parts2.length >= 3) {
|
|
1106
|
+
res = 1;
|
|
1107
|
+
}
|
|
1108
|
+
}
|
|
1109
|
+
}
|
|
1110
|
+
return res;
|
|
1111
|
+
}
|
|
1112
|
+
|
|
1092
1113
|
function noop() { }
|
|
1093
1114
|
|
|
1094
1115
|
exports.toInt = toInt;
|
|
@@ -1134,3 +1155,4 @@ exports.stringStartWith = stringStartWith;
|
|
|
1134
1155
|
exports.mathMin = mathMin;
|
|
1135
1156
|
exports.WINDIR = WINDIR;
|
|
1136
1157
|
exports.getFilesInPath = getFilesInPath;
|
|
1158
|
+
exports.semverCompare = semverCompare;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "systeminformation",
|
|
3
|
-
"version": "5.9.
|
|
3
|
+
"version": "5.9.14",
|
|
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)",
|
|
@@ -93,6 +93,6 @@
|
|
|
93
93
|
"sunos"
|
|
94
94
|
],
|
|
95
95
|
"engines": {
|
|
96
|
-
"node": ">=
|
|
96
|
+
"node": ">=8.0.0"
|
|
97
97
|
}
|
|
98
98
|
}
|