systeminformation 5.23.14 → 5.23.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/README.md +1 -1
- package/lib/users.js +1 -1
- package/lib/wifi.js +48 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
|
|
52
52
|
I wish you all a Merry Christmas and a peaceful New Year 2025.
|
|
53
53
|
|
|
54
|
-
This is amazing. Started as a small project just for myself, it now has >
|
|
54
|
+
This is amazing. Started as a small project just for myself, it now has > 17,000
|
|
55
55
|
lines of code, > 650 versions published, up to 8 mio downloads per month, > 330
|
|
56
56
|
mio downloads overall. #1 NPM ranking for backend packages. Thank you to all who
|
|
57
57
|
contributed to this project!
|
package/lib/users.js
CHANGED
|
@@ -120,7 +120,7 @@ function parseUsersDarwin(lines) {
|
|
|
120
120
|
result_w.command = l.slice(5, 1000).join(' ');
|
|
121
121
|
// find corresponding 'who' line
|
|
122
122
|
who_line = result_who.filter(function (obj) {
|
|
123
|
-
return (obj.user === result_w.user && (obj.tty.substring(3, 1000) === result_w.tty || obj.tty === result_w.tty));
|
|
123
|
+
return (obj.user.substring(0, 10) === result_w.user.substring(0, 10) && (obj.tty.substring(3, 1000) === result_w.tty || obj.tty === result_w.tty));
|
|
124
124
|
});
|
|
125
125
|
if (who_line.length === 1) {
|
|
126
126
|
result.push({
|
package/lib/wifi.js
CHANGED
|
@@ -396,6 +396,47 @@ function parseWifiDarwin(wifiObj) {
|
|
|
396
396
|
}
|
|
397
397
|
return result;
|
|
398
398
|
}
|
|
399
|
+
|
|
400
|
+
function parseWifi2Darwin(wifiStr) {
|
|
401
|
+
const result = [];
|
|
402
|
+
try {
|
|
403
|
+
let wifiObj = JSON.parse(wifiStr);
|
|
404
|
+
wifiObj = wifiObj.SPAirPortDataType[0].spairport_airport_interfaces[0].spairport_airport_other_local_wireless_networks;
|
|
405
|
+
wifiObj.forEach(function (wifiItem) {
|
|
406
|
+
|
|
407
|
+
let security = [];
|
|
408
|
+
const sm = wifiItem.spairport_security_mode;
|
|
409
|
+
if (sm === 'spairport_security_mode_wep') {
|
|
410
|
+
security.push('WEP');
|
|
411
|
+
} else if (sm === 'spairport_security_mode_wpa2_personal') {
|
|
412
|
+
security.push('WPA2');
|
|
413
|
+
} else if (sm.startsWith('spairport_security_mode_wpa2_enterprise')) {
|
|
414
|
+
security.push('WPA2 EAP');
|
|
415
|
+
} else if (sm.startsWith('pairport_security_mode_wpa3_transition')) {
|
|
416
|
+
security.push('WPA2/WPA3');
|
|
417
|
+
} else if (sm.startsWith('pairport_security_mode_wpa3')) {
|
|
418
|
+
security.push('WPA3');
|
|
419
|
+
}
|
|
420
|
+
const channelInfo = new RegExp(/(\d+) \((\d)GHz, (\d+)MHz\)/g).exec(wifiItem.spairport_network_channel);
|
|
421
|
+
|
|
422
|
+
result.push({
|
|
423
|
+
ssid: wifiItem._name || '',
|
|
424
|
+
bssid: '',
|
|
425
|
+
mode: wifiItem.spairport_network_phymode,
|
|
426
|
+
channel: parseInt(channelInfo[0].split(' ')[0]),
|
|
427
|
+
frequency: wifiFrequencyFromChannel(channelInfo[1]),
|
|
428
|
+
signalLevel: null,
|
|
429
|
+
quality: null,
|
|
430
|
+
security,
|
|
431
|
+
wpaFlags: [],
|
|
432
|
+
rsnFlags: []
|
|
433
|
+
});
|
|
434
|
+
});
|
|
435
|
+
return result;
|
|
436
|
+
} catch (e) {
|
|
437
|
+
return result;
|
|
438
|
+
}
|
|
439
|
+
};
|
|
399
440
|
function wifiNetworks(callback) {
|
|
400
441
|
return new Promise((resolve) => {
|
|
401
442
|
process.nextTick(() => {
|
|
@@ -459,10 +500,15 @@ function wifiNetworks(callback) {
|
|
|
459
500
|
resolve(result);
|
|
460
501
|
}
|
|
461
502
|
} else if (_darwin) {
|
|
462
|
-
let cmd = '/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -s -x';
|
|
503
|
+
let cmd = '/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -s -x >2 /dev/bull; echo "######"; system_profiler -json SPAirPortDataType';
|
|
463
504
|
exec(cmd, { maxBuffer: 1024 * 40000 }, function (error, stdout) {
|
|
464
505
|
const output = stdout.toString();
|
|
465
|
-
|
|
506
|
+
const parts = output.split('######');
|
|
507
|
+
if (parts[0]) {
|
|
508
|
+
result = parseWifiDarwin(util.plistParser(parts[0]));
|
|
509
|
+
} else {
|
|
510
|
+
result = parseWifi2Darwin(parts[1]);
|
|
511
|
+
}
|
|
466
512
|
if (callback) {
|
|
467
513
|
callback(result);
|
|
468
514
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "systeminformation",
|
|
3
|
-
"version": "5.23.
|
|
3
|
+
"version": "5.23.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)",
|