systeminformation 5.24.1 → 5.24.3

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/docker.js CHANGED
@@ -453,9 +453,13 @@ function dockerContainerStats(containerIDs, callback) {
453
453
  return resolve([]);
454
454
  }
455
455
  let containerIDsSanitized = '';
456
- containerIDsSanitized.__proto__.toLowerCase = util.stringToLower;
457
- containerIDsSanitized.__proto__.replace = util.stringReplace;
458
- containerIDsSanitized.__proto__.trim = util.stringTrim;
456
+ try {
457
+ containerIDsSanitized.__proto__.toLowerCase = util.stringToLower;
458
+ containerIDsSanitized.__proto__.replace = util.stringReplace;
459
+ containerIDsSanitized.__proto__.trim = util.stringTrim;
460
+ } catch (e) {
461
+ Object.setPrototypeOf(containerIDsSanitized, util.stringObj);
462
+ }
459
463
 
460
464
  containerIDsSanitized = containerIDs;
461
465
  containerIDsSanitized = containerIDsSanitized.trim();
package/lib/internet.js CHANGED
@@ -47,7 +47,12 @@ function inetChecksite(url, callback) {
47
47
  const l = util.mathMin(s.length, 2000);
48
48
  for (let i = 0; i <= l; i++) {
49
49
  if (s[i] !== undefined) {
50
- s[i].__proto__.toLowerCase = util.stringToLower;
50
+ try {
51
+ s[i].__proto__.toLowerCase = util.stringToLower;
52
+ } catch (e) {
53
+ Object.setPrototypeOf(s[i], util.stringObj);
54
+ }
55
+
51
56
  const sl = s[i].toLowerCase();
52
57
  if (sl && sl[0] && !sl[1] && sl[0].length === 1) {
53
58
  urlSanitized = urlSanitized + sl[0];
@@ -57,7 +62,12 @@ function inetChecksite(url, callback) {
57
62
  result.url = urlSanitized;
58
63
  try {
59
64
  if (urlSanitized && !util.isPrototypePolluted()) {
60
- urlSanitized.__proto__.startsWith = util.stringStartWith;
65
+ try {
66
+ urlSanitized.__proto__.startsWith = util.stringStartWith;
67
+ } catch (e) {
68
+ Object.setPrototypeOf(urlSanitized, util.stringObj);
69
+ }
70
+
61
71
  if (urlSanitized.startsWith('file:') || urlSanitized.startsWith('gopher:') || urlSanitized.startsWith('telnet:') || urlSanitized.startsWith('mailto:') || urlSanitized.startsWith('news:') || urlSanitized.startsWith('nntp:')) {
62
72
  if (callback) { callback(result); }
63
73
  return resolve(result);
@@ -108,14 +118,24 @@ function inetLatency(host, callback) {
108
118
  const l = util.mathMin(s.length, 2000);
109
119
  for (let i = 0; i <= l; i++) {
110
120
  if (!(s[i] === undefined)) {
111
- s[i].__proto__.toLowerCase = util.stringToLower;
121
+ try {
122
+ s[i].__proto__.toLowerCase = util.stringToLower;
123
+ } catch (e) {
124
+ Object.setPrototypeOf(s[i], util.stringObj);
125
+ }
126
+
112
127
  const sl = s[i].toLowerCase();
113
128
  if (sl && sl[0] && !sl[1]) {
114
129
  hostSanitized = hostSanitized + sl[0];
115
130
  }
116
131
  }
117
132
  }
118
- hostSanitized.__proto__.startsWith = util.stringStartWith;
133
+ try {
134
+ hostSanitized.__proto__.startsWith = util.stringStartWith;
135
+ } catch (e) {
136
+ Object.setPrototypeOf(hostSanitized, util.stringObj);
137
+ }
138
+
119
139
  if (hostSanitized.startsWith('file:') || hostSanitized.startsWith('gopher:') || hostSanitized.startsWith('telnet:') || hostSanitized.startsWith('mailto:') || hostSanitized.startsWith('news:') || hostSanitized.startsWith('nntp:')) {
120
140
  if (callback) { callback(null); }
121
141
  return resolve(null);
package/lib/network.js CHANGED
@@ -1174,9 +1174,13 @@ function networkStats(ifaces, callback) {
1174
1174
  }
1175
1175
  ifaces = ifaces || getDefaultNetworkInterface();
1176
1176
 
1177
- ifaces.__proto__.toLowerCase = util.stringToLower;
1178
- ifaces.__proto__.replace = util.stringReplace;
1179
- ifaces.__proto__.trim = util.stringTrim;
1177
+ try {
1178
+ ifaces.__proto__.toLowerCase = util.stringToLower;
1179
+ ifaces.__proto__.replace = util.stringReplace;
1180
+ ifaces.__proto__.trim = util.stringTrim;
1181
+ } catch (e) {
1182
+ Object.setPrototypeOf(ifaces, util.stringObj);
1183
+ }
1180
1184
 
1181
1185
  ifaces = ifaces.trim().toLowerCase().replace(/,+/g, '|');
1182
1186
  ifacesArray = ifaces.split('|');
package/lib/osinfo.js CHANGED
@@ -328,23 +328,23 @@ function osInfo(callback) {
328
328
  result.build = util.getValue(lines, 'BuildVersion');
329
329
  result.logofile = getLogoFile(result.distro);
330
330
  result.codename = 'macOS';
331
- result.codename = (result.release.indexOf('10.4') > -1 ? 'Mac OS X Tiger' : result.codename);
332
- result.codename = (result.release.indexOf('10.5') > -1 ? 'Mac OS X Leopard' : result.codename);
333
- result.codename = (result.release.indexOf('10.6') > -1 ? 'Mac OS X Snow Leopard' : result.codename);
334
- result.codename = (result.release.indexOf('10.7') > -1 ? 'Mac OS X Lion' : result.codename);
331
+ result.codename = (result.release.indexOf('10.4') > -1 ? 'OS X Tiger' : result.codename);
332
+ result.codename = (result.release.indexOf('10.5') > -1 ? 'OS X Leopard' : result.codename);
333
+ result.codename = (result.release.indexOf('10.6') > -1 ? 'OS X Snow Leopard' : result.codename);
334
+ result.codename = (result.release.indexOf('10.7') > -1 ? 'OS X Lion' : result.codename);
335
335
  result.codename = (result.release.indexOf('10.8') > -1 ? 'OS X Mountain Lion' : result.codename);
336
336
  result.codename = (result.release.indexOf('10.9') > -1 ? 'OS X Mavericks' : result.codename);
337
337
  result.codename = (result.release.indexOf('10.10') > -1 ? 'OS X Yosemite' : result.codename);
338
338
  result.codename = (result.release.indexOf('10.11') > -1 ? 'OS X El Capitan' : result.codename);
339
- result.codename = (result.release.indexOf('10.12') > -1 ? 'macOS Sierra' : result.codename);
340
- result.codename = (result.release.indexOf('10.13') > -1 ? 'macOS High Sierra' : result.codename);
341
- result.codename = (result.release.indexOf('10.14') > -1 ? 'macOS Mojave' : result.codename);
342
- result.codename = (result.release.indexOf('10.15') > -1 ? 'macOS Catalina' : result.codename);
343
- result.codename = (result.release.startsWith('11.') ? 'macOS Big Sur' : result.codename);
344
- result.codename = (result.release.startsWith('12.') ? 'macOS Monterey' : result.codename);
345
- result.codename = (result.release.startsWith('13.') ? 'macOS Ventura' : result.codename);
346
- result.codename = (result.release.startsWith('14.') ? 'macOS Sonoma' : result.codename);
347
- result.codename = (result.release.startsWith('15.') ? 'macOS Sequoia' : result.codename);
339
+ result.codename = (result.release.indexOf('10.12') > -1 ? 'Sierra' : result.codename);
340
+ result.codename = (result.release.indexOf('10.13') > -1 ? 'High Sierra' : result.codename);
341
+ result.codename = (result.release.indexOf('10.14') > -1 ? 'Mojave' : result.codename);
342
+ result.codename = (result.release.indexOf('10.15') > -1 ? 'Catalina' : result.codename);
343
+ result.codename = (result.release.startsWith('11.') ? 'Big Sur' : result.codename);
344
+ result.codename = (result.release.startsWith('12.') ? 'Monterey' : result.codename);
345
+ result.codename = (result.release.startsWith('13.') ? 'Ventura' : result.codename);
346
+ result.codename = (result.release.startsWith('14.') ? 'Sonoma' : result.codename);
347
+ result.codename = (result.release.startsWith('15.') ? 'Sequoia' : result.codename);
348
348
  result.uefi = true;
349
349
  result.codepage = util.getCodepage();
350
350
  if (callback) {
@@ -467,7 +467,7 @@ function versions(apps, callback) {
467
467
  mongodb: '',
468
468
  mysql: '',
469
469
  nginx: '',
470
- node: process.versions.node,
470
+ node: '', //process.versions.node,
471
471
  npm: '',
472
472
  openssl: '',
473
473
  perl: '',
@@ -799,6 +799,13 @@ function versions(apps, callback) {
799
799
  if (!error) {
800
800
  const postgresql = stdout.toString().split('\n')[0].split(' ') || [];
801
801
  appsObj.versions.postgresql = postgresql.length ? postgresql[postgresql.length - 1] : '';
802
+ } else {
803
+ exec('pg_config --version', function (error, stdout) {
804
+ if (!error) {
805
+ const postgresql = stdout.toString().split('\n')[0].split(' ') || [];
806
+ appsObj.versions.postgresql = postgresql.length ? postgresql[postgresql.length - 1] : '';
807
+ }
808
+ });
802
809
  }
803
810
  functionProcessed();
804
811
  });
@@ -1050,6 +1057,16 @@ function versions(apps, callback) {
1050
1057
  functionProcessed();
1051
1058
  });
1052
1059
  }
1060
+ if ({}.hasOwnProperty.call(appsObj.versions, 'node')) {
1061
+ exec('node -v', function (error, stdout) {
1062
+ if (!error) {
1063
+ let line = stdout.toString().split('\n')[0].trim();
1064
+ if (line.startsWith('v')) { line = line.slice(1); }
1065
+ appsObj.versions.node = line;
1066
+ }
1067
+ functionProcessed();
1068
+ });
1069
+ }
1053
1070
  if ({}.hasOwnProperty.call(appsObj.versions, 'powershell')) {
1054
1071
  if (_windows) {
1055
1072
  util.powerShell('$PSVersionTable').then(stdout => {
package/lib/processes.js CHANGED
@@ -126,9 +126,13 @@ function services(srv, callback) {
126
126
 
127
127
  if (srv) {
128
128
  let srvString = '';
129
- srvString.__proto__.toLowerCase = util.stringToLower;
130
- srvString.__proto__.replace = util.stringReplace;
131
- srvString.__proto__.trim = util.stringTrim;
129
+ try {
130
+ srvString.__proto__.toLowerCase = util.stringToLower;
131
+ srvString.__proto__.replace = util.stringReplace;
132
+ srvString.__proto__.trim = util.stringTrim;
133
+ } catch (e) {
134
+ Object.setPrototypeOf(srvString, util.stringObj);
135
+ }
132
136
 
133
137
  const s = util.sanitizeShellString(srv);
134
138
  const l = util.mathMin(s.length, 2000);
@@ -982,9 +986,13 @@ function processLoad(proc, callback) {
982
986
  }
983
987
 
984
988
  let processesString = '';
985
- processesString.__proto__.toLowerCase = util.stringToLower;
986
- processesString.__proto__.replace = util.stringReplace;
987
- processesString.__proto__.trim = util.stringTrim;
989
+ try {
990
+ processesString.__proto__.toLowerCase = util.stringToLower;
991
+ processesString.__proto__.replace = util.stringReplace;
992
+ processesString.__proto__.trim = util.stringTrim;
993
+ } catch (e) {
994
+ Object.setPrototypeOf(processesString, util.stringObj);
995
+ }
988
996
 
989
997
  const s = util.sanitizeShellString(proc);
990
998
  const l = util.mathMin(s.length, 2000);
package/lib/util.js CHANGED
@@ -84,6 +84,7 @@ function splitByNumber(str) {
84
84
  return [cpart, num];
85
85
  }
86
86
 
87
+ const stringObj = new String();
87
88
  const stringReplace = new String().replace;
88
89
  const stringToLower = new String().toLowerCase;
89
90
  const stringToString = new String().toString;
@@ -758,11 +759,14 @@ function isPrototypePolluted() {
758
759
  let notPolluted = true;
759
760
  let st = '';
760
761
 
761
- st.__proto__.replace = stringReplace;
762
- st.__proto__.toLowerCase = stringToLower;
763
- st.__proto__.toString = stringToString;
764
- st.__proto__.substr = stringSubstr;
765
-
762
+ try {
763
+ st.__proto__.replace = stringReplace;
764
+ st.__proto__.toLowerCase = stringToLower;
765
+ st.__proto__.toString = stringToString;
766
+ st.__proto__.substr = stringSubstr;
767
+ } catch (e) {
768
+ Object.setPrototypeOf(st, stringObj);
769
+ }
766
770
  notPolluted = notPolluted || (s.length !== 62);
767
771
  const ms = Date.now();
768
772
  if (typeof ms === 'number' && ms > 1600000000000) {
@@ -782,7 +786,11 @@ function isPrototypePolluted() {
782
786
  // string manipulation
783
787
  let p = Math.random() * l * 0.9999999999;
784
788
  let stm = st.substr(0, p) + ' ' + st.substr(p, 2000);
785
- stm.__proto__.replace = stringReplace;
789
+ try {
790
+ stm.__proto__.replace = stringReplace;
791
+ } catch (e) {
792
+ Object.setPrototypeOf(stm, stringObj);
793
+ }
786
794
  let sto = stm.replace(/ /g, '');
787
795
  notPolluted = notPolluted && st === sto;
788
796
  p = Math.random() * l * 0.9999999999;
@@ -803,7 +811,11 @@ function isPrototypePolluted() {
803
811
  notPolluted = notPolluted && (stl.length === l) && stl[l - 1] && !(stl[l]);
804
812
  for (let i = 0; i < l; i++) {
805
813
  const s1 = st[i];
806
- s1.__proto__.toLowerCase = stringToLower;
814
+ try {
815
+ s1.__proto__.toLowerCase = stringToLower;
816
+ } catch (e) {
817
+ Object.setPrototypeOf(st, stringObj);
818
+ }
807
819
  const s2 = stl ? stl[i] : '';
808
820
  const s1l = s1.toLowerCase();
809
821
  notPolluted = notPolluted && s1l[0] === s2 && s1l[0] && !(s1l[1]);
@@ -2561,6 +2573,7 @@ exports.smartMonToolsInstalled = smartMonToolsInstalled;
2561
2573
  exports.linuxVersion = linuxVersion;
2562
2574
  exports.plistParser = plistParser;
2563
2575
  exports.plistReader = plistReader;
2576
+ exports.stringObj = stringObj;
2564
2577
  exports.stringReplace = stringReplace;
2565
2578
  exports.stringToLower = stringToLower;
2566
2579
  exports.stringToString = stringToString;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "systeminformation",
3
- "version": "5.24.1",
3
+ "version": "5.24.3",
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)",