systeminformation 5.21.25 → 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.
package/README.md CHANGED
@@ -128,6 +128,7 @@ si.cpu()
128
128
 
129
129
  (last 7 major and minor version releases)
130
130
 
131
+ - Version 5.22.0: `wifiConnections()` added signal quality
131
132
  - Version 5.21.0: `graphics()` added subVendor (linux)
132
133
  - Version 5.20.0: `mem()` added writeback and dirty (linux)
133
134
  - Version 5.19.0: `currentLoad()` added steal and guest time (linux)
@@ -658,15 +659,15 @@ Full function reference with examples can be found at [https://systeminformation
658
659
  | si.wifiConnections(cb) | [{...}] | X | | X | X | | array of active wifi connections |
659
660
  | | [0].id | X | | X | X | | ID |
660
661
  | | [0].iface | X | | X | X | | interface |
661
- | | [0].name | X | | X | X | | name |
662
- | | [0].mode | X | | X | X | | model |
662
+ | | [0].model | X | | X | X | | model |
663
+ | | [0].ssid | X | | X | X | | SSID |
663
664
  | | [0].bssid | X | | (X) | X | | BSSID (mac) - macOS only on older os versions |
664
- | | [0].mode | X | | | | | mode |
665
665
  | | [0].channel | X | | X | X | | channel |
666
666
  | | [0].frequency | X | | X | X | | frequency in MHz |
667
+ | | [0].type | X | | X | X | | e.g. 802.11 |
668
+ | | [0].security | X | | X | X | | array e.g. WPA, WPA-2 |
667
669
  | | [0].signalLevel | X | | X | X | | signal level in dB |
668
670
  | | [0].quality | X | | X | X | | quality in % |
669
- | | [0].security | X | | X | X | | array e.g. WPA, WPA-2 |
670
671
  | | [0].txRate | X | | X | X | | transfer rate MBit/s |
671
672
 
672
673
  #### 15. Bluetooth
package/lib/index.d.ts CHANGED
@@ -576,10 +576,11 @@ export namespace Systeminformation {
576
576
  ssid: string;
577
577
  bssid: string;
578
578
  channel: number;
579
+ frequency: number;
579
580
  type: string;
580
581
  security: string;
581
- frequency: number;
582
582
  signalLevel: number;
583
+ quality: number;
583
584
  txRate: number;
584
585
  }
585
586
 
package/lib/wifi.js CHANGED
@@ -247,14 +247,15 @@ function getWifiNetworkListNmi() {
247
247
  const security = util.getValue(lines, 'SECURITY').replace('(', '').replace(')', '');
248
248
  const wpaFlags = util.getValue(lines, 'WPA-FLAGS').replace('(', '').replace(')', '');
249
249
  const rsnFlags = util.getValue(lines, 'RSN-FLAGS').replace('(', '').replace(')', '');
250
+ const quality = util.getValue(lines, 'SIGNAL');
250
251
  result.push({
251
252
  ssid: util.getValue(lines, 'SSID'),
252
253
  bssid: util.getValue(lines, 'BSSID').toLowerCase(),
253
254
  mode: util.getValue(lines, 'MODE'),
254
255
  channel: channel ? parseInt(channel, 10) : null,
255
256
  frequency: frequency ? parseInt(frequency, 10) : null,
256
- signalLevel: wifiDBFromQuality(util.getValue(lines, 'SIGNAL')),
257
- quality: parseFloat(util.getValue(lines, 'SIGNAL')),
257
+ signalLevel: wifiDBFromQuality(quality),
258
+ quality: quality ? parseInt(quality, 10) : null,
258
259
  security: security && security !== 'none' ? security.split(' ') : [],
259
260
  wpaFlags: wpaFlags && wpaFlags !== 'none' ? wpaFlags.split(' ') : [],
260
261
  rsnFlags: rsnFlags && rsnFlags !== 'none' ? rsnFlags.split(' ') : []
@@ -539,6 +540,11 @@ function getVendor(model) {
539
540
  return result;
540
541
  }
541
542
 
543
+ function formatBssid(s) {
544
+ s = s.replace(/</g, '').replace(/>/g, '').match(/.{1,2}/g);
545
+ return s.join(':');
546
+ }
547
+
542
548
  function wifiConnections(callback) {
543
549
 
544
550
  return new Promise((resolve) => {
@@ -575,6 +581,7 @@ function wifiConnections(callback) {
575
581
  const nmiConnection = nmiConnectionLinux(ssidSanitized);
576
582
  const channel = network && network.length && network[0].channel ? network[0].channel : (wpaDetails.channel ? wpaDetails.channel : null);
577
583
  const bssid = network && network.length && network[0].bssid ? network[0].bssid : (wpaDetails.bssid ? wpaDetails.bssid : null);
584
+ const signalLevel = network && network.length && network[0].signalLevel ? network[0].signalLevel : null;
578
585
  if (ssid && bssid) {
579
586
  result.push({
580
587
  id: ifaceDetail.id,
@@ -586,7 +593,8 @@ function wifiConnections(callback) {
586
593
  frequency: channel ? wifiFrequencyFromChannel(channel) : null,
587
594
  type: nmiConnection.type ? nmiConnection.type : '802.11',
588
595
  security: nmiConnection.security ? nmiConnection.security : (wpaDetails.security ? wpaDetails.security : null),
589
- signalLevel: network && network.length && network[0].signalLevel ? network[0].signalLevel : null,
596
+ signalLevel,
597
+ quality: wifiQualityFromDB(signalLevel),
590
598
  txRate: null
591
599
  });
592
600
  }
@@ -603,19 +611,24 @@ function wifiConnections(callback) {
603
611
  const lines = parts1[1].split('\n\n')[0].split('\n');
604
612
  const iface = util.getValue(lines, 'BSD Device Name', ':', true);
605
613
  const model = util.getValue(lines, 'hardware', ':', true);
606
- 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';
607
615
  exec(cmd, function (error, stdout) {
608
- const lines2 = stdout.toString().split('\n');
609
- 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) {
610
623
  const ssid = util.getValue(lines2, 'ssid', ':', true);
611
- const bssid = util.getValue(lines2, 'bssid', ':', true);
624
+ const bssid = util.getValue(lines2, 'bssid', ':', true) || formatBssid(util.getValue(lines3, 'IO80211BSSID', '=', true));
612
625
  const security = util.getValue(lines2, 'link auth', ':', true);
613
626
  const txRate = util.getValue(lines2, 'lastTxRate', ':', true);
614
627
  const channel = util.getValue(lines2, 'channel', ':', true).split(',')[0];
615
628
  const type = '802.11';
616
629
  const rssi = util.toInt(util.getValue(lines2, 'agrCtlRSSI', ':', true));
617
- const noise = util.toInt(util.getValue(lines2, 'agrCtlNoise', ':', true));
618
- const signalLevel = rssi - noise;
630
+ /// const noise = util.toInt(util.getValue(lines2, 'agrCtlNoise', ':', true));
631
+ const signalLevel = rssi;
619
632
  if (ssid || bssid) {
620
633
  result.push({
621
634
  id: 'Wi-Fi',
@@ -628,6 +641,33 @@ function wifiConnections(callback) {
628
641
  type,
629
642
  security,
630
643
  signalLevel,
644
+ quality: wifiQualityFromDB(signalLevel),
645
+ txRate
646
+ });
647
+ }
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,
631
671
  txRate
632
672
  });
633
673
  }
@@ -661,7 +701,8 @@ function wifiConnections(callback) {
661
701
  const id = lines[2].indexOf(':') >= 0 ? lines[2].split(':')[1].trim() : '';
662
702
  const ssid = util.getValue(lines, 'SSID', ':', true);
663
703
  const bssid = util.getValue(lines, 'BSSID', ':', true);
664
- const signalLevel = wifiDBFromQuality(util.getValue(lines, 'Signal', ':', true));
704
+ const quality = util.getValue(lines, 'Signal', ':', true);
705
+ const signalLevel = wifiDBFromQuality(quality);
665
706
  const type = util.getValue(lines, 'Radio type', ':', true) || util.getValue(lines, 'Type de radio', ':', true) || util.getValue(lines, 'Funktyp', ':', true) || null;
666
707
  const security = util.getValue(lines, 'authentication', ':', true) || util.getValue(lines, 'Authentification', ':', true) || util.getValue(lines, 'Authentifizierung', ':', true) || null;
667
708
  const channel = util.getValue(lines, 'Channel', ':', true) || util.getValue(lines, 'Canal', ':', true) || util.getValue(lines, 'Kanal', ':', true) || null;
@@ -678,6 +719,7 @@ function wifiConnections(callback) {
678
719
  type,
679
720
  security,
680
721
  signalLevel,
722
+ quality: quality ? parseInt(quality, 10) : null,
681
723
  txRate: util.toInt(txRate) || null
682
724
  });
683
725
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "systeminformation",
3
- "version": "5.21.25",
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)",