systeminformation 5.24.2 → 5.24.4
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 +11 -3
- package/lib/internet.js +24 -4
- package/lib/network.js +11 -3
- package/lib/processes.js +23 -6
- package/lib/util.js +25 -7
- package/package.json +4 -2
package/lib/docker.js
CHANGED
|
@@ -453,9 +453,17 @@ function dockerContainerStats(containerIDs, callback) {
|
|
|
453
453
|
return resolve([]);
|
|
454
454
|
}
|
|
455
455
|
let containerIDsSanitized = '';
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
456
|
+
try {
|
|
457
|
+
containerIDsSanitized.__proto__.toLowerCase = util.stringToLower;
|
|
458
|
+
containerIDsSanitized.__proto__.replace = util.stringReplace;
|
|
459
|
+
containerIDsSanitized.__proto__.toString = util.stringToString;
|
|
460
|
+
containerIDsSanitized.__proto__.substr = util.stringSubstr;
|
|
461
|
+
containerIDsSanitized.__proto__.substring = util.stringSubstring;
|
|
462
|
+
containerIDsSanitized.__proto__.trim = util.stringTrim;
|
|
463
|
+
containerIDsSanitized.__proto__.startsWith = util.stringStartWith;
|
|
464
|
+
} catch (e) {
|
|
465
|
+
Object.setPrototypeOf(containerIDsSanitized, util.stringObj);
|
|
466
|
+
}
|
|
459
467
|
|
|
460
468
|
containerIDsSanitized = containerIDs;
|
|
461
469
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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,17 @@ function networkStats(ifaces, callback) {
|
|
|
1174
1174
|
}
|
|
1175
1175
|
ifaces = ifaces || getDefaultNetworkInterface();
|
|
1176
1176
|
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1177
|
+
try {
|
|
1178
|
+
ifaces.__proto__.toLowerCase = util.stringToLower;
|
|
1179
|
+
ifaces.__proto__.replace = util.stringReplace;
|
|
1180
|
+
ifaces.__proto__.toString = util.stringToString;
|
|
1181
|
+
ifaces.__proto__.substr = util.stringSubstr;
|
|
1182
|
+
ifaces.__proto__.substring = util.stringSubstring;
|
|
1183
|
+
ifaces.__proto__.trim = util.stringTrim;
|
|
1184
|
+
ifaces.__proto__.startsWith = util.stringStartWith;
|
|
1185
|
+
} catch (e) {
|
|
1186
|
+
Object.setPrototypeOf(ifaces, util.stringObj);
|
|
1187
|
+
}
|
|
1180
1188
|
|
|
1181
1189
|
ifaces = ifaces.trim().toLowerCase().replace(/,+/g, '|');
|
|
1182
1190
|
ifacesArray = ifaces.split('|');
|
package/lib/processes.js
CHANGED
|
@@ -126,9 +126,17 @@ function services(srv, callback) {
|
|
|
126
126
|
|
|
127
127
|
if (srv) {
|
|
128
128
|
let srvString = '';
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
129
|
+
try {
|
|
130
|
+
srvString.__proto__.toLowerCase = util.stringToLower;
|
|
131
|
+
srvString.__proto__.replace = util.stringReplace;
|
|
132
|
+
srvString.__proto__.toString = util.stringToString;
|
|
133
|
+
srvString.__proto__.substr = util.stringSubstr;
|
|
134
|
+
srvString.__proto__.substring = util.stringSubstring;
|
|
135
|
+
srvString.__proto__.trim = util.stringTrim;
|
|
136
|
+
srvString.__proto__.startsWith = util.stringStartWith;
|
|
137
|
+
} catch (e) {
|
|
138
|
+
Object.setPrototypeOf(srvString, util.stringObj);
|
|
139
|
+
}
|
|
132
140
|
|
|
133
141
|
const s = util.sanitizeShellString(srv);
|
|
134
142
|
const l = util.mathMin(s.length, 2000);
|
|
@@ -982,9 +990,18 @@ function processLoad(proc, callback) {
|
|
|
982
990
|
}
|
|
983
991
|
|
|
984
992
|
let processesString = '';
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
993
|
+
try {
|
|
994
|
+
processesString.__proto__.toLowerCase = util.stringToLower;
|
|
995
|
+
processesString.__proto__.replace = util.stringReplace;
|
|
996
|
+
processesString.__proto__.toString = util.stringToString;
|
|
997
|
+
processesString.__proto__.substr = util.stringSubstr;
|
|
998
|
+
processesString.__proto__.substring = util.stringSubstring;
|
|
999
|
+
processesString.__proto__.trim = util.stringTrim;
|
|
1000
|
+
processesString.__proto__.startsWith = util.stringStartWith;
|
|
1001
|
+
|
|
1002
|
+
} catch (e) {
|
|
1003
|
+
Object.setPrototypeOf(processesString, util.stringObj);
|
|
1004
|
+
}
|
|
988
1005
|
|
|
989
1006
|
const s = util.sanitizeShellString(proc);
|
|
990
1007
|
const l = util.mathMin(s.length, 2000);
|
package/lib/util.js
CHANGED
|
@@ -84,10 +84,12 @@ 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;
|
|
90
91
|
const stringSubstr = new String().substr;
|
|
92
|
+
const stringSubstring = new String().substring;
|
|
91
93
|
const stringTrim = new String().trim;
|
|
92
94
|
const stringStartWith = new String().startsWith;
|
|
93
95
|
const mathMin = Math.min;
|
|
@@ -758,11 +760,17 @@ function isPrototypePolluted() {
|
|
|
758
760
|
let notPolluted = true;
|
|
759
761
|
let st = '';
|
|
760
762
|
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
763
|
+
try {
|
|
764
|
+
st.__proto__.replace = stringReplace;
|
|
765
|
+
st.__proto__.toLowerCase = stringToLower;
|
|
766
|
+
st.__proto__.toString = stringToString;
|
|
767
|
+
st.__proto__.substr = stringSubstr;
|
|
768
|
+
st.__proto__.substring = stringSubstring;
|
|
769
|
+
st.__proto__.trim = stringTrim;
|
|
770
|
+
st.__proto__.startsWith = stringStartWith;
|
|
771
|
+
} catch (e) {
|
|
772
|
+
Object.setPrototypeOf(st, stringObj);
|
|
773
|
+
}
|
|
766
774
|
notPolluted = notPolluted || (s.length !== 62);
|
|
767
775
|
const ms = Date.now();
|
|
768
776
|
if (typeof ms === 'number' && ms > 1600000000000) {
|
|
@@ -782,7 +790,11 @@ function isPrototypePolluted() {
|
|
|
782
790
|
// string manipulation
|
|
783
791
|
let p = Math.random() * l * 0.9999999999;
|
|
784
792
|
let stm = st.substr(0, p) + ' ' + st.substr(p, 2000);
|
|
785
|
-
|
|
793
|
+
try {
|
|
794
|
+
stm.__proto__.replace = stringReplace;
|
|
795
|
+
} catch (e) {
|
|
796
|
+
Object.setPrototypeOf(stm, stringObj);
|
|
797
|
+
}
|
|
786
798
|
let sto = stm.replace(/ /g, '');
|
|
787
799
|
notPolluted = notPolluted && st === sto;
|
|
788
800
|
p = Math.random() * l * 0.9999999999;
|
|
@@ -803,7 +815,11 @@ function isPrototypePolluted() {
|
|
|
803
815
|
notPolluted = notPolluted && (stl.length === l) && stl[l - 1] && !(stl[l]);
|
|
804
816
|
for (let i = 0; i < l; i++) {
|
|
805
817
|
const s1 = st[i];
|
|
806
|
-
|
|
818
|
+
try {
|
|
819
|
+
s1.__proto__.toLowerCase = stringToLower;
|
|
820
|
+
} catch (e) {
|
|
821
|
+
Object.setPrototypeOf(st, stringObj);
|
|
822
|
+
}
|
|
807
823
|
const s2 = stl ? stl[i] : '';
|
|
808
824
|
const s1l = s1.toLowerCase();
|
|
809
825
|
notPolluted = notPolluted && s1l[0] === s2 && s1l[0] && !(s1l[1]);
|
|
@@ -2561,10 +2577,12 @@ exports.smartMonToolsInstalled = smartMonToolsInstalled;
|
|
|
2561
2577
|
exports.linuxVersion = linuxVersion;
|
|
2562
2578
|
exports.plistParser = plistParser;
|
|
2563
2579
|
exports.plistReader = plistReader;
|
|
2580
|
+
exports.stringObj = stringObj;
|
|
2564
2581
|
exports.stringReplace = stringReplace;
|
|
2565
2582
|
exports.stringToLower = stringToLower;
|
|
2566
2583
|
exports.stringToString = stringToString;
|
|
2567
2584
|
exports.stringSubstr = stringSubstr;
|
|
2585
|
+
exports.stringSubstring = stringSubstring;
|
|
2568
2586
|
exports.stringTrim = stringTrim;
|
|
2569
2587
|
exports.stringStartWith = stringStartWith;
|
|
2570
2588
|
exports.mathMin = mathMin;
|
package/package.json
CHANGED
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "systeminformation",
|
|
3
|
-
"version": "5.24.
|
|
3
|
+
"version": "5.24.4",
|
|
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)",
|
|
7
7
|
"homepage": "https://systeminformation.io",
|
|
8
8
|
"main": "./lib/index.js",
|
|
9
|
+
"type": "commonjs",
|
|
9
10
|
"bin": {
|
|
10
11
|
"systeminformation": "lib/cli.js"
|
|
11
12
|
},
|
|
12
13
|
"types": "./lib/index.d.ts",
|
|
13
14
|
"scripts": {
|
|
14
|
-
"test": "node ./test/test.js"
|
|
15
|
+
"test": "node ./test/test.js",
|
|
16
|
+
"testDeno": "deno run -A ./test/test.js"
|
|
15
17
|
},
|
|
16
18
|
"files": [
|
|
17
19
|
"lib/"
|