systeminformation 5.22.0 → 5.22.2

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/system.js CHANGED
@@ -215,12 +215,14 @@ function system(callback) {
215
215
  exec('ioreg -c IOPlatformExpertDevice -d 2', function (error, stdout) {
216
216
  if (!error) {
217
217
  let lines = stdout.toString().replace(/[<>"]/g, '').split('\n');
218
+ const model = splitByNumber(util.getValue(lines, 'model', '=', true));
219
+ const version = util.getValue(lines, 'version', '=', true);
218
220
  result.manufacturer = util.getValue(lines, 'manufacturer', '=', true);
219
- result.model = util.getValue(lines, 'model', '=', true, true);
220
- result.version = util.getValue(lines, 'version', '=', true);
221
+ result.model = version ? util.getValue(lines, 'model', '=', true) : model[0];
222
+ result.version = version || model[1];
221
223
  result.serial = util.getValue(lines, 'ioplatformserialnumber', '=', true);
222
224
  result.uuid = util.getValue(lines, 'ioplatformuuid', '=', true).toLowerCase();
223
- result.sku = util.getValue(lines, 'board-id', '=', true);
225
+ result.sku = util.getValue(lines, 'board-id', '=', true) || util.getValue(lines, 'target-sub-type', '=', true);
224
226
  }
225
227
  if (callback) { callback(result); }
226
228
  resolve(result);
@@ -602,6 +604,33 @@ function baseboard(callback) {
602
604
 
603
605
  exports.baseboard = baseboard;
604
606
 
607
+ function macOsChassisType(model) {
608
+ model = model.toLowerCase();
609
+ if (model.startsWith('macbookair')) { return 'Notebook'; }
610
+ if (model.startsWith('macbookpro')) { return 'Laptop'; }
611
+ if (model.startsWith('macbook')) { return 'Notebook'; }
612
+ if (model.startsWith('macmini')) { return 'Desktop'; }
613
+ if (model.startsWith('imac')) { return 'Desktop'; }
614
+ if (model.startsWith('macstudio')) { return 'Desktop'; }
615
+ if (model.startsWith('macpro')) { return 'Tower'; }
616
+ return 'Other';
617
+ }
618
+
619
+ function splitByNumber(str) {
620
+ let numberStarted = false;
621
+ let num = '';
622
+ let cpart = '';
623
+ for (const c of str) {
624
+ if ((c >= '0' && c <= '9') || numberStarted) {
625
+ numberStarted = true;
626
+ num += c;
627
+ } else {
628
+ cpart += c;
629
+ }
630
+ }
631
+ return [cpart, num];
632
+ }
633
+
605
634
  function chassis(callback) {
606
635
  const chassisTypes = ['Other',
607
636
  'Unknown',
@@ -680,11 +709,16 @@ function chassis(callback) {
680
709
  exec('ioreg -c IOPlatformExpertDevice -d 2', function (error, stdout) {
681
710
  if (!error) {
682
711
  let lines = stdout.toString().replace(/[<>"]/g, '').split('\n');
712
+ const model = util.getValue(lines, 'model', '=', true);
713
+ const modelParts = splitByNumber(model);
714
+ const version = util.getValue(lines, 'version', '=', true);
683
715
  result.manufacturer = util.getValue(lines, 'manufacturer', '=', true);
684
- result.model = util.getValue(lines, 'model', '=', true);
685
- result.version = util.getValue(lines, 'version', '=', true);
716
+ result.model = version ? util.getValue(lines, 'model', '=', true) : modelParts[0];
717
+ result.type = macOsChassisType(result.model);
718
+ result.version = version || model;
686
719
  result.serial = util.getValue(lines, 'ioplatformserialnumber', '=', true);
687
- result.assetTag = util.getValue(lines, 'board-id', '=', true);
720
+ result.assetTag = util.getValue(lines, 'board-id', '=', true) || util.getValue(lines, 'target-type', '=', true);
721
+ result.sku = util.getValue(lines, 'target-sub-type', '=', true);
688
722
  }
689
723
 
690
724
  if (callback) { callback(result); }
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.2",
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)",