systeminformation 5.33.19 → 5.33.21

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/filesystem.js CHANGED
@@ -919,7 +919,7 @@ function fsStats(callback) {
919
919
  if ((_fs_speed && !_fs_speed.ms) || (_fs_speed && _fs_speed.ms && Date.now() - _fs_speed.ms >= 500)) {
920
920
  if (_linux) {
921
921
  // exec("df -k | grep /dev/", function(error, stdout) {
922
- const procLsblk = exec('lsblk -r 2>/dev/null | grep /', { maxBuffer: 1024 * 1024 }, (error, stdout) => {
922
+ const procLsblk = exec('lsblk -rno KNAME,FSTYPE,MOUNTPOINT 2>/dev/null | grep -E "/| zfs_member( |$)" | grep -vE "^zd[0-9]+"', { maxBuffer: 1024 * 1024 }, (error, stdout) => {
923
923
  if (!error) {
924
924
  const lines = stdout.toString().split('\n');
925
925
  const fs_filter = [];
@@ -933,15 +933,17 @@ function fsStats(callback) {
933
933
  }
934
934
  });
935
935
 
936
- const output = fs_filter.join('|');
937
- const procCat = exec('cat /proc/diskstats | egrep "' + output + '"', { maxBuffer: 1024 * 1024 }, (error, stdout) => {
936
+ const procCat = exec('cat /proc/diskstats', { maxBuffer: 1024 * 1024 }, (error, stdout) => {
938
937
  if (!error) {
939
938
  const lines = stdout.toString().split('\n');
940
939
  lines.forEach((line) => {
941
940
  line = line.trim();
942
941
  if (line !== '') {
943
942
  line = line.replace(/ +/g, ' ').split(' ');
944
-
943
+ // exact device name match (column 3)
944
+ if (fs_filter.indexOf(line[2]) === -1) {
945
+ return;
946
+ }
945
947
  rx += parseInt(line[5], 10) * 512;
946
948
  wx += parseInt(line[9], 10) * 512;
947
949
  }
@@ -1128,7 +1130,7 @@ function disksIO(callback) {
1128
1130
  // var cmd = "for mount in `lsblk | grep / | sed -r 's/│ └─//' | cut -d ' ' -f 1`; do cat /sys/block/$mount/stat | sed -r 's/ +/;/g' | sed -r 's/^;//'; done";
1129
1131
  // var cmd = "for mount in `lsblk | grep / | sed 's/[│└─├]//g' | awk '{$1=$1};1' | cut -d ' ' -f 1 | sort -u`; do cat /sys/block/$mount/stat | sed -r 's/ +/;/g' | sed -r 's/^;//'; done";
1130
1132
  const cmd =
1131
- 'for mount in `lsblk 2>/dev/null | grep " disk " | sed "s/[│└─├]//g" | awk \'{$1=$1};1\' | cut -d " " -f 1 | sort -u`; do cat /sys/block/$mount/stat | sed -r "s/ +/;/g" | sed -r "s/^;//"; done';
1133
+ 'for mount in `lsblk 2>/dev/null | grep " disk " | sed "s/[│└─├]//g" | awk \'{$1=$1};1\' | grep -vE "^(zd|nbd|fd|zram)[0-9]+ " | cut -d " " -f 1 | sort -u`; do cat /sys/block/$mount/stat | sed -r "s/ +/;/g" | sed -r "s/^;//"; done';
1132
1134
 
1133
1135
  exec(cmd, { maxBuffer: 1024 * 1024 }, (error, stdout) => {
1134
1136
  if (!error) {
package/lib/network.js CHANGED
@@ -140,9 +140,10 @@ function getMacAddresses() {
140
140
  if (_linux || _freebsd || _openbsd || _netbsd) {
141
141
  if (typeof pathToIp === 'undefined') {
142
142
  try {
143
- const lines = execSync('which ip', util.execOptsLinux).toString().split('\n');
144
- if (lines.length && lines[0].indexOf(':') === -1 && lines[0].indexOf('/') === 0) {
145
- pathToIp = lines[0];
143
+ const ipPath = execSync('which ip', util.execOptsLinux).toString().split('\n')[0].trim();
144
+ // path is interpolated into a shell command - allow only safe characters
145
+ if (/^\/[A-Za-z0-9/_.+-]+$/.test(ipPath)) {
146
+ pathToIp = ipPath;
146
147
  } else {
147
148
  pathToIp = '';
148
149
  }
@@ -157,7 +158,7 @@ function getMacAddresses() {
157
158
  for (let i = 0; i < lines.length; i++) {
158
159
  if (lines[i] && lines[i][0] !== ' ') {
159
160
  if (pathToIp) {
160
- const nextline = lines[i + 1].trim().split(' ');
161
+ const nextline = (lines[i + 1] || '').trim().split(' ');
161
162
  if (nextline[0] === 'link/ether') {
162
163
  iface = lines[i].split(' ')[1];
163
164
  iface = iface.slice(0, iface.length - 1);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "systeminformation",
3
- "version": "5.33.19",
3
+ "version": "5.33.21",
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)",