systeminformation 5.28.0 → 5.28.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
@@ -185,7 +185,7 @@ si.cpu()
185
185
 
186
186
  (last 7 major and minor version releases)
187
187
 
188
- - Version 5.28.0: `mem()` added suppurt for macos-temperature-sensor (macOS)
188
+ - Version 5.28.0: `couPemperature()` added suppurt for macos-temperature-sensor (macOS)
189
189
  - Version 5.27.0: `mem()` added reclaimable memory
190
190
  - Version 5.26.0: `getStatic()`, `getAll()` added usb, audio, bluetooth, printer
191
191
  - Version 5.25.0: `versions()` added homebrew
package/lib/graphics.js CHANGED
@@ -779,7 +779,7 @@ function graphics(callback) {
779
779
  try {
780
780
  stdout = execSync(
781
781
  'defaults read /Library/Preferences/com.apple.windowserver.plist 2>/dev/null;defaults read /Library/Preferences/com.apple.windowserver.displays.plist 2>/dev/null; echo ""',
782
- { maxBuffer: 1024 * 20000 }
782
+ { maxBuffer: 1024 * 102400 }
783
783
  );
784
784
  const output = (stdout || '').toString();
785
785
  const obj = util.plistReader(output);
package/lib/network.js CHANGED
@@ -524,12 +524,12 @@ function parseLinesDarwinNics(sections) {
524
524
  function getDarwinNics() {
525
525
  const cmd = '/sbin/ifconfig -v';
526
526
  try {
527
- const lines = execSync(cmd, { maxBuffer: 1024 * 20000 })
527
+ const lines = execSync(cmd, { maxBuffer: 1024 * 102400 })
528
528
  .toString()
529
529
  .split('\n');
530
530
  const nsections = splitSectionsNics(lines);
531
531
  return parseLinesDarwinNics(nsections);
532
- } catch (e) {
532
+ } catch {
533
533
  return [];
534
534
  }
535
535
  }
@@ -543,7 +543,7 @@ function getLinuxIfaceConnectionName(interfaceName) {
543
543
  const connectionNameLines = resultFormat.split(' ').slice(3);
544
544
  const connectionName = connectionNameLines.join(' ');
545
545
  return connectionName !== '--' ? connectionName : '';
546
- } catch (e) {
546
+ } catch {
547
547
  return '';
548
548
  }
549
549
  }
@@ -566,7 +566,7 @@ function checkLinuxDCHPInterfaces(file) {
566
566
  result = result.concat(checkLinuxDCHPInterfaces(file));
567
567
  }
568
568
  });
569
- } catch (e) {
569
+ } catch {
570
570
  util.noop();
571
571
  }
572
572
  return result;
@@ -580,12 +580,12 @@ function getLinuxDHCPNics() {
580
580
  const lines = execSync(cmd, util.execOptsLinux).toString().split('\n');
581
581
  const nsections = splitSectionsNics(lines);
582
582
  result = parseLinuxDHCPNics(nsections);
583
- } catch (e) {
583
+ } catch {
584
584
  util.noop();
585
585
  }
586
586
  try {
587
587
  result = checkLinuxDCHPInterfaces('/etc/network/interfaces');
588
- } catch (e) {
588
+ } catch {
589
589
  util.noop();
590
590
  }
591
591
  return result;
@@ -632,7 +632,7 @@ function getLinuxIfaceDHCPstatus(iface, connectionName, DHCPNics) {
632
632
  break;
633
633
  }
634
634
  return result;
635
- } catch (e) {
635
+ } catch {
636
636
  return DHCPNics.indexOf(iface) >= 0;
637
637
  }
638
638
  } else {
@@ -648,7 +648,7 @@ function getDarwinIfaceDHCPstatus(iface) {
648
648
  if (lines.length && lines[0].startsWith('lease_time')) {
649
649
  result = true;
650
650
  }
651
- } catch (e) {
651
+ } catch {
652
652
  util.noop();
653
653
  }
654
654
  return result;
@@ -662,7 +662,7 @@ function getLinuxIfaceDNSsuffix(connectionName) {
662
662
  const resultFormat = result.replace(/\s+/g, ' ').trim();
663
663
  const dnsSuffix = resultFormat.split(' ').slice(1).toString();
664
664
  return dnsSuffix === '--' ? 'Not defined' : dnsSuffix;
665
- } catch (e) {
665
+ } catch {
666
666
  return 'Unknown';
667
667
  }
668
668
  } else {
@@ -679,7 +679,7 @@ function getLinuxIfaceIEEE8021xAuth(connectionName) {
679
679
  const authenticationProtocol = resultFormat.split(' ').slice(1).toString();
680
680
 
681
681
  return authenticationProtocol === '--' ? '' : authenticationProtocol;
682
- } catch (e) {
682
+ } catch {
683
683
  return 'Not defined';
684
684
  }
685
685
  } else {
@@ -785,16 +785,44 @@ function networkInterfaces(callback, rescan, defaultString) {
785
785
  nics = getDarwinNics();
786
786
 
787
787
  nics.forEach((nic) => {
788
+ let ip4link = '';
789
+ let ip4linksubnet = '';
790
+ let ip6link = '';
791
+ let ip6linksubnet = '';
792
+ nic.ip4 = '';
793
+ nic.ip6 = '';
788
794
  if ({}.hasOwnProperty.call(ifaces, nic.iface)) {
789
795
  ifaces[nic.iface].forEach((details) => {
790
796
  if (details.family === 'IPv4' || details.family === 4) {
791
- nic.ip4subnet = details.netmask;
797
+ if (!nic.ip4 && !nic.ip4.match(/^169.254/i)) {
798
+ nic.ip4 = details.address;
799
+ nic.ip4subnet = details.netmask;
800
+ }
801
+ if (nic.ip4.match(/^169.254/i)) {
802
+ ip4link = details.address;
803
+ ip4linksubnet = details.netmask;
804
+ }
792
805
  }
793
806
  if (details.family === 'IPv6' || details.family === 6) {
794
- nic.ip6subnet = details.netmask;
807
+ if (!nic.ip6 && !nic.ip6.match(/^fe80::/i)) {
808
+ nic.ip6 = details.address;
809
+ nic.ip6subnet = details.netmask;
810
+ }
811
+ if (nic.ip6.match(/^fe80::/i)) {
812
+ ip6link = details.address;
813
+ ip6linksubnet = details.netmask;
814
+ }
795
815
  }
796
816
  });
797
817
  }
818
+ if (!nic.ip4 && ip4link) {
819
+ nic.ip4 = ip4link;
820
+ nic.ip4subnet = ip4linksubnet;
821
+ }
822
+ if (!nic.ip6 && ip6link) {
823
+ nic.ip6 = ip6link;
824
+ nic.ip6subnet = ip6linksubnet;
825
+ }
798
826
 
799
827
  let ifaceSanitized = '';
800
828
  const s = util.isPrototypePolluted() ? '---' : util.sanitizeShellString(nic.iface);
@@ -872,18 +900,33 @@ function networkInterfaces(callback, rescan, defaultString) {
872
900
  let ieee8021xState = '';
873
901
  let type = '';
874
902
 
903
+ let ip4link = '';
904
+ let ip4linksubnet = '';
905
+ let ip6link = '';
906
+ let ip6linksubnet = '';
907
+
875
908
  if ({}.hasOwnProperty.call(ifaces, dev)) {
876
- let ifaceName = dev;
877
- ifaces[dev].forEach(function (details) {
909
+ const ifaceName = dev;
910
+ ifaces[dev].forEach((details) => {
878
911
  if (details.family === 'IPv4' || details.family === 4) {
879
- ip4 = details.address;
880
- ip4subnet = details.netmask;
912
+ if (!ip4 && !ip4.match(/^169.254/i)) {
913
+ ip4 = details.address;
914
+ ip4subnet = details.netmask;
915
+ }
916
+ if (ip4.match(/^169.254/i)) {
917
+ ip4link = details.address;
918
+ ip4linksubnet = details.netmask;
919
+ }
881
920
  }
882
921
  if (details.family === 'IPv6' || details.family === 6) {
883
- if (!ip6 || ip6.match(/^fe80::/i)) {
922
+ if (!ip6 && !ip6.match(/^fe80::/i)) {
884
923
  ip6 = details.address;
885
924
  ip6subnet = details.netmask;
886
925
  }
926
+ if (ip6.match(/^fe80::/i)) {
927
+ ip6link = details.address;
928
+ ip6linksubnet = details.netmask;
929
+ }
887
930
  }
888
931
  mac = details.mac;
889
932
  // fallback due to https://github.com/nodejs/node/issues/13581 (node 8.1 - node 8.2)
@@ -895,7 +938,15 @@ function networkInterfaces(callback, rescan, defaultString) {
895
938
  mac = _mac[dev] || '';
896
939
  }
897
940
  });
898
- let iface = dev.split(':')[0].trim().toLowerCase();
941
+ if (!ip4 && ip4link) {
942
+ ip4 = ip4link;
943
+ ip4subnet = ip4linksubnet;
944
+ }
945
+ if (!ip6 && ip6link) {
946
+ ip6 = ip6link;
947
+ ip6subnet = ip6linksubnet;
948
+ }
949
+ const iface = dev.split(':')[0].trim().toLowerCase();
899
950
  let ifaceSanitized = '';
900
951
  const s = util.isPrototypePolluted() ? '---' : util.sanitizeShellString(iface);
901
952
  const l = util.mathMin(s.length, 2000);
@@ -1234,7 +1285,7 @@ function networkStats(ifaces, callback) {
1234
1285
  ifaces.__proto__.substring = util.stringSubstring;
1235
1286
  ifaces.__proto__.trim = util.stringTrim;
1236
1287
  ifaces.__proto__.startsWith = util.stringStartWith;
1237
- } catch (e) {
1288
+ } catch {
1238
1289
  Object.setPrototypeOf(ifaces, util.stringObj);
1239
1290
  }
1240
1291
 
@@ -1551,7 +1602,7 @@ function networkConnections(callback) {
1551
1602
  cmd =
1552
1603
  'export LC_ALL=C; netstat -na | grep "ESTABLISHED\\|SYN_SENT\\|SYN_RECV\\|FIN_WAIT1\\|FIN_WAIT2\\|TIME_WAIT\\|CLOSE\\|CLOSE_WAIT\\|LAST_ACK\\|LISTEN\\|CLOSING\\|UNKNOWN"; unset LC_ALL';
1553
1604
  }
1554
- exec(cmd, { maxBuffer: 1024 * 20000 }, function (error, stdout) {
1605
+ exec(cmd, { maxBuffer: 1024 * 102400 }, function (error, stdout) {
1555
1606
  let lines = stdout.toString().split('\n');
1556
1607
  if (!error && (lines.length > 1 || lines[0] !== '')) {
1557
1608
  lines.forEach(function (line) {
@@ -1596,7 +1647,7 @@ function networkConnections(callback) {
1596
1647
  resolve(result);
1597
1648
  } else {
1598
1649
  cmd = 'ss -tunap | grep "ESTAB\\|SYN-SENT\\|SYN-RECV\\|FIN-WAIT1\\|FIN-WAIT2\\|TIME-WAIT\\|CLOSE\\|CLOSE-WAIT\\|LAST-ACK\\|LISTEN\\|CLOSING"';
1599
- exec(cmd, { maxBuffer: 1024 * 20000 }, function (error, stdout) {
1650
+ exec(cmd, { maxBuffer: 1024 * 102400 }, function (error, stdout) {
1600
1651
  if (!error) {
1601
1652
  let lines = stdout.toString().split('\n');
1602
1653
  lines.forEach(function (line) {
@@ -1660,9 +1711,9 @@ function networkConnections(callback) {
1660
1711
  if (_darwin) {
1661
1712
  let cmd = 'netstat -natvln | head -n2; netstat -natvln | grep "tcp4\\|tcp6\\|udp4\\|udp6"';
1662
1713
  const states = 'ESTABLISHED|SYN_SENT|SYN_RECV|FIN_WAIT1|FIN_WAIT_1|FIN_WAIT2|FIN_WAIT_2|TIME_WAIT|CLOSE|CLOSE_WAIT|LAST_ACK|LISTEN|CLOSING|UNKNOWN'.split('|');
1663
- exec(cmd, { maxBuffer: 1024 * 20000 }, function (error, stdout) {
1714
+ exec(cmd, { maxBuffer: 1024 * 102400 }, function (error, stdout) {
1664
1715
  if (!error) {
1665
- exec('ps -axo pid,command', { maxBuffer: 1024 * 20000 }, function (err2, stdout2) {
1716
+ exec('ps -axo pid,command', { maxBuffer: 1024 * 102400 }, function (err2, stdout2) {
1666
1717
  let processes = stdout2.toString().split('\n');
1667
1718
  processes = processes.map((line) => {
1668
1719
  return line.trim().replace(/ +/g, ' ');
@@ -1821,7 +1872,7 @@ function networkConnections(callback) {
1821
1872
  resolve(result);
1822
1873
  }
1823
1874
  });
1824
- } catch (e) {
1875
+ } catch {
1825
1876
  if (callback) {
1826
1877
  callback(result);
1827
1878
  }
@@ -1841,7 +1892,7 @@ function networkGatewayDefault(callback) {
1841
1892
  if (_linux || _freebsd || _openbsd || _netbsd) {
1842
1893
  let cmd = 'ip route get 1';
1843
1894
  try {
1844
- exec(cmd, { maxBuffer: 1024 * 20000 }, function (error, stdout) {
1895
+ exec(cmd, { maxBuffer: 1024 * 102400 }, function (error, stdout) {
1845
1896
  if (!error) {
1846
1897
  let lines = stdout.toString().split('\n');
1847
1898
  const line = lines && lines[0] ? lines[0] : '';
@@ -1861,7 +1912,7 @@ function networkGatewayDefault(callback) {
1861
1912
  resolve(result);
1862
1913
  }
1863
1914
  });
1864
- } catch (e) {
1915
+ } catch {
1865
1916
  if (callback) {
1866
1917
  callback(result);
1867
1918
  }
@@ -1871,7 +1922,7 @@ function networkGatewayDefault(callback) {
1871
1922
  if (_darwin) {
1872
1923
  let cmd = 'route -n get default';
1873
1924
  try {
1874
- exec(cmd, { maxBuffer: 1024 * 20000 }, function (error, stdout) {
1925
+ exec(cmd, { maxBuffer: 1024 * 102400 }, function (error, stdout) {
1875
1926
  if (!error) {
1876
1927
  const lines = stdout
1877
1928
  .toString()
@@ -1881,7 +1932,7 @@ function networkGatewayDefault(callback) {
1881
1932
  }
1882
1933
  if (!result) {
1883
1934
  cmd = "netstat -rn | awk '/default/ {print $2}'";
1884
- exec(cmd, { maxBuffer: 1024 * 20000 }, function (error, stdout) {
1935
+ exec(cmd, { maxBuffer: 1024 * 102400 }, function (error, stdout) {
1885
1936
  const lines = stdout
1886
1937
  .toString()
1887
1938
  .split('\n')
@@ -1901,7 +1952,7 @@ function networkGatewayDefault(callback) {
1901
1952
  resolve(result);
1902
1953
  }
1903
1954
  });
1904
- } catch (e) {
1955
+ } catch {
1905
1956
  if (callback) {
1906
1957
  callback(result);
1907
1958
  }
@@ -1953,7 +2004,7 @@ function networkGatewayDefault(callback) {
1953
2004
  resolve(result);
1954
2005
  }
1955
2006
  });
1956
- } catch (e) {
2007
+ } catch {
1957
2008
  if (callback) {
1958
2009
  callback(result);
1959
2010
  }