diff --git a/CHANGELOG.md b/CHANGELOG.md index 16fb471..6e4c0e9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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://) | diff --git a/docs/docker.html b/docs/docker.html index f46834c..3c6dabd 100644 --- a/docs/docker.html +++ b/docs/docker.html @@ -728,7 +728,7 @@ - id + [0].id X X X @@ -738,7 +738,7 @@ - memUsage + [0].memUsage X X X @@ -748,7 +748,7 @@ - memLimit + [0].memLimit X X X @@ -758,7 +758,7 @@ - memPercent + [0].memPercent X X X @@ -768,7 +768,7 @@ - cpuPercent + [0].cpuPercent X X X @@ -778,7 +778,7 @@ - pids + [0].pids X X X @@ -788,7 +788,7 @@ - netIO.rx + [0].netIO.rx X X X @@ -798,7 +798,7 @@ - netIO.wx + [0].netIO.wx X X X @@ -808,7 +808,7 @@ - blockIO.r + [0].blockIO.r X X X @@ -818,7 +818,7 @@ - blockIO.w + [0].blockIO.w X X X @@ -828,7 +828,7 @@ - restartCount + [0].restartCount X X X @@ -838,7 +838,7 @@ - cpuStats + [0].cpuStats X X X @@ -848,7 +848,7 @@ - precpuStats + [0].precpuStats X X X @@ -858,7 +858,7 @@ - memoryStats + [0].memoryStats X X X @@ -868,7 +868,7 @@ - networks + [0].networks X X X diff --git a/docs/history.html b/docs/history.html index dcefb17..8840d75 100644 --- a/docs/history.html +++ b/docs/history.html @@ -56,6 +56,11 @@ + + 5.3.5 + 2020-02-23 + dockerContainerStats() fixed issue parameter * + 5.3.4 2020-02-20 diff --git a/docs/index.html b/docs/index.html index 45391f6..fdf6984 100644 --- a/docs/index.html +++ b/docs/index.html @@ -170,7 +170,7 @@
systeminformation
 
-
New Version: 5.3.4
+
New Version: 5.3.5
diff --git a/docs/v4/docker.html b/docs/v4/docker.html index 30e41d9..be2bb75 100644 --- a/docs/v4/docker.html +++ b/docs/v4/docker.html @@ -727,7 +727,7 @@ - id + [0].id X X X @@ -737,7 +737,7 @@ - mem_usage + [0].mem_usage X X X @@ -747,7 +747,7 @@ - mem_limit + [0].mem_limit X X X @@ -757,7 +757,7 @@ - mem_percent + [0].mem_percent X X X @@ -767,7 +767,7 @@ - cpu_percent + [0].cpu_percent X X X @@ -777,7 +777,7 @@ - pids + [0].pids X X X @@ -787,7 +787,7 @@ - netIO.rx + [0].netIO.rx X X X @@ -797,7 +797,7 @@ - netIO.wx + [0].netIO.wx X X X @@ -807,7 +807,7 @@ - blockIO.r + [0].blockIO.r X X X @@ -817,7 +817,7 @@ - blockIO.w + [0].blockIO.w X X X @@ -827,7 +827,7 @@ - restartCount + [0].restartCount X X X @@ -837,7 +837,7 @@ - cpu_stats + [0].cpu_stats X X X @@ -847,7 +847,7 @@ - percpu_stats + [0].percpu_stats X X X @@ -857,7 +857,7 @@ - memory_stats + [0].memory_stats X X X @@ -867,7 +867,7 @@ - networks + [0].networks X X X diff --git a/docs/v4/history.html b/docs/v4/history.html index a933e98..14962b5 100644 --- a/docs/v4/history.html +++ b/docs/v4/history.html @@ -83,6 +83,21 @@ + + 4.34.15 + 2020-02-23 + dockerContainerStats() fixed issue parameter * + + + 4.34.14 + 2020-02-20 + sanitizeShellString() optimized strict sanitation + + + 4.34.13 + 2020-02-15 + dockerContainerStats() fix correct ID splitting + 4.34.12 2020-02-15 diff --git a/docs/v4/index.html b/docs/v4/index.html index 6423484..a7fe94a 100644 --- a/docs/v4/index.html +++ b/docs/v4/index.html @@ -170,7 +170,7 @@
systeminformation
 
Version 4 documentation
-
Current Version: 4.34.12
+
Current Version: 4.34.15
diff --git a/lib/docker.js b/lib/docker.js index 1c2854e..68f235a 100644 --- a/lib/docker.js +++ b/lib/docker.js @@ -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]; + } } } } @@ -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) { diff --git a/test/si.js b/test/si.js index c1e85fe..e8f8375 100644 --- a/test/si.js +++ b/test/si.js @@ -50,8 +50,8 @@ function test(f) { else if (f === '5') { si.networkConnections().then(data => { if (data !== null) { resolve({ data, title: 'NET Connections' }); } else { resolve('not_supported'); } }); } else if (f === '6') { si.dockerInfo().then(data => { if (data !== null) { resolve({ data, title: 'Docker Info' }); } else { resolve('not_supported'); } }); } else if (f === '7') { si.dockerContainers(true).then(data => { if (data !== null) { resolve({ data, title: 'Docker Containers' }); } else { resolve('not_supported'); } }); } - else if (f === '8') { si.dockerContainerStats('1').then(data => { if (data !== null) { resolve({ data, title: 'Docker Cont Stats' }); } else { resolve('not_supported'); } }); } - else if (f === '9') { si.dockerContainerProcesses('1').then(data => { if (data !== null) { resolve({ data, title: 'Docker Cont Processes' }); } else { resolve('not_supported'); } }); } + else if (f === '8') { si.dockerContainerStats('*').then(data => { if (data !== null) { resolve({ data, title: 'Docker Cont Stats' }); } else { resolve('not_supported'); } }); } + else if (f === '9') { si.dockerContainerProcesses('*').then(data => { if (data !== null) { resolve({ data, title: 'Docker Cont Processes' }); } else { resolve('not_supported'); } }); } else if (f === '0') { si.dockerAll().then(data => { if (data !== null) { resolve({ data, title: 'Docker All' }); } else { resolve('not_supported'); } }); } else if (f === ',') { si.getStaticData().then(data => { if (data !== null) { resolve({ data, title: 'All Static Data' }); } else { resolve('not_supported'); } }); } else if (f === '.') { si.getDynamicData('apache2, postgres, wsearch').then(data => { if (data !== null) { resolve({ data, title: 'All Dynamic Data' }); } else { resolve('not_supported'); } }); }