Skip to content

Commit

Permalink
dockerContainerStats() fixed parameter *
Browse files Browse the repository at this point in the history
  • Loading branch information
sebhildebrandt committed Feb 23, 2021
1 parent 0dedf36 commit 79f1511
Show file tree
Hide file tree
Showing 9 changed files with 74 additions and 43 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -72,6 +72,7 @@ For major (breaking) changes - **version 4, 3 and 2** - see end of page.

| Version | Date | Comment |
| -------------- | -------------- | -------- |
| 5.3.5 | 2020-02-23 | `dockerContainerStats()` fixed parameter * |
| 5.3.4 | 2020-02-20 | `sanitizeShellString()` optimized strict sanitation |
| 5.3.3 | 2020-02-15 | `dockerContainerStats()` fixed ID splitting |
| 5.3.2 | 2020-02-15 | `inetLatency()` `ineChecksite()` fixed possible security issue (file://) |
Expand Down
30 changes: 15 additions & 15 deletions docs/docker.html
Expand Up @@ -728,7 +728,7 @@ <h2>Container, Stats, Processes</h2>
</tr>
<tr>
<td></td>
<td>id</td>
<td>[0].id</td>
<td>X</td>
<td>X</td>
<td>X</td>
Expand All @@ -738,7 +738,7 @@ <h2>Container, Stats, Processes</h2>
</tr>
<tr>
<td></td>
<td>memUsage</td>
<td>[0].memUsage</td>
<td>X</td>
<td>X</td>
<td>X</td>
Expand All @@ -748,7 +748,7 @@ <h2>Container, Stats, Processes</h2>
</tr>
<tr>
<td></td>
<td>memLimit</td>
<td>[0].memLimit</td>
<td>X</td>
<td>X</td>
<td>X</td>
Expand All @@ -758,7 +758,7 @@ <h2>Container, Stats, Processes</h2>
</tr>
<tr>
<td></td>
<td>memPercent</td>
<td>[0].memPercent</td>
<td>X</td>
<td>X</td>
<td>X</td>
Expand All @@ -768,7 +768,7 @@ <h2>Container, Stats, Processes</h2>
</tr>
<tr>
<td></td>
<td>cpuPercent</td>
<td>[0].cpuPercent</td>
<td>X</td>
<td>X</td>
<td>X</td>
Expand All @@ -778,7 +778,7 @@ <h2>Container, Stats, Processes</h2>
</tr>
<tr>
<td></td>
<td>pids</td>
<td>[0].pids</td>
<td>X</td>
<td>X</td>
<td>X</td>
Expand All @@ -788,7 +788,7 @@ <h2>Container, Stats, Processes</h2>
</tr>
<tr>
<td></td>
<td>netIO.rx</td>
<td>[0].netIO.rx</td>
<td>X</td>
<td>X</td>
<td>X</td>
Expand All @@ -798,7 +798,7 @@ <h2>Container, Stats, Processes</h2>
</tr>
<tr>
<td></td>
<td>netIO.wx</td>
<td>[0].netIO.wx</td>
<td>X</td>
<td>X</td>
<td>X</td>
Expand All @@ -808,7 +808,7 @@ <h2>Container, Stats, Processes</h2>
</tr>
<tr>
<td></td>
<td>blockIO.r</td>
<td>[0].blockIO.r</td>
<td>X</td>
<td>X</td>
<td>X</td>
Expand All @@ -818,7 +818,7 @@ <h2>Container, Stats, Processes</h2>
</tr>
<tr>
<td></td>
<td>blockIO.w</td>
<td>[0].blockIO.w</td>
<td>X</td>
<td>X</td>
<td>X</td>
Expand All @@ -828,7 +828,7 @@ <h2>Container, Stats, Processes</h2>
</tr>
<tr>
<td></td>
<td>restartCount</td>
<td>[0].restartCount</td>
<td>X</td>
<td>X</td>
<td>X</td>
Expand All @@ -838,7 +838,7 @@ <h2>Container, Stats, Processes</h2>
</tr>
<tr>
<td></td>
<td>cpuStats</td>
<td>[0].cpuStats</td>
<td>X</td>
<td>X</td>
<td>X</td>
Expand All @@ -848,7 +848,7 @@ <h2>Container, Stats, Processes</h2>
</tr>
<tr>
<td></td>
<td>precpuStats</td>
<td>[0].precpuStats</td>
<td>X</td>
<td>X</td>
<td>X</td>
Expand All @@ -858,7 +858,7 @@ <h2>Container, Stats, Processes</h2>
</tr>
<tr>
<td></td>
<td>memoryStats</td>
<td>[0].memoryStats</td>
<td>X</td>
<td>X</td>
<td>X</td>
Expand All @@ -868,7 +868,7 @@ <h2>Container, Stats, Processes</h2>
</tr>
<tr>
<td></td>
<td>networks</td>
<td>[0].networks</td>
<td>X</td>
<td>X</td>
<td>X</td>
Expand Down
5 changes: 5 additions & 0 deletions docs/history.html
Expand Up @@ -56,6 +56,11 @@ <h3>Full version history</h3>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">5.3.5</th>
<td>2020-02-23</td>
<td><span class="code">dockerContainerStats()</span> fixed issue parameter *</td>
</tr>
<tr>
<th scope="row">5.3.4</th>
<td>2020-02-20</td>
Expand Down
2 changes: 1 addition & 1 deletion docs/index.html
Expand Up @@ -170,7 +170,7 @@
<img class="logo" src="assets/logo.png">
<div class="title">systeminformation</div>
<div class="subtitle"><span id="typed"></span>&nbsp;</div>
<div class="version">New Version: <span id="version">5.3.4</span></div>
<div class="version">New Version: <span id="version">5.3.5</span></div>
<button class="btn btn-light" onclick="location.href='https://github.com/sebhildebrandt/systeminformation'">View on Github <i class=" fab fa-github"></i></button>
</div>
<div class="down">
Expand Down
30 changes: 15 additions & 15 deletions docs/v4/docker.html
Expand Up @@ -727,7 +727,7 @@ <h2>Container, Stats, Processes</h2>
</tr>
<tr>
<td></td>
<td>id</td>
<td>[0].id</td>
<td>X</td>
<td>X</td>
<td>X</td>
Expand All @@ -737,7 +737,7 @@ <h2>Container, Stats, Processes</h2>
</tr>
<tr>
<td></td>
<td>mem_usage</td>
<td>[0].mem_usage</td>
<td>X</td>
<td>X</td>
<td>X</td>
Expand All @@ -747,7 +747,7 @@ <h2>Container, Stats, Processes</h2>
</tr>
<tr>
<td></td>
<td>mem_limit</td>
<td>[0].mem_limit</td>
<td>X</td>
<td>X</td>
<td>X</td>
Expand All @@ -757,7 +757,7 @@ <h2>Container, Stats, Processes</h2>
</tr>
<tr>
<td></td>
<td>mem_percent</td>
<td>[0].mem_percent</td>
<td>X</td>
<td>X</td>
<td>X</td>
Expand All @@ -767,7 +767,7 @@ <h2>Container, Stats, Processes</h2>
</tr>
<tr>
<td></td>
<td>cpu_percent</td>
<td>[0].cpu_percent</td>
<td>X</td>
<td>X</td>
<td>X</td>
Expand All @@ -777,7 +777,7 @@ <h2>Container, Stats, Processes</h2>
</tr>
<tr>
<td></td>
<td>pids</td>
<td>[0].pids</td>
<td>X</td>
<td>X</td>
<td>X</td>
Expand All @@ -787,7 +787,7 @@ <h2>Container, Stats, Processes</h2>
</tr>
<tr>
<td></td>
<td>netIO.rx</td>
<td>[0].netIO.rx</td>
<td>X</td>
<td>X</td>
<td>X</td>
Expand All @@ -797,7 +797,7 @@ <h2>Container, Stats, Processes</h2>
</tr>
<tr>
<td></td>
<td>netIO.wx</td>
<td>[0].netIO.wx</td>
<td>X</td>
<td>X</td>
<td>X</td>
Expand All @@ -807,7 +807,7 @@ <h2>Container, Stats, Processes</h2>
</tr>
<tr>
<td></td>
<td>blockIO.r</td>
<td>[0].blockIO.r</td>
<td>X</td>
<td>X</td>
<td>X</td>
Expand All @@ -817,7 +817,7 @@ <h2>Container, Stats, Processes</h2>
</tr>
<tr>
<td></td>
<td>blockIO.w</td>
<td>[0].blockIO.w</td>
<td>X</td>
<td>X</td>
<td>X</td>
Expand All @@ -827,7 +827,7 @@ <h2>Container, Stats, Processes</h2>
</tr>
<tr>
<td></td>
<td>restartCount</td>
<td>[0].restartCount</td>
<td>X</td>
<td>X</td>
<td>X</td>
Expand All @@ -837,7 +837,7 @@ <h2>Container, Stats, Processes</h2>
</tr>
<tr>
<td></td>
<td>cpu_stats</td>
<td>[0].cpu_stats</td>
<td>X</td>
<td>X</td>
<td>X</td>
Expand All @@ -847,7 +847,7 @@ <h2>Container, Stats, Processes</h2>
</tr>
<tr>
<td></td>
<td>percpu_stats</td>
<td>[0].percpu_stats</td>
<td>X</td>
<td>X</td>
<td>X</td>
Expand All @@ -857,7 +857,7 @@ <h2>Container, Stats, Processes</h2>
</tr>
<tr>
<td></td>
<td>memory_stats</td>
<td>[0].memory_stats</td>
<td>X</td>
<td>X</td>
<td>X</td>
Expand All @@ -867,7 +867,7 @@ <h2>Container, Stats, Processes</h2>
</tr>
<tr>
<td></td>
<td>networks</td>
<td>[0].networks</td>
<td>X</td>
<td>X</td>
<td>X</td>
Expand Down
15 changes: 15 additions & 0 deletions docs/v4/history.html
Expand Up @@ -83,6 +83,21 @@ <h3>Full version history</h3>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">4.34.15</th>
<td>2020-02-23</td>
<td><span class="code">dockerContainerStats()</span> fixed issue parameter *</td>
</tr>
<tr>
<th scope="row">4.34.14</th>
<td>2020-02-20</td>
<td><span class="code">sanitizeShellString()</span> optimized strict sanitation</td>
</tr>
<tr>
<th scope="row">4.34.13</th>
<td>2020-02-15</td>
<td><span class="code">dockerContainerStats()</span> fix correct ID splitting</td>
</tr>
<tr>
<th scope="row">4.34.12</th>
<td>2020-02-15</td>
Expand Down
2 changes: 1 addition & 1 deletion docs/v4/index.html
Expand Up @@ -170,7 +170,7 @@
<div class="title">systeminformation </div>
<div class="subtitle"><span id="typed"></span>&nbsp;</div>
<div class="version larger">Version 4 documentation</div>
<div class="version">Current Version: <span id="version">4.34.12</span></div>
<div class="version">Current Version: <span id="version">4.34.15</span></div>
<button class="btn btn-light" onclick="location.href='https://github.com/sebhildebrandt/systeminformation'">View on Github <i class=" fab fa-github"></i></button>
</div>
<div class="down">
Expand Down
28 changes: 19 additions & 9 deletions lib/docker.js
Expand Up @@ -350,13 +350,18 @@ function dockerContainerStats(containerIDs, callback) {
containerIDsSanitized.__proto__.replace = util.stringReplace;
containerIDsSanitized.__proto__.trim = util.stringTrim;

const s = (util.isPrototypePolluted() ? '' : util.sanitizeShellString(containerIDs, true)).trim();
for (let i = 0; i <= 2000; i++) {
if (!(s[i] === undefined)) {
s[i].__proto__.toLowerCase = util.stringToLower;
const sl = s[i].toLowerCase();
if (sl && sl[0] && !sl[1]) {
containerIDsSanitized = containerIDsSanitized + sl[0];
containerIDsSanitized = containerIDs;
containerIDsSanitized = containerIDsSanitized.trim();
if (containerIDsSanitized !== '*') {
containerIDsSanitized = '';
const s = (util.isPrototypePolluted() ? '' : util.sanitizeShellString(containerIDs, true)).trim();
for (let i = 0; i <= 2000; i++) {
if (!(s[i] === undefined)) {
s[i].__proto__.toLowerCase = util.stringToLower;
const sl = s[i].toLowerCase();
if (sl && sl[0] && !sl[1]) {
containerIDsSanitized = containerIDsSanitized + sl[0];
}
}
}
}
Expand All @@ -374,10 +379,15 @@ function dockerContainerStats(containerIDs, callback) {
for (let container of allContainers) {
containerArray.push(container.id);
}
dockerContainerStats(containerArray.join(',')).then(result => {
if (containerArray.length) {
dockerContainerStats(containerArray.join(',')).then(result => {
if (callback) { callback(result); }
resolve(result);
});
} else {
if (callback) { callback(result); }
resolve(result);
});
}
});
} else {
for (let containerID of containerArray) {
Expand Down
4 changes: 2 additions & 2 deletions test/si.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 79f1511

Please sign in to comment.