systeminformation 5.24.2 → 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/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.2",
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)",