systeminformation 5.21.6 → 5.21.8

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/battery.js CHANGED
@@ -127,6 +127,7 @@ module.exports = function (callback) {
127
127
  const energy = parseInt('0' + util.getValue(lines, 'POWER_SUPPLY_ENERGY_NOW', '='), 10);
128
128
  const power = parseInt('0' + util.getValue(lines, 'POWER_SUPPLY_POWER_NOW', '='), 10);
129
129
  const current = parseInt('0' + util.getValue(lines, 'POWER_SUPPLY_CURRENT_NOW', '='), 10);
130
+ const charge = parseInt('0' + util.getValue(lines, 'POWER_SUPPLY_CHARGE_NOW', '='), 10);
130
131
 
131
132
  result.percent = parseInt('0' + percent, 10);
132
133
  if (result.maxCapacity && result.currentCapacity) {
@@ -140,6 +141,8 @@ module.exports = function (callback) {
140
141
  }
141
142
  if (energy && power) {
142
143
  result.timeRemaining = Math.floor(energy / power * 60);
144
+ } else if (current && charge) {
145
+ result.timeRemaining = Math.floor(charge / current * 60);
143
146
  } else if (current && result.currentCapacity) {
144
147
  result.timeRemaining = Math.floor(result.currentCapacity / current * 60);
145
148
  }
package/lib/util.js CHANGED
@@ -709,6 +709,7 @@ function sanitizeShellString(str, strict) {
709
709
  (strict && s[i] === '@') ||
710
710
  (strict && s[i] === ' ') ||
711
711
  (strict && s[i] == '{') ||
712
+ (strict && s[i] == ';') ||
712
713
  (strict && s[i] == ')'))) {
713
714
  result = result + s[i];
714
715
  }
package/lib/wifi.js CHANGED
@@ -401,7 +401,15 @@ function wifiNetworks(callback) {
401
401
  }
402
402
  });
403
403
  if (iface) {
404
- const res = getWifiNetworkListIw(iface);
404
+ let ifaceSanitized = '';
405
+ const s = util.isPrototypePolluted() ? '---' : util.sanitizeShellString(iface, true);
406
+ for (let i = 0; i <= util.mathMin(s.length, 2000); i++) {
407
+ if (s[i] !== undefined) {
408
+ ifaceSanitized = ifaceSanitized + s[i];
409
+ }
410
+ }
411
+
412
+ const res = getWifiNetworkListIw(ifaceSanitized);
405
413
  if (res === -1) {
406
414
  // try again after 4 secs
407
415
  setTimeout(function (iface) {
@@ -529,11 +537,27 @@ function wifiConnections(callback) {
529
537
  const ifaces = ifaceListLinux();
530
538
  const networkList = getWifiNetworkListNmi();
531
539
  ifaces.forEach(ifaceDetail => {
532
- const nmiDetails = nmiDeviceLinux(ifaceDetail.iface);
533
- const wpaDetails = wpaConnectionLinux(ifaceDetail.iface);
540
+ let ifaceSanitized = '';
541
+ const s = util.isPrototypePolluted() ? '---' : util.sanitizeShellString(ifaceDetail.iface, true);
542
+ for (let i = 0; i <= util.mathMin(s.length, 2000); i++) {
543
+ if (s[i] !== undefined) {
544
+ ifaceSanitized = ifaceSanitized + s[i];
545
+ }
546
+ }
547
+
548
+ const nmiDetails = nmiDeviceLinux(ifaceSanitized);
549
+ const wpaDetails = wpaConnectionLinux(ifaceSanitized);
534
550
  const ssid = nmiDetails.ssid || wpaDetails.ssid;
535
551
  const network = networkList.filter(nw => nw.ssid === ssid);
536
- const nmiConnection = nmiConnectionLinux(ssid);
552
+ let ssidSanitized = '';
553
+ const t = util.isPrototypePolluted() ? '---' : util.sanitizeShellString(ssid, true);
554
+ for (let i = 0; i <= util.mathMin(t.length, 2000); i++) {
555
+ if (t[i] !== undefined) {
556
+ ssidSanitized = ssidSanitized + t[i];
557
+ }
558
+ }
559
+
560
+ const nmiConnection = nmiConnectionLinux(ssidSanitized);
537
561
  const channel = network && network.length && network[0].channel ? network[0].channel : (wpaDetails.channel ? wpaDetails.channel : null);
538
562
  const bssid = network && network.length && network[0].bssid ? network[0].bssid : (wpaDetails.bssid ? wpaDetails.bssid : null);
539
563
  if (ssid && bssid) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "systeminformation",
3
- "version": "5.21.6",
3
+ "version": "5.21.8",
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)",