systeminformation 5.31.13 → 5.31.15
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 +1 -1
- package/lib/filesystem.js +84 -6
- package/lib/network.js +1 -1
- package/lib/wifi.js +7 -3
- package/package.json +1 -1
package/lib/cpu.js
CHANGED
|
@@ -1430,7 +1430,7 @@ function cpuTemperature(callback) {
|
|
|
1430
1430
|
else if (s.startsWith('coretemp') || s.startsWith('core')) section = 'core';
|
|
1431
1431
|
else if (s.startsWith('k10temp')) section = 'coreAMD';
|
|
1432
1432
|
else if (s.startsWith('cpu_thermal') || s.startsWith('cpu-thermal') || s.startsWith('soc_thermal') || s.startsWith('cpu')) section = 'cpuThermal';
|
|
1433
|
-
else section = 'other';
|
|
1433
|
+
else section = 'other';
|
|
1434
1434
|
newSectionStarts = false;
|
|
1435
1435
|
}
|
|
1436
1436
|
|
package/lib/filesystem.js
CHANGED
|
@@ -15,7 +15,6 @@
|
|
|
15
15
|
|
|
16
16
|
const util = require('./util');
|
|
17
17
|
const fs = require('fs');
|
|
18
|
-
const os = require('os');
|
|
19
18
|
|
|
20
19
|
const exec = require('child_process').exec;
|
|
21
20
|
const execSync = require('child_process').execSync;
|
|
@@ -215,7 +214,7 @@ function fsSize(drive, callback) {
|
|
|
215
214
|
}
|
|
216
215
|
if (_windows) {
|
|
217
216
|
try {
|
|
218
|
-
const driveSanitized = drive ? util.
|
|
217
|
+
const driveSanitized = drive ? util.sanitizeString(drive, true) : '';
|
|
219
218
|
const cmd = `Get-WmiObject Win32_logicaldisk | select Access,Caption,FileSystem,FreeSpace,Size ${driveSanitized ? '| where -property Caption -eq ' + driveSanitized : ''} | fl`;
|
|
220
219
|
util.powerShell(cmd).then((stdout, error) => {
|
|
221
220
|
if (!error) {
|
|
@@ -485,7 +484,7 @@ function raidMatchLinux(data) {
|
|
|
485
484
|
try {
|
|
486
485
|
data.forEach((element) => {
|
|
487
486
|
if (element.type.startsWith('raid')) {
|
|
488
|
-
const lines = execSync(`mdadm --export --detail /dev/${element.name}`, util.execOptsLinux).toString().split('\n');
|
|
487
|
+
const lines = execSync(`mdadm --export --detail /dev/${util.sanitizeString(element.name, true)}`, util.execOptsLinux).toString().split('\n');
|
|
489
488
|
const mdData = decodeMdabmData(lines);
|
|
490
489
|
|
|
491
490
|
element.label = mdData.label; // <- assign label info
|
|
@@ -1194,7 +1193,7 @@ function diskLayout(callback) {
|
|
|
1194
1193
|
let devices = [];
|
|
1195
1194
|
try {
|
|
1196
1195
|
const outJSON = JSON.parse(out);
|
|
1197
|
-
if (outJSON &&
|
|
1196
|
+
if (outJSON && Object.hasOwn(outJSON, 'blockdevices')) {
|
|
1198
1197
|
devices = outJSON.blockdevices.filter((item) => {
|
|
1199
1198
|
return (
|
|
1200
1199
|
item.type === 'disk' &&
|
|
@@ -1351,17 +1350,20 @@ function diskLayout(callback) {
|
|
|
1351
1350
|
}
|
|
1352
1351
|
if (_darwin) {
|
|
1353
1352
|
let cmdFullSmart = '';
|
|
1354
|
-
exec(`system_profiler SPSerialATADataType SPNVMeDataType
|
|
1353
|
+
exec(`system_profiler SPSerialATADataType SPNVMeDataType SPUSBDataType SPStorageDataType`, { maxBuffer: 1024 * 1024 }, (error, stdout) => {
|
|
1355
1354
|
if (!error) {
|
|
1356
1355
|
// split by type:
|
|
1357
1356
|
const lines = stdout.toString().split('\n');
|
|
1358
1357
|
const linesSATA = [];
|
|
1359
1358
|
const linesNVMe = [];
|
|
1359
|
+
const linesStorage = [];
|
|
1360
1360
|
const linesUSB = [];
|
|
1361
1361
|
let dataType = 'SATA';
|
|
1362
1362
|
lines.forEach((line) => {
|
|
1363
1363
|
if (line === 'NVMExpress:') {
|
|
1364
1364
|
dataType = 'NVMe';
|
|
1365
|
+
} else if (line === 'Storage:') {
|
|
1366
|
+
dataType = 'Storage';
|
|
1365
1367
|
} else if (line === 'USB:') {
|
|
1366
1368
|
dataType = 'USB';
|
|
1367
1369
|
} else if (line === 'SATA/SATA Express:') {
|
|
@@ -1370,6 +1372,8 @@ function diskLayout(callback) {
|
|
|
1370
1372
|
linesSATA.push(line);
|
|
1371
1373
|
} else if (dataType === 'NVMe') {
|
|
1372
1374
|
linesNVMe.push(line);
|
|
1375
|
+
} else if (dataType === 'Storage') {
|
|
1376
|
+
linesStorage.push(line);
|
|
1373
1377
|
} else if (dataType === 'USB') {
|
|
1374
1378
|
linesUSB.push(line);
|
|
1375
1379
|
}
|
|
@@ -1485,7 +1489,7 @@ function diskLayout(callback) {
|
|
|
1485
1489
|
} catch {
|
|
1486
1490
|
util.noop();
|
|
1487
1491
|
}
|
|
1488
|
-
// USB Drives
|
|
1492
|
+
// USB Drives (older macOS report storage devices under SPUSBDataType)
|
|
1489
1493
|
try {
|
|
1490
1494
|
const devices = linesUSB.join('\n').replaceAll('Media:\n ', 'Model:').split('\n\n Product ID:');
|
|
1491
1495
|
devices.shift();
|
|
@@ -1538,6 +1542,80 @@ function diskLayout(callback) {
|
|
|
1538
1542
|
} catch {
|
|
1539
1543
|
util.noop();
|
|
1540
1544
|
}
|
|
1545
|
+
// External drives (USB, Thunderbolt, ...) via SPStorageDataType
|
|
1546
|
+
// only add drives not already reported by the SATA/NVMe/USB data types above
|
|
1547
|
+
try {
|
|
1548
|
+
const seen = {};
|
|
1549
|
+
result.forEach((d) => {
|
|
1550
|
+
const m = (d.BSDName || '').match(/disk\d+/);
|
|
1551
|
+
if (m) {
|
|
1552
|
+
seen[m[0]] = true;
|
|
1553
|
+
}
|
|
1554
|
+
});
|
|
1555
|
+
const devices = linesStorage.join('\n').split(' Free:');
|
|
1556
|
+
devices.shift();
|
|
1557
|
+
devices.forEach((device) => {
|
|
1558
|
+
const lines = device.split('\n');
|
|
1559
|
+
const internal = util.getValue(lines, 'Internal', ':', true).trim().toLowerCase();
|
|
1560
|
+
if (internal !== 'no') {
|
|
1561
|
+
return;
|
|
1562
|
+
}
|
|
1563
|
+
const bsdMatch = util
|
|
1564
|
+
.getValue(lines, 'BSD Name', ':', true)
|
|
1565
|
+
.trim()
|
|
1566
|
+
.match(/disk\d+/);
|
|
1567
|
+
const BSDName = bsdMatch ? bsdMatch[0] : '';
|
|
1568
|
+
if (!BSDName || seen[BSDName]) {
|
|
1569
|
+
return;
|
|
1570
|
+
}
|
|
1571
|
+
const sizeStr = util.getValue(lines, 'Capacity', ':', true).trim();
|
|
1572
|
+
if (sizeStr) {
|
|
1573
|
+
let sizeValue = 0;
|
|
1574
|
+
if (sizeStr.indexOf('(') >= 0) {
|
|
1575
|
+
sizeValue = parseInt(
|
|
1576
|
+
sizeStr
|
|
1577
|
+
.match(/\(([^)]+)\)/)[1]
|
|
1578
|
+
.replace(/\./g, '')
|
|
1579
|
+
.replace(/,/g, '')
|
|
1580
|
+
.replace(/\s/g, ''),
|
|
1581
|
+
10
|
|
1582
|
+
);
|
|
1583
|
+
}
|
|
1584
|
+
if (!sizeValue) {
|
|
1585
|
+
sizeValue = parseInt(sizeStr, 10);
|
|
1586
|
+
}
|
|
1587
|
+
if (sizeValue) {
|
|
1588
|
+
seen[BSDName] = true;
|
|
1589
|
+
const protocol = util.getValue(lines, 'Protocol', ':', true).trim();
|
|
1590
|
+
const model = util.getValue(lines, 'Device Name', ':', true).trim();
|
|
1591
|
+
result.push({
|
|
1592
|
+
device: BSDName,
|
|
1593
|
+
type: protocol && protocol !== 'USB' ? protocol : 'USB',
|
|
1594
|
+
name: model,
|
|
1595
|
+
vendor: getVendorFromModel(model),
|
|
1596
|
+
size: sizeValue,
|
|
1597
|
+
bytesPerSector: null,
|
|
1598
|
+
totalCylinders: null,
|
|
1599
|
+
totalHeads: null,
|
|
1600
|
+
totalSectors: null,
|
|
1601
|
+
totalTracks: null,
|
|
1602
|
+
tracksPerCylinder: null,
|
|
1603
|
+
sectorsPerTrack: null,
|
|
1604
|
+
firmwareRevision: '',
|
|
1605
|
+
serialNum: '',
|
|
1606
|
+
interfaceType: protocol || 'USB',
|
|
1607
|
+
smartStatus: 'unknown',
|
|
1608
|
+
temperature: null,
|
|
1609
|
+
BSDName: BSDName
|
|
1610
|
+
});
|
|
1611
|
+
cmd = cmd + 'printf "\n' + BSDName + '|"; diskutil info /dev/' + BSDName + ' | grep SMART;';
|
|
1612
|
+
cmdFullSmart += `${cmdFullSmart ? 'printf ",";' : ''}smartctl -a -j ${BSDName};`;
|
|
1613
|
+
}
|
|
1614
|
+
}
|
|
1615
|
+
});
|
|
1616
|
+
} catch {
|
|
1617
|
+
util.noop();
|
|
1618
|
+
}
|
|
1541
1619
|
// check S.M.A.R.T. status
|
|
1542
1620
|
if (cmdFullSmart) {
|
|
1543
1621
|
exec(cmdFullSmart, { maxBuffer: 1024 * 1024 }, (error, stdout) => {
|
package/lib/network.js
CHANGED
|
@@ -1337,7 +1337,7 @@ function networkStatsSingle(iface) {
|
|
|
1337
1337
|
|
|
1338
1338
|
return new Promise((resolve) => {
|
|
1339
1339
|
process.nextTick(() => {
|
|
1340
|
-
const ifaceSanitized = util.sanitizeString(iface);
|
|
1340
|
+
const ifaceSanitized = util.sanitizeString(iface, true);
|
|
1341
1341
|
|
|
1342
1342
|
let result = {
|
|
1343
1343
|
iface: ifaceSanitized,
|
package/lib/wifi.js
CHANGED
|
@@ -204,7 +204,11 @@ function nmiDeviceLinux(iface) {
|
|
|
204
204
|
}
|
|
205
205
|
|
|
206
206
|
function nmiConnectionLinux(ssid) {
|
|
207
|
-
const
|
|
207
|
+
const ssidSanitized = sanitizeShellString(ssid, true);
|
|
208
|
+
if (!ssidSanitized) {
|
|
209
|
+
return {};
|
|
210
|
+
}
|
|
211
|
+
const cmd = `nmcli -t connection show ${ssidSanitized} 2>/dev/null`;
|
|
208
212
|
try {
|
|
209
213
|
const lines = execSync(cmd, util.execOptsLinux).toString().split('\n');
|
|
210
214
|
const bssid = util.getValue(lines, '802-11-wireless.seen-bssids').toLowerCase();
|
|
@@ -225,7 +229,7 @@ function wpaConnectionLinux(iface) {
|
|
|
225
229
|
if (!iface) {
|
|
226
230
|
return {};
|
|
227
231
|
}
|
|
228
|
-
const cmd = `wpa_cli -i ${iface} status 2>&1`;
|
|
232
|
+
const cmd = `wpa_cli -i ${util.sanitizeString(iface, true)} status 2>&1`;
|
|
229
233
|
try {
|
|
230
234
|
const lines = execSync(cmd, util.execOptsLinux).toString().split('\n');
|
|
231
235
|
const freq = util.toInt(util.getValue(lines, 'freq', '='));
|
|
@@ -280,7 +284,7 @@ function getWifiNetworkListNmi() {
|
|
|
280
284
|
function getWifiNetworkListIw(iface) {
|
|
281
285
|
const result = [];
|
|
282
286
|
try {
|
|
283
|
-
let iwlistParts = execSync(`export LC_ALL=C; iwlist ${iface} scan 2>&1; unset LC_ALL`, util.execOptsLinux).toString().split(' Cell ');
|
|
287
|
+
let iwlistParts = execSync(`export LC_ALL=C; iwlist ${util.sanitizeString(iface, true)} scan 2>&1; unset LC_ALL`, util.execOptsLinux).toString().split(' Cell ');
|
|
284
288
|
if (iwlistParts[0].indexOf('resource busy') >= 0) {
|
|
285
289
|
return -1;
|
|
286
290
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "systeminformation",
|
|
3
|
-
"version": "5.31.
|
|
3
|
+
"version": "5.31.15",
|
|
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)",
|