systeminformation 5.22.0 → 5.22.1

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.
Files changed (2) hide show
  1. package/lib/wifi.js +40 -4
  2. package/package.json +1 -1
package/lib/wifi.js CHANGED
@@ -540,6 +540,11 @@ function getVendor(model) {
540
540
  return result;
541
541
  }
542
542
 
543
+ function formatBssid(s) {
544
+ s = s.replace(/</g, '').replace(/>/g, '').match(/.{1,2}/g);
545
+ return s.join(':');
546
+ }
547
+
543
548
  function wifiConnections(callback) {
544
549
 
545
550
  return new Promise((resolve) => {
@@ -606,12 +611,17 @@ function wifiConnections(callback) {
606
611
  const lines = parts1[1].split('\n\n')[0].split('\n');
607
612
  const iface = util.getValue(lines, 'BSD Device Name', ':', true);
608
613
  const model = util.getValue(lines, 'hardware', ':', true);
609
- cmd = '/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -I';
614
+ cmd = '/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -I 2>/dev/null; echo "######" ; ioreg -n AppleBCMWLANSkywalkInterface -r 2>/dev/null';
610
615
  exec(cmd, function (error, stdout) {
611
- const lines2 = stdout.toString().split('\n');
612
- if (lines.length > 10) {
616
+ const parts = stdout.toString().split('######');
617
+ const lines2 = parts[0].split('\n');
618
+ let lines3 = [];
619
+ if (parts[1].indexOf(' | {') > 0 && parts[1].indexOf(' | }') > parts[1].indexOf(' | {')) {
620
+ lines3 = parts[1].split(' | {')[1].split(' | }')[0].replace(/ \| /g, '').replace(/"/g, '').split('\n');
621
+ }
622
+ if (lines2.length > 10) {
613
623
  const ssid = util.getValue(lines2, 'ssid', ':', true);
614
- const bssid = util.getValue(lines2, 'bssid', ':', true);
624
+ const bssid = util.getValue(lines2, 'bssid', ':', true) || formatBssid(util.getValue(lines3, 'IO80211BSSID', '=', true));
615
625
  const security = util.getValue(lines2, 'link auth', ':', true);
616
626
  const txRate = util.getValue(lines2, 'lastTxRate', ':', true);
617
627
  const channel = util.getValue(lines2, 'channel', ':', true).split(',')[0];
@@ -636,6 +646,32 @@ function wifiConnections(callback) {
636
646
  });
637
647
  }
638
648
  }
649
+ if (lines3.length > 10) {
650
+ const ssid = util.getValue(lines3, 'IO80211SSID', '=', true);
651
+ const bssid = formatBssid(util.getValue(lines3, 'IO80211BSSID', '=', true));
652
+ const security = '';
653
+ const txRate = -1;
654
+ const signalLevel = -1;
655
+ const quality = -1;
656
+ const channel = util.getValue(lines3, 'IO80211Channel', '=', true);
657
+ const type = '802.11';
658
+ if ((ssid || bssid) && !result.length) {
659
+ result.push({
660
+ id: 'Wi-Fi',
661
+ iface,
662
+ model,
663
+ ssid,
664
+ bssid,
665
+ channel: util.toInt(channel),
666
+ frequency: channel ? wifiFrequencyFromChannel(channel) : null,
667
+ type,
668
+ security,
669
+ signalLevel,
670
+ quality,
671
+ txRate
672
+ });
673
+ }
674
+ }
639
675
  if (callback) {
640
676
  callback(result);
641
677
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "systeminformation",
3
- "version": "5.22.0",
3
+ "version": "5.22.1",
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)",