chore: updated copyright year
This commit is contained in:
parent
74b91ed4ad
commit
95ed380879
2
LICENSE
2
LICENSE
@ -1,6 +1,6 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014-2025 Sebastian Hildebrandt
|
||||
Copyright (c) 2014-2026 Sebastian Hildebrandt
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
|
||||
@ -1177,7 +1177,7 @@ All other trademarks are the property of their respective owners.
|
||||
|
||||
> The [`MIT`][license-url] License (MIT)
|
||||
>
|
||||
> Copyright © 2014-2025 Sebastian Hildebrandt,
|
||||
> Copyright © 2014-2026 Sebastian Hildebrandt,
|
||||
> [+innovations](http://www.plus-innovations.com).
|
||||
>
|
||||
> Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
|
||||
@ -262,7 +262,7 @@ si.audio().then(data => console.log(data));</code></pre>
|
||||
<li><a href="trademarks.html">Trademarks</a></li>
|
||||
<li> </li>
|
||||
<li><a href="copyright.html">Copyright & License <img src="https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square" alt="MIT license" /></a></li>
|
||||
<li><a href="https://www.plus-innovations.com">© 2025 Sebastian Hildebrandt</a></li>
|
||||
<li><a href="https://www.plus-innovations.com">© 2026 Sebastian Hildebrandt</a></li>
|
||||
<li><a href="https://www.plus-innovations.com">+innovations GmbH</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
@ -308,7 +308,7 @@ si.battery().then(data => console.log(data));</code></pre>
|
||||
<li><a href="trademarks.html">Trademarks</a></li>
|
||||
<li> </li>
|
||||
<li><a href="copyright.html">Copyright & License <img src="https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square" alt="MIT license" /></a></li>
|
||||
<li><a href="https://www.plus-innovations.com">© 2025 Sebastian Hildebrandt</a></li>
|
||||
<li><a href="https://www.plus-innovations.com">© 2026 Sebastian Hildebrandt</a></li>
|
||||
<li><a href="https://www.plus-innovations.com">+innovations GmbH</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
@ -226,7 +226,7 @@ si.bluetoothDevices().then(data => console.log(data));</code></pre>
|
||||
<li><a href="trademarks.html">Trademarks</a></li>
|
||||
<li> </li>
|
||||
<li><a href="copyright.html">Copyright & License <img src="https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square" alt="MIT license" /></a></li>
|
||||
<li><a href="https://www.plus-innovations.com">© 2025 Sebastian Hildebrandt</a></li>
|
||||
<li><a href="https://www.plus-innovations.com">© 2026 Sebastian Hildebrandt</a></li>
|
||||
<li><a href="https://www.plus-innovations.com">+innovations GmbH</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
@ -271,7 +271,7 @@
|
||||
<li><a href="trademarks.html">Trademarks</a></li>
|
||||
<li> </li>
|
||||
<li><a href="copyright.html">Copyright & License <img src="https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square" alt="MIT license" /></a></li>
|
||||
<li><a href="https://www.plus-innovations.com">© 2025 Sebastian Hildebrandt</a></li>
|
||||
<li><a href="https://www.plus-innovations.com">© 2026 Sebastian Hildebrandt</a></li>
|
||||
<li><a href="https://www.plus-innovations.com">+innovations GmbH</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
@ -110,7 +110,7 @@
|
||||
<li><a href="trademarks.html">Trademarks</a></li>
|
||||
<li> </li>
|
||||
<li><a href="copyright.html">Copyright & License <img src="https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square" alt="MIT license" /></a></li>
|
||||
<li><a href="https://www.plus-innovations.com">© 2025 Sebastian Hildebrandt</a></li>
|
||||
<li><a href="https://www.plus-innovations.com">© 2026 Sebastian Hildebrandt</a></li>
|
||||
<li><a href="https://www.plus-innovations.com">+innovations GmbH</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
@ -122,7 +122,7 @@
|
||||
<li><a href="trademarks.html">Trademarks</a></li>
|
||||
<li> </li>
|
||||
<li><a href="copyright.html">Copyright & License <img src="https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square" alt="MIT license" /></a></li>
|
||||
<li><a href="https://www.plus-innovations.com">© 2025 Sebastian Hildebrandt</a></li>
|
||||
<li><a href="https://www.plus-innovations.com">© 2026 Sebastian Hildebrandt</a></li>
|
||||
<li><a href="https://www.plus-innovations.com">+innovations GmbH</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
@ -646,7 +646,7 @@ si.cpuTemperature().then(data => console.log(data));</code></pre>
|
||||
<li><a href="trademarks.html">Trademarks</a></li>
|
||||
<li> </li>
|
||||
<li><a href="copyright.html">Copyright & License <img src="https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square" alt="MIT license" /></a></li>
|
||||
<li><a href="https://www.plus-innovations.com">© 2025 Sebastian Hildebrandt</a></li>
|
||||
<li><a href="https://www.plus-innovations.com">© 2026 Sebastian Hildebrandt</a></li>
|
||||
<li><a href="https://www.plus-innovations.com">+innovations GmbH</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
@ -1346,7 +1346,7 @@
|
||||
<li><a href="trademarks.html">Trademarks</a></li>
|
||||
<li> </li>
|
||||
<li><a href="copyright.html">Copyright & License <img src="https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square" alt="MIT license" /></a></li>
|
||||
<li><a href="https://www.plus-innovations.com">© 2025 Sebastian Hildebrandt</a></li>
|
||||
<li><a href="https://www.plus-innovations.com">© 2026 Sebastian Hildebrandt</a></li>
|
||||
<li><a href="https://www.plus-innovations.com">+innovations GmbH</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
@ -1001,7 +1001,7 @@ setInterval(function() {
|
||||
<li><a href="trademarks.html">Trademarks</a></li>
|
||||
<li> </li>
|
||||
<li><a href="copyright.html">Copyright & License <img src="https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square" alt="MIT license" /></a></li>
|
||||
<li><a href="https://www.plus-innovations.com">© 2025 Sebastian Hildebrandt</a></li>
|
||||
<li><a href="https://www.plus-innovations.com">© 2026 Sebastian Hildebrandt</a></li>
|
||||
<li><a href="https://www.plus-innovations.com">+innovations GmbH</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
@ -401,7 +401,7 @@ si.get(valueObject).then(data => console.log(data));</code></pre>
|
||||
<li><a href="trademarks.html">Trademarks</a></li>
|
||||
<li> </li>
|
||||
<li><a href="copyright.html">Copyright & License <img src="https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square" alt="MIT license" /></a></li>
|
||||
<li><a href="https://www.plus-innovations.com">© 2025 Sebastian Hildebrandt</a></li>
|
||||
<li><a href="https://www.plus-innovations.com">© 2026 Sebastian Hildebrandt</a></li>
|
||||
<li><a href="https://www.plus-innovations.com">+innovations GmbH</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
@ -168,7 +168,7 @@ async function cpuData() {
|
||||
<li><a href="trademarks.html">Trademarks</a></li>
|
||||
<li> </li>
|
||||
<li><a href="copyright.html">Copyright & License <img src="https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square" alt="MIT license" /></a></li>
|
||||
<li><a href="https://www.plus-innovations.com">© 2025 Sebastian Hildebrandt</a></li>
|
||||
<li><a href="https://www.plus-innovations.com">© 2026 Sebastian Hildebrandt</a></li>
|
||||
<li><a href="https://www.plus-innovations.com">+innovations GmbH</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
@ -647,7 +647,7 @@ si.graphics().then(data => console.log(data));</code></pre>
|
||||
<li><a href="trademarks.html">Trademarks</a></li>
|
||||
<li> </li>
|
||||
<li><a href="copyright.html">Copyright & License <img src="https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square" alt="MIT license" /></a></li>
|
||||
<li><a href="https://www.plus-innovations.com">© 2025 Sebastian Hildebrandt</a></li>
|
||||
<li><a href="https://www.plus-innovations.com">© 2026 Sebastian Hildebrandt</a></li>
|
||||
<li><a href="https://www.plus-innovations.com">+innovations GmbH</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
@ -3677,7 +3677,7 @@
|
||||
<li><a href="trademarks.html">Trademarks</a></li>
|
||||
<li> </li>
|
||||
<li><a href="copyright.html">Copyright & License <img src="https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square" alt="MIT license" /></a></li>
|
||||
<li><a href="https://www.plus-innovations.com">© 2025 Sebastian Hildebrandt</a></li>
|
||||
<li><a href="https://www.plus-innovations.com">© 2026 Sebastian Hildebrandt</a></li>
|
||||
<li><a href="https://www.plus-innovations.com">+innovations GmbH</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
@ -384,7 +384,7 @@
|
||||
<li><a href="trademarks.html">Trademarks</a></li>
|
||||
<li> </li>
|
||||
<li><a href="copyright.html">Copyright & License <img src="https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square" alt="MIT license" /></a></li>
|
||||
<li><a href="https://www.plus-innovations.com">© 2025 Sebastian Hildebrandt</a></li>
|
||||
<li><a href="https://www.plus-innovations.com">© 2026 Sebastian Hildebrandt</a></li>
|
||||
<li><a href="https://www.plus-innovations.com">+innovations GmbH</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
@ -126,7 +126,7 @@
|
||||
<li><a href="trademarks.html">Trademarks</a></li>
|
||||
<li> </li>
|
||||
<li><a href="copyright.html">Copyright & License <img src="https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square" alt="MIT license" /></a></li>
|
||||
<li><a href="https://www.plus-innovations.com">© 2025 Sebastian Hildebrandt</a></li>
|
||||
<li><a href="https://www.plus-innovations.com">© 2026 Sebastian Hildebrandt</a></li>
|
||||
<li><a href="https://www.plus-innovations.com">+innovations GmbH</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
@ -461,7 +461,7 @@ si.memLayout().then(data => console.log(data));</code></pre>
|
||||
<li><a href="trademarks.html">Trademarks</a></li>
|
||||
<li> </li>
|
||||
<li><a href="copyright.html">Copyright & License <img src="https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square" alt="MIT license" /></a></li>
|
||||
<li><a href="https://www.plus-innovations.com">© 2025 Sebastian Hildebrandt</a></li>
|
||||
<li><a href="https://www.plus-innovations.com">© 2026 Sebastian Hildebrandt</a></li>
|
||||
<li><a href="https://www.plus-innovations.com">+innovations GmbH</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
@ -848,7 +848,7 @@ setInterval(function() {
|
||||
<li><a href="trademarks.html">Trademarks</a></li>
|
||||
<li> </li>
|
||||
<li><a href="copyright.html">Copyright & License <img src="https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square" alt="MIT license" /></a></li>
|
||||
<li><a href="https://www.plus-innovations.com">© 2025 Sebastian Hildebrandt</a></li>
|
||||
<li><a href="https://www.plus-innovations.com">© 2026 Sebastian Hildebrandt</a></li>
|
||||
<li><a href="https://www.plus-innovations.com">+innovations GmbH</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
@ -853,7 +853,7 @@ si.users().then(data => console.log(data));</code></pre>
|
||||
<li><a href="trademarks.html">Trademarks</a></li>
|
||||
<li> </li>
|
||||
<li><a href="copyright.html">Copyright & License <img src="https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square" alt="MIT license" /></a></li>
|
||||
<li><a href="https://www.plus-innovations.com">© 2025 Sebastian Hildebrandt</a></li>
|
||||
<li><a href="https://www.plus-innovations.com">© 2026 Sebastian Hildebrandt</a></li>
|
||||
<li><a href="https://www.plus-innovations.com">+innovations GmbH</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
@ -239,7 +239,7 @@ si.printer().then(data => console.log(data));</code></pre>
|
||||
<li><a href="trademarks.html">Trademarks</a></li>
|
||||
<li> </li>
|
||||
<li><a href="copyright.html">Copyright & License <img src="https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square" alt="MIT license" /></a></li>
|
||||
<li><a href="https://www.plus-innovations.com">© 2025 Sebastian Hildebrandt</a></li>
|
||||
<li><a href="https://www.plus-innovations.com">© 2026 Sebastian Hildebrandt</a></li>
|
||||
<li><a href="https://www.plus-innovations.com">+innovations GmbH</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
@ -781,7 +781,7 @@ si.services('mysql, postgres').then(data => console.log(data));</code></pre>
|
||||
<li><a href="trademarks.html">Trademarks</a></li>
|
||||
<li> </li>
|
||||
<li><a href="copyright.html">Copyright & License <img src="https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square" alt="MIT license" /></a></li>
|
||||
<li><a href="https://www.plus-innovations.com">© 2025 Sebastian Hildebrandt</a></li>
|
||||
<li><a href="https://www.plus-innovations.com">© 2026 Sebastian Hildebrandt</a></li>
|
||||
<li><a href="https://www.plus-innovations.com">+innovations GmbH</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
@ -289,7 +289,7 @@
|
||||
<li><a href="trademarks.html">Trademarks</a></li>
|
||||
<li> </li>
|
||||
<li><a href="copyright.html">Copyright & License <img src="https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square" alt="MIT license" /></a></li>
|
||||
<li><a href="https://www.plus-innovations.com">© 2025 Sebastian Hildebrandt</a></li>
|
||||
<li><a href="https://www.plus-innovations.com">© 2026 Sebastian Hildebrandt</a></li>
|
||||
<li><a href="https://www.plus-innovations.com">+innovations GmbH</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
@ -157,7 +157,7 @@ setTimeout(() => {
|
||||
<li><a href="trademarks.html">Trademarks</a></li>
|
||||
<li> </li>
|
||||
<li><a href="copyright.html">Copyright & License <img src="https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square" alt="MIT license" /></a></li>
|
||||
<li><a href="https://www.plus-innovations.com">© 2025 Sebastian Hildebrandt</a></li>
|
||||
<li><a href="https://www.plus-innovations.com">© 2026 Sebastian Hildebrandt</a></li>
|
||||
<li><a href="https://www.plus-innovations.com">+innovations GmbH</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
@ -587,7 +587,7 @@ si.chassis().then(data => console.log(data));</code></pre>
|
||||
<li><a href="trademarks.html">Trademarks</a></li>
|
||||
<li> </li>
|
||||
<li><a href="copyright.html">Copyright & License <img src="https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square" alt="MIT license" /></a></li>
|
||||
<li><a href="https://www.plus-innovations.com">© 2025 Sebastian Hildebrandt</a></li>
|
||||
<li><a href="https://www.plus-innovations.com">© 2026 Sebastian Hildebrandt</a></li>
|
||||
<li><a href="https://www.plus-innovations.com">+innovations GmbH</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
@ -142,7 +142,7 @@
|
||||
<li><a href="trademarks.html">Trademarks</a></li>
|
||||
<li> </li>
|
||||
<li><a href="copyright.html">Copyright & License <img src="https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square" alt="MIT license" /></a></li>
|
||||
<li><a href="https://www.plus-innovations.com">© 2025 Sebastian Hildebrandt</a></li>
|
||||
<li><a href="https://www.plus-innovations.com">© 2026 Sebastian Hildebrandt</a></li>
|
||||
<li><a href="https://www.plus-innovations.com">+innovations GmbH</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
@ -119,7 +119,7 @@
|
||||
<li><a href="trademarks.html">Trademarks</a></li>
|
||||
<li> </li>
|
||||
<li><a href="copyright.html">Copyright & License <img src="https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square" alt="MIT license" /></a></li>
|
||||
<li><a href="https://www.plus-innovations.com">© 2025 Sebastian Hildebrandt</a></li>
|
||||
<li><a href="https://www.plus-innovations.com">© 2026 Sebastian Hildebrandt</a></li>
|
||||
<li><a href="https://www.plus-innovations.com">+innovations GmbH</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
@ -274,7 +274,7 @@ si.usb().then(data => console.log(data));</code></pre>
|
||||
<li><a href="trademarks.html">Trademarks</a></li>
|
||||
<li> </li>
|
||||
<li><a href="copyright.html">Copyright & License <img src="https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square" alt="MIT license" /></a></li>
|
||||
<li><a href="https://www.plus-innovations.com">© 2025 Sebastian Hildebrandt</a></li>
|
||||
<li><a href="https://www.plus-innovations.com">© 2026 Sebastian Hildebrandt</a></li>
|
||||
<li><a href="https://www.plus-innovations.com">+innovations GmbH</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
@ -291,7 +291,7 @@ si.battery().then(data => console.log(data));</code></pre>
|
||||
</div>
|
||||
<div class="col-lg-4 col-12">
|
||||
<ul class="list-unstyled">
|
||||
<li><a href="https://www.plus-innovations.com">© 2025 Sebastian Hildebrandt, +innovations</a></li>
|
||||
<li><a href="https://www.plus-innovations.com">© 2026 Sebastian Hildebrandt, +innovations</a></li>
|
||||
<li><a href="copyright.html">Copyright & License</a></li>
|
||||
<li><a href="trademarks.html">Trademarks</a></li>
|
||||
<li> </li>
|
||||
|
||||
@ -100,7 +100,7 @@
|
||||
</div>
|
||||
<div class="col-lg-4 col-12">
|
||||
<ul class="list-unstyled">
|
||||
<li><a href="https://www.plus-innovations.com">© 2025 Sebastian Hildebrandt, +innovations</a></li>
|
||||
<li><a href="https://www.plus-innovations.com">© 2026 Sebastian Hildebrandt, +innovations</a></li>
|
||||
<li><a href="copyright.html">Copyright & License</a></li>
|
||||
<li><a href="trademarks.html">Trademarks</a></li>
|
||||
<li> </li>
|
||||
|
||||
@ -94,7 +94,7 @@
|
||||
</div>
|
||||
<div class="col-lg-4 col-12">
|
||||
<ul class="list-unstyled">
|
||||
<li><a href="https://www.plus-innovations.com">© 2025 Sebastian Hildebrandt, +innovations</a></li>
|
||||
<li><a href="https://www.plus-innovations.com">© 2026 Sebastian Hildebrandt, +innovations</a></li>
|
||||
<li><a href="copyright.html">Copyright & License</a></li>
|
||||
<li><a href="trademarks.html">Trademarks</a></li>
|
||||
<li> </li>
|
||||
|
||||
@ -588,7 +588,7 @@ si.cpuTemperature().then(data => console.log(data));</code></pre>
|
||||
</div>
|
||||
<div class="col-lg-4 col-12">
|
||||
<ul class="list-unstyled">
|
||||
<li><a href="https://www.plus-innovations.com">© 2025 Sebastian Hildebrandt, +innovations</a></li>
|
||||
<li><a href="https://www.plus-innovations.com">© 2026 Sebastian Hildebrandt, +innovations</a></li>
|
||||
<li><a href="copyright.html">Copyright & License</a></li>
|
||||
<li><a href="trademarks.html">Trademarks</a></li>
|
||||
<li> </li>
|
||||
|
||||
@ -1068,7 +1068,7 @@
|
||||
</div>
|
||||
<div class="col-lg-4 col-12">
|
||||
<ul class="list-unstyled">
|
||||
<li><a href="https://www.plus-innovations.com">© 2025 Sebastian Hildebrandt, +innovations</a></li>
|
||||
<li><a href="https://www.plus-innovations.com">© 2026 Sebastian Hildebrandt, +innovations</a></li>
|
||||
<li><a href="copyright.html">Copyright & License</a></li>
|
||||
<li><a href="trademarks.html">Trademarks</a></li>
|
||||
<li> </li>
|
||||
|
||||
@ -881,7 +881,7 @@ setInterval(function() {
|
||||
</div>
|
||||
<div class="col-lg-4 col-12">
|
||||
<ul class="list-unstyled">
|
||||
<li><a href="https://www.plus-innovations.com">© 2025 Sebastian Hildebrandt, +innovations</a></li>
|
||||
<li><a href="https://www.plus-innovations.com">© 2026 Sebastian Hildebrandt, +innovations</a></li>
|
||||
<li><a href="copyright.html">Copyright & License</a></li>
|
||||
<li><a href="trademarks.html">Trademarks</a></li>
|
||||
<li> </li>
|
||||
|
||||
@ -340,7 +340,7 @@ si.get(valueObject).then(data => console.log(data));</code></pre>
|
||||
</div>
|
||||
<div class="col-lg-4 col-12">
|
||||
<ul class="list-unstyled">
|
||||
<li><a href="https://www.plus-innovations.com">© 2025 Sebastian Hildebrandt, +innovations</a></li>
|
||||
<li><a href="https://www.plus-innovations.com">© 2026 Sebastian Hildebrandt, +innovations</a></li>
|
||||
<li><a href="copyright.html">Copyright & License</a></li>
|
||||
<li><a href="trademarks.html">Trademarks</a></li>
|
||||
<li> </li>
|
||||
|
||||
@ -161,7 +161,7 @@ async function cpuData() {
|
||||
</div>
|
||||
<div class="col-lg-4 col-12">
|
||||
<ul class="list-unstyled">
|
||||
<li><a href="https://www.plus-innovations.com">© 2025 Sebastian Hildebrandt, +innovations</a></li>
|
||||
<li><a href="https://www.plus-innovations.com">© 2026 Sebastian Hildebrandt, +innovations</a></li>
|
||||
<li><a href="copyright.html">Copyright & License</a></li>
|
||||
<li><a href="trademarks.html">Trademarks</a></li>
|
||||
<li> </li>
|
||||
|
||||
@ -537,7 +537,7 @@ si.graphics().then(data => console.log(data));</code></pre>
|
||||
</div>
|
||||
<div class="col-lg-4 col-12">
|
||||
<ul class="list-unstyled">
|
||||
<li><a href="https://www.plus-innovations.com">© 2025 Sebastian Hildebrandt, +innovations</a></li>
|
||||
<li><a href="https://www.plus-innovations.com">© 2026 Sebastian Hildebrandt, +innovations</a></li>
|
||||
<li><a href="copyright.html">Copyright & License</a></li>
|
||||
<li><a href="trademarks.html">Trademarks</a></li>
|
||||
<li> </li>
|
||||
|
||||
@ -2133,7 +2133,7 @@
|
||||
</div>
|
||||
<div class="col-lg-4 col-12">
|
||||
<ul class="list-unstyled">
|
||||
<li><a href="https://www.plus-innovations.com">© 2025 Sebastian Hildebrandt, +innovations</a></li>
|
||||
<li><a href="https://www.plus-innovations.com">© 2026 Sebastian Hildebrandt, +innovations</a></li>
|
||||
<li><a href="copyright.html">Copyright & License</a></li>
|
||||
<li><a href="trademarks.html">Trademarks</a></li>
|
||||
<li> </li>
|
||||
|
||||
@ -348,7 +348,7 @@
|
||||
</div>
|
||||
<div class="col-lg-4 col-12">
|
||||
<ul class="list-unstyled">
|
||||
<li><a href="https://www.plus-innovations.com">© 2025 Sebastian Hildebrandt, +innovations</a></li>
|
||||
<li><a href="https://www.plus-innovations.com">© 2026 Sebastian Hildebrandt, +innovations</a></li>
|
||||
<li><a href="copyright.html">Copyright & License</a></li>
|
||||
<li><a href="trademarks.html">Trademarks</a></li>
|
||||
<li> </li>
|
||||
|
||||
@ -114,7 +114,7 @@
|
||||
</div>
|
||||
<div class="col-lg-4 col-12">
|
||||
<ul class="list-unstyled">
|
||||
<li><a href="https://www.plus-innovations.com">© 2025 Sebastian Hildebrandt, +innovations</a></li>
|
||||
<li><a href="https://www.plus-innovations.com">© 2026 Sebastian Hildebrandt, +innovations</a></li>
|
||||
<li><a href="copyright.html">Copyright & License</a></li>
|
||||
<li><a href="trademarks.html">Trademarks</a></li>
|
||||
<li> </li>
|
||||
|
||||
@ -410,7 +410,7 @@ si.memLayout().then(data => console.log(data));</code></pre>
|
||||
</div>
|
||||
<div class="col-lg-4 col-12">
|
||||
<ul class="list-unstyled">
|
||||
<li><a href="https://www.plus-innovations.com">© 2025 Sebastian Hildebrandt, +innovations</a></li>
|
||||
<li><a href="https://www.plus-innovations.com">© 2026 Sebastian Hildebrandt, +innovations</a></li>
|
||||
<li><a href="copyright.html">Copyright & License</a></li>
|
||||
<li><a href="trademarks.html">Trademarks</a></li>
|
||||
<li> </li>
|
||||
|
||||
@ -802,7 +802,7 @@ setInterval(function() {
|
||||
</div>
|
||||
<div class="col-lg-4 col-12">
|
||||
<ul class="list-unstyled">
|
||||
<li><a href="https://www.plus-innovations.com">© 2025 Sebastian Hildebrandt, +innovations</a></li>
|
||||
<li><a href="https://www.plus-innovations.com">© 2026 Sebastian Hildebrandt, +innovations</a></li>
|
||||
<li><a href="copyright.html">Copyright & License</a></li>
|
||||
<li><a href="trademarks.html">Trademarks</a></li>
|
||||
<li> </li>
|
||||
|
||||
@ -740,7 +740,7 @@ si.users().then(data => console.log(data));</code></pre>
|
||||
</div>
|
||||
<div class="col-lg-4 col-12">
|
||||
<ul class="list-unstyled">
|
||||
<li><a href="https://www.plus-innovations.com">© 2025 Sebastian Hildebrandt, +innovations</a></li>
|
||||
<li><a href="https://www.plus-innovations.com">© 2026 Sebastian Hildebrandt, +innovations</a></li>
|
||||
<li><a href="copyright.html">Copyright & License</a></li>
|
||||
<li><a href="trademarks.html">Trademarks</a></li>
|
||||
<li> </li>
|
||||
|
||||
@ -737,7 +737,7 @@ si.services('mysql, postgres').then(data => console.log(data));</code></pre>
|
||||
</div>
|
||||
<div class="col-lg-4 col-12">
|
||||
<ul class="list-unstyled">
|
||||
<li><a href="https://www.plus-innovations.com">© 2025 Sebastian Hildebrandt, +innovations</a></li>
|
||||
<li><a href="https://www.plus-innovations.com">© 2026 Sebastian Hildebrandt, +innovations</a></li>
|
||||
<li><a href="copyright.html">Copyright & License</a></li>
|
||||
<li><a href="trademarks.html">Trademarks</a></li>
|
||||
<li> </li>
|
||||
|
||||
@ -230,7 +230,7 @@
|
||||
</div>
|
||||
<div class="col-lg-4 col-12">
|
||||
<ul class="list-unstyled">
|
||||
<li><a href="https://www.plus-innovations.com">© 2025 Sebastian Hildebrandt, +innovations</a></li>
|
||||
<li><a href="https://www.plus-innovations.com">© 2026 Sebastian Hildebrandt, +innovations</a></li>
|
||||
<li><a href="copyright.html">Copyright & License</a></li>
|
||||
<li><a href="trademarks.html">Trademarks</a></li>
|
||||
<li> </li>
|
||||
|
||||
@ -149,7 +149,7 @@ setTimeout(() => {
|
||||
</div>
|
||||
<div class="col-lg-4 col-12">
|
||||
<ul class="list-unstyled">
|
||||
<li><a href="https://www.plus-innovations.com">© 2025 Sebastian Hildebrandt, +innovations</a></li>
|
||||
<li><a href="https://www.plus-innovations.com">© 2026 Sebastian Hildebrandt, +innovations</a></li>
|
||||
<li><a href="copyright.html">Copyright & License</a></li>
|
||||
<li><a href="trademarks.html">Trademarks</a></li>
|
||||
<li> </li>
|
||||
|
||||
@ -446,7 +446,7 @@ si.chassis().then(data => console.log(data));</code></pre>
|
||||
</div>
|
||||
<div class="col-lg-4 col-12">
|
||||
<ul class="list-unstyled">
|
||||
<li><a href="https://www.plus-innovations.com">© 2025 Sebastian Hildebrandt, +innovations</a></li>
|
||||
<li><a href="https://www.plus-innovations.com">© 2026 Sebastian Hildebrandt, +innovations</a></li>
|
||||
<li><a href="copyright.html">Copyright & License</a></li>
|
||||
<li><a href="trademarks.html">Trademarks</a></li>
|
||||
<li> </li>
|
||||
|
||||
@ -100,7 +100,7 @@
|
||||
</div>
|
||||
<div class="col-lg-4 col-12">
|
||||
<ul class="list-unstyled">
|
||||
<li><a href="https://www.plus-innovations.com">© 2025 Sebastian Hildebrandt, +innovations</a></li>
|
||||
<li><a href="https://www.plus-innovations.com">© 2026 Sebastian Hildebrandt, +innovations</a></li>
|
||||
<li><a href="copyright.html">Copyright & License</a></li>
|
||||
<li><a href="trademarks.html">Trademarks</a></li>
|
||||
<li> </li>
|
||||
|
||||
@ -468,7 +468,7 @@
|
||||
</div>
|
||||
<div class="col-lg-4 col-12">
|
||||
<ul class="list-unstyled">
|
||||
<li><a href="https://www.plus-innovations.com">© 2025 Sebastian Hildebrandt, +innovations</a></li>
|
||||
<li><a href="https://www.plus-innovations.com">© 2026 Sebastian Hildebrandt, +innovations</a></li>
|
||||
<li><a href="copyright.html">Copyright & License</a></li>
|
||||
<li><a href="trademarks.html">Trademarks</a></li>
|
||||
<li> </li>
|
||||
|
||||
@ -245,7 +245,7 @@ si.wifiNetworks().then(data => console.log(data));</code></pre>
|
||||
</div>
|
||||
<div class="col-lg-4 col-12">
|
||||
<ul class="list-unstyled">
|
||||
<li><a href="https://www.plus-innovations.com">© 2025 Sebastian Hildebrandt, +innovations</a></li>
|
||||
<li><a href="https://www.plus-innovations.com">© 2026 Sebastian Hildebrandt, +innovations</a></li>
|
||||
<li><a href="copyright.html">Copyright & License</a></li>
|
||||
<li><a href="trademarks.html">Trademarks</a></li>
|
||||
<li> </li>
|
||||
|
||||
@ -475,7 +475,7 @@
|
||||
<li><a href="trademarks.html">Trademarks</a></li>
|
||||
<li> </li>
|
||||
<li><a href="copyright.html">Copyright & License <img src="https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square" alt="MIT license" /></a></li>
|
||||
<li><a href="https://www.plus-innovations.com">© 2025 Sebastian Hildebrandt</a></li>
|
||||
<li><a href="https://www.plus-innovations.com">© 2026 Sebastian Hildebrandt</a></li>
|
||||
<li><a href="https://www.plus-innovations.com">+innovations GmbH</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
@ -524,7 +524,7 @@ si.wifiConnections().then(data => console.log(data));</code></pre>
|
||||
<li><a href="trademarks.html">Trademarks</a></li>
|
||||
<li> </li>
|
||||
<li><a href="copyright.html">Copyright & License <img src="https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square" alt="MIT license" /></a></li>
|
||||
<li><a href="https://www.plus-innovations.com">© 2025 Sebastian Hildebrandt</a></li>
|
||||
<li><a href="https://www.plus-innovations.com">© 2026 Sebastian Hildebrandt</a></li>
|
||||
<li><a href="https://www.plus-innovations.com">+innovations GmbH</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
// ----------------------------------------------------------------------------------
|
||||
// Description: System Information - library
|
||||
// for Node.js
|
||||
// Copyright: (c) 2014 - 2025
|
||||
// Copyright: (c) 2014 - 2026
|
||||
// Author: Sebastian Hildebrandt
|
||||
// ----------------------------------------------------------------------------------
|
||||
// License: MIT
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
// ----------------------------------------------------------------------------------
|
||||
// Description: System Information - library
|
||||
// for Node.js
|
||||
// Copyright: (c) 2014 - 2025
|
||||
// Copyright: (c) 2014 - 2026
|
||||
// Author: Sebastian Hildebrandt
|
||||
// ----------------------------------------------------------------------------------
|
||||
// License: MIT
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
// ----------------------------------------------------------------------------------
|
||||
// Description: System Information - library
|
||||
// for Node.js
|
||||
// Copyright: (c) 2014 - 2025
|
||||
// Copyright: (c) 2014 - 2026
|
||||
// Author: Sebastian Hildebrandt
|
||||
// ----------------------------------------------------------------------------------
|
||||
// License: MIT
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
// ----------------------------------------------------------------------------------
|
||||
// Description: System Information - library
|
||||
// for Node.js
|
||||
// Copyright: (c) 2014 - 2025
|
||||
// Copyright: (c) 2014 - 2026
|
||||
// Author: Sebastian Hildebrandt
|
||||
// ----------------------------------------------------------------------------------
|
||||
// License: MIT
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
// ----------------------------------------------------------------------------------
|
||||
// Description: System Information - library
|
||||
// for Node.js
|
||||
// Copyright: (c) 2014 - 2025
|
||||
// Copyright: (c) 2014 - 2026
|
||||
// Author: Sebastian Hildebrandt
|
||||
// ----------------------------------------------------------------------------------
|
||||
// License: MIT
|
||||
|
||||
239
lib/docker.js
239
lib/docker.js
@ -5,7 +5,7 @@
|
||||
// ----------------------------------------------------------------------------------
|
||||
// Description: System Information - library
|
||||
// for Node.js
|
||||
// Copyright: (c) 2014 - 2025
|
||||
// Copyright: (c) 2014 - 2026
|
||||
// Author: Sebastian Hildebrandt
|
||||
// ----------------------------------------------------------------------------------
|
||||
// License: MIT
|
||||
@ -17,13 +17,12 @@ const util = require('./util');
|
||||
const DockerSocket = require('./dockerSocket');
|
||||
|
||||
let _platform = process.platform;
|
||||
const _windows = (_platform === 'win32');
|
||||
const _windows = _platform === 'win32';
|
||||
|
||||
let _docker_container_stats = {};
|
||||
let _docker_socket;
|
||||
let _docker_last_read = 0;
|
||||
|
||||
|
||||
// --------------------------
|
||||
// get containers (parameter all: get also inactive/exited containers)
|
||||
|
||||
@ -82,7 +81,9 @@ function dockerInfo(callback) {
|
||||
result.isolation = data.Isolation;
|
||||
result.initBinary = data.InitBinary;
|
||||
result.productLicense = data.ProductLicense;
|
||||
if (callback) { callback(result); }
|
||||
if (callback) {
|
||||
callback(result);
|
||||
}
|
||||
resolve(result);
|
||||
});
|
||||
});
|
||||
@ -92,7 +93,6 @@ function dockerInfo(callback) {
|
||||
exports.dockerInfo = dockerInfo;
|
||||
|
||||
function dockerImages(all, callback) {
|
||||
|
||||
// fallback - if only callback is given
|
||||
if (util.isFunction(all) && !callback) {
|
||||
callback = all;
|
||||
@ -114,36 +114,40 @@ function dockerImages(all, callback) {
|
||||
}
|
||||
const workload = [];
|
||||
|
||||
_docker_socket.listImages(all, data => {
|
||||
_docker_socket.listImages(all, (data) => {
|
||||
let dockerImages = {};
|
||||
try {
|
||||
dockerImages = data;
|
||||
if (dockerImages && Object.prototype.toString.call(dockerImages) === '[object Array]' && dockerImages.length > 0) {
|
||||
|
||||
dockerImages.forEach(function (element) {
|
||||
|
||||
if (element.Names && Object.prototype.toString.call(element.Names) === '[object Array]' && element.Names.length > 0) {
|
||||
element.Name = element.Names[0].replace(/^\/|\/$/g, '');
|
||||
}
|
||||
workload.push(dockerImagesInspect(element.Id.trim(), element));
|
||||
});
|
||||
if (workload.length) {
|
||||
Promise.all(
|
||||
workload
|
||||
).then((data) => {
|
||||
if (callback) { callback(data); }
|
||||
Promise.all(workload).then((data) => {
|
||||
if (callback) {
|
||||
callback(data);
|
||||
}
|
||||
resolve(data);
|
||||
});
|
||||
} else {
|
||||
if (callback) { callback(result); }
|
||||
if (callback) {
|
||||
callback(result);
|
||||
}
|
||||
resolve(result);
|
||||
}
|
||||
} else {
|
||||
if (callback) { callback(result); }
|
||||
if (callback) {
|
||||
callback(result);
|
||||
}
|
||||
resolve(result);
|
||||
}
|
||||
} catch (err) {
|
||||
if (callback) { callback(result); }
|
||||
if (callback) {
|
||||
callback(result);
|
||||
}
|
||||
resolve(result);
|
||||
}
|
||||
});
|
||||
@ -163,12 +167,11 @@ function dockerImagesInspect(imageID, payload) {
|
||||
}
|
||||
const imageIDSanitized = (util.isPrototypePolluted() ? '' : util.sanitizeShellString(imageID, true)).trim();
|
||||
if (imageIDSanitized) {
|
||||
|
||||
if (!_docker_socket) {
|
||||
_docker_socket = new DockerSocket();
|
||||
}
|
||||
|
||||
_docker_socket.inspectImage(imageIDSanitized.trim(), data => {
|
||||
_docker_socket.inspectImage(imageIDSanitized.trim(), (data) => {
|
||||
try {
|
||||
resolve({
|
||||
id: payload.Id,
|
||||
@ -188,7 +191,7 @@ function dockerImagesInspect(imageID, payload) {
|
||||
repoDigests: data.RepoDigests ? data.RepoDigests : {},
|
||||
repoTags: data.RepoTags ? data.RepoTags : {},
|
||||
config: data.Config ? data.Config : {},
|
||||
rootFS: data.RootFS ? data.RootFS : {},
|
||||
rootFS: data.RootFS ? data.RootFS : {}
|
||||
});
|
||||
} catch (err) {
|
||||
resolve();
|
||||
@ -204,16 +207,15 @@ function dockerImagesInspect(imageID, payload) {
|
||||
exports.dockerImages = dockerImages;
|
||||
|
||||
function dockerContainers(all, callback) {
|
||||
|
||||
function inContainers(containers, id) {
|
||||
let filtered = containers.filter(obj => {
|
||||
let filtered = containers.filter((obj) => {
|
||||
/**
|
||||
* @namespace
|
||||
* @property {string} Id
|
||||
*/
|
||||
return (obj.Id && (obj.Id === id));
|
||||
return obj.Id && obj.Id === id;
|
||||
});
|
||||
return (filtered.length > 0);
|
||||
return filtered.length > 0;
|
||||
}
|
||||
|
||||
// fallback - if only callback is given
|
||||
@ -237,7 +239,7 @@ function dockerContainers(all, callback) {
|
||||
}
|
||||
const workload = [];
|
||||
|
||||
_docker_socket.listContainers(all, data => {
|
||||
_docker_socket.listContainers(all, (data) => {
|
||||
let docker_containers = {};
|
||||
try {
|
||||
docker_containers = data;
|
||||
@ -245,40 +247,49 @@ function dockerContainers(all, callback) {
|
||||
// GC in _docker_container_stats
|
||||
for (let key in _docker_container_stats) {
|
||||
if ({}.hasOwnProperty.call(_docker_container_stats, key)) {
|
||||
if (!inContainers(docker_containers, key)) { delete _docker_container_stats[key]; }
|
||||
if (!inContainers(docker_containers, key)) {
|
||||
delete _docker_container_stats[key];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
docker_containers.forEach(function (element) {
|
||||
|
||||
if (element.Names && Object.prototype.toString.call(element.Names) === '[object Array]' && element.Names.length > 0) {
|
||||
element.Name = element.Names[0].replace(/^\/|\/$/g, '');
|
||||
}
|
||||
workload.push(dockerContainerInspect(element.Id.trim(), element));
|
||||
});
|
||||
if (workload.length) {
|
||||
Promise.all(
|
||||
workload
|
||||
).then((data) => {
|
||||
if (callback) { callback(data); }
|
||||
Promise.all(workload).then((data) => {
|
||||
if (callback) {
|
||||
callback(data);
|
||||
}
|
||||
resolve(data);
|
||||
});
|
||||
} else {
|
||||
if (callback) { callback(result); }
|
||||
if (callback) {
|
||||
callback(result);
|
||||
}
|
||||
resolve(result);
|
||||
}
|
||||
} else {
|
||||
if (callback) { callback(result); }
|
||||
if (callback) {
|
||||
callback(result);
|
||||
}
|
||||
resolve(result);
|
||||
}
|
||||
} catch (err) {
|
||||
// GC in _docker_container_stats
|
||||
for (let key in _docker_container_stats) {
|
||||
if ({}.hasOwnProperty.call(_docker_container_stats, key)) {
|
||||
if (!inContainers(docker_containers, key)) { delete _docker_container_stats[key]; }
|
||||
if (!inContainers(docker_containers, key)) {
|
||||
delete _docker_container_stats[key];
|
||||
}
|
||||
}
|
||||
}
|
||||
if (callback) { callback(result); }
|
||||
if (callback) {
|
||||
callback(result);
|
||||
}
|
||||
resolve(result);
|
||||
}
|
||||
});
|
||||
@ -298,12 +309,11 @@ function dockerContainerInspect(containerID, payload) {
|
||||
}
|
||||
const containerIdSanitized = (util.isPrototypePolluted() ? '' : util.sanitizeShellString(containerID, true)).trim();
|
||||
if (containerIdSanitized) {
|
||||
|
||||
if (!_docker_socket) {
|
||||
_docker_socket = new DockerSocket();
|
||||
}
|
||||
|
||||
_docker_socket.getInspect(containerIdSanitized.trim(), data => {
|
||||
_docker_socket.getInspect(containerIdSanitized.trim(), (data) => {
|
||||
try {
|
||||
resolve({
|
||||
id: payload.Id,
|
||||
@ -322,7 +332,7 @@ function dockerContainerInspect(containerID, payload) {
|
||||
platform: data.Platform || '',
|
||||
driver: data.Driver || '',
|
||||
ports: payload.Ports,
|
||||
mounts: payload.Mounts,
|
||||
mounts: payload.Mounts
|
||||
// hostconfig: payload.HostConfig,
|
||||
// network: payload.NetworkSettings
|
||||
});
|
||||
@ -363,8 +373,7 @@ function docker_calcCPUPercent(cpu_stats, precpu_stats) {
|
||||
// calculate the change for the cpu usage of the container in between readings
|
||||
if (precpu_stats.online_cpus) {
|
||||
cpuPercent = (cpuDelta / systemDelta) * precpu_stats.online_cpus * 100.0;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
cpuPercent = (cpuDelta / systemDelta) * cpu_stats.cpu_usage.percpu_usage.length * 100.0;
|
||||
}
|
||||
}
|
||||
@ -374,10 +383,10 @@ function docker_calcCPUPercent(cpu_stats, precpu_stats) {
|
||||
let nanoSecNow = util.nanoSeconds();
|
||||
let cpuPercent = 0.0;
|
||||
if (_docker_last_read > 0) {
|
||||
let possIntervals = (nanoSecNow - _docker_last_read); // / 100 * os.cpus().length;
|
||||
let possIntervals = nanoSecNow - _docker_last_read; // / 100 * os.cpus().length;
|
||||
let intervalsUsed = cpu_stats.cpu_usage.total_usage - precpu_stats.cpu_usage.total_usage;
|
||||
if (possIntervals > 0) {
|
||||
cpuPercent = 100.0 * intervalsUsed / possIntervals;
|
||||
cpuPercent = (100.0 * intervalsUsed) / possIntervals;
|
||||
}
|
||||
}
|
||||
_docker_last_read = nanoSecNow;
|
||||
@ -390,7 +399,9 @@ function docker_calcNetworkIO(networks) {
|
||||
let wx;
|
||||
for (let key in networks) {
|
||||
// skip loop if the property is from prototype
|
||||
if (!{}.hasOwnProperty.call(networks, key)) { continue; }
|
||||
if (!{}.hasOwnProperty.call(networks, key)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
/**
|
||||
* @namespace
|
||||
@ -417,7 +428,12 @@ function docker_calcBlockIO(blkio_stats) {
|
||||
* @namespace
|
||||
* @property {Array} io_service_bytes_recursive
|
||||
*/
|
||||
if (blkio_stats && blkio_stats.io_service_bytes_recursive && Object.prototype.toString.call(blkio_stats.io_service_bytes_recursive) === '[object Array]' && blkio_stats.io_service_bytes_recursive.length > 0) {
|
||||
if (
|
||||
blkio_stats &&
|
||||
blkio_stats.io_service_bytes_recursive &&
|
||||
Object.prototype.toString.call(blkio_stats.io_service_bytes_recursive) === '[object Array]' &&
|
||||
blkio_stats.io_service_bytes_recursive.length > 0
|
||||
) {
|
||||
blkio_stats.io_service_bytes_recursive.forEach(function (element) {
|
||||
/**
|
||||
* @namespace
|
||||
@ -437,11 +453,9 @@ function docker_calcBlockIO(blkio_stats) {
|
||||
}
|
||||
|
||||
function dockerContainerStats(containerIDs, callback) {
|
||||
|
||||
let containerArray = [];
|
||||
return new Promise((resolve) => {
|
||||
process.nextTick(() => {
|
||||
|
||||
// fallback - if only callback is given
|
||||
if (util.isFunction(containerIDs) && !callback) {
|
||||
callback = containerIDs;
|
||||
@ -449,7 +463,9 @@ function dockerContainerStats(containerIDs, callback) {
|
||||
} else {
|
||||
containerIDs = containerIDs || '*';
|
||||
if (typeof containerIDs !== 'string') {
|
||||
if (callback) { callback([]); }
|
||||
if (callback) {
|
||||
callback([]);
|
||||
}
|
||||
return resolve([]);
|
||||
}
|
||||
let containerIDsSanitized = '';
|
||||
@ -491,17 +507,21 @@ function dockerContainerStats(containerIDs, callback) {
|
||||
const workload = [];
|
||||
if (containerArray.length && containerArray[0].trim() === '*') {
|
||||
containerArray = [];
|
||||
dockerContainers().then(allContainers => {
|
||||
dockerContainers().then((allContainers) => {
|
||||
for (let container of allContainers) {
|
||||
containerArray.push(container.id.substring(0, 12));
|
||||
}
|
||||
if (containerArray.length) {
|
||||
dockerContainerStats(containerArray.join(',')).then(result => {
|
||||
if (callback) { callback(result); }
|
||||
dockerContainerStats(containerArray.join(',')).then((result) => {
|
||||
if (callback) {
|
||||
callback(result);
|
||||
}
|
||||
resolve(result);
|
||||
});
|
||||
} else {
|
||||
if (callback) { callback(result); }
|
||||
if (callback) {
|
||||
callback(result);
|
||||
}
|
||||
resolve(result);
|
||||
}
|
||||
});
|
||||
@ -510,14 +530,16 @@ function dockerContainerStats(containerIDs, callback) {
|
||||
workload.push(dockerContainerStatsSingle(containerID.trim()));
|
||||
}
|
||||
if (workload.length) {
|
||||
Promise.all(
|
||||
workload
|
||||
).then((data) => {
|
||||
if (callback) { callback(data); }
|
||||
Promise.all(workload).then((data) => {
|
||||
if (callback) {
|
||||
callback(data);
|
||||
}
|
||||
resolve(data);
|
||||
});
|
||||
} else {
|
||||
if (callback) { callback(result); }
|
||||
if (callback) {
|
||||
callback(result);
|
||||
}
|
||||
resolve(result);
|
||||
}
|
||||
}
|
||||
@ -549,35 +571,40 @@ function dockerContainerStatsSingle(containerID) {
|
||||
cpuStats: {},
|
||||
precpuStats: {},
|
||||
memoryStats: {},
|
||||
networks: {},
|
||||
networks: {}
|
||||
};
|
||||
return new Promise((resolve) => {
|
||||
process.nextTick(() => {
|
||||
if (containerID) {
|
||||
|
||||
if (!_docker_socket) {
|
||||
_docker_socket = new DockerSocket();
|
||||
}
|
||||
|
||||
_docker_socket.getInspect(containerID, dataInspect => {
|
||||
_docker_socket.getInspect(containerID, (dataInspect) => {
|
||||
try {
|
||||
_docker_socket.getStats(containerID, data => {
|
||||
_docker_socket.getStats(containerID, (data) => {
|
||||
try {
|
||||
let stats = data;
|
||||
if (!stats.message) {
|
||||
if (data.id) { result.id = data.id; }
|
||||
result.memUsage = (stats.memory_stats && stats.memory_stats.usage ? stats.memory_stats.usage : 0);
|
||||
result.memLimit = (stats.memory_stats && stats.memory_stats.limit ? stats.memory_stats.limit : 0);
|
||||
result.memPercent = (stats.memory_stats && stats.memory_stats.usage && stats.memory_stats.limit ? stats.memory_stats.usage / stats.memory_stats.limit * 100.0 : 0);
|
||||
result.cpuPercent = (stats.cpu_stats && stats.precpu_stats ? docker_calcCPUPercent(stats.cpu_stats, stats.precpu_stats) : 0);
|
||||
result.pids = (stats.pids_stats && stats.pids_stats.current ? stats.pids_stats.current : 0);
|
||||
result.restartCount = (dataInspect.RestartCount ? dataInspect.RestartCount : 0);
|
||||
if (stats.networks) { result.netIO = docker_calcNetworkIO(stats.networks); }
|
||||
if (stats.blkio_stats) { result.blockIO = docker_calcBlockIO(stats.blkio_stats); }
|
||||
result.cpuStats = (stats.cpu_stats ? stats.cpu_stats : {});
|
||||
result.precpuStats = (stats.precpu_stats ? stats.precpu_stats : {});
|
||||
result.memoryStats = (stats.memory_stats ? stats.memory_stats : {});
|
||||
result.networks = (stats.networks ? stats.networks : {});
|
||||
if (data.id) {
|
||||
result.id = data.id;
|
||||
}
|
||||
result.memUsage = stats.memory_stats && stats.memory_stats.usage ? stats.memory_stats.usage : 0;
|
||||
result.memLimit = stats.memory_stats && stats.memory_stats.limit ? stats.memory_stats.limit : 0;
|
||||
result.memPercent = stats.memory_stats && stats.memory_stats.usage && stats.memory_stats.limit ? (stats.memory_stats.usage / stats.memory_stats.limit) * 100.0 : 0;
|
||||
result.cpuPercent = stats.cpu_stats && stats.precpu_stats ? docker_calcCPUPercent(stats.cpu_stats, stats.precpu_stats) : 0;
|
||||
result.pids = stats.pids_stats && stats.pids_stats.current ? stats.pids_stats.current : 0;
|
||||
result.restartCount = dataInspect.RestartCount ? dataInspect.RestartCount : 0;
|
||||
if (stats.networks) {
|
||||
result.netIO = docker_calcNetworkIO(stats.networks);
|
||||
}
|
||||
if (stats.blkio_stats) {
|
||||
result.blockIO = docker_calcBlockIO(stats.blkio_stats);
|
||||
}
|
||||
result.cpuStats = stats.cpu_stats ? stats.cpu_stats : {};
|
||||
result.precpuStats = stats.precpu_stats ? stats.precpu_stats : {};
|
||||
result.memoryStats = stats.memory_stats ? stats.memory_stats : {};
|
||||
result.networks = stats.networks ? stats.networks : {};
|
||||
}
|
||||
} catch (err) {
|
||||
util.noop();
|
||||
@ -612,12 +639,11 @@ function dockerContainerProcesses(containerID, callback) {
|
||||
const containerIdSanitized = (util.isPrototypePolluted() ? '' : util.sanitizeShellString(containerID, true)).trim();
|
||||
|
||||
if (containerIdSanitized) {
|
||||
|
||||
if (!_docker_socket) {
|
||||
_docker_socket = new DockerSocket();
|
||||
}
|
||||
|
||||
_docker_socket.getProcesses(containerIdSanitized, data => {
|
||||
_docker_socket.getProcesses(containerIdSanitized, (data) => {
|
||||
/**
|
||||
* @namespace
|
||||
* @property {Array} Titles
|
||||
@ -643,33 +669,37 @@ function dockerContainerProcesses(containerID, callback) {
|
||||
let pos_rss = titles.indexOf('RSS');
|
||||
let pos_command = titles.indexOf('COMMAND');
|
||||
|
||||
data.Processes.forEach(process => {
|
||||
data.Processes.forEach((process) => {
|
||||
result.push({
|
||||
pidHost: (pos_pid >= 0 ? process[pos_pid] : ''),
|
||||
ppid: (pos_ppid >= 0 ? process[pos_ppid] : ''),
|
||||
pgid: (pos_pgid >= 0 ? process[pos_pgid] : ''),
|
||||
user: (pos_user >= 0 ? process[pos_user] : ''),
|
||||
ruser: (pos_ruser >= 0 ? process[pos_ruser] : ''),
|
||||
group: (pos_group >= 0 ? process[pos_group] : ''),
|
||||
rgroup: (pos_rgroup >= 0 ? process[pos_rgroup] : ''),
|
||||
stat: (pos_stat >= 0 ? process[pos_stat] : ''),
|
||||
time: (pos_time >= 0 ? process[pos_time] : ''),
|
||||
elapsed: (pos_elapsed >= 0 ? process[pos_elapsed] : ''),
|
||||
nice: (pos_ni >= 0 ? process[pos_ni] : ''),
|
||||
rss: (pos_rss >= 0 ? process[pos_rss] : ''),
|
||||
vsz: (pos_vsz >= 0 ? process[pos_vsz] : ''),
|
||||
command: (pos_command >= 0 ? process[pos_command] : '')
|
||||
pidHost: pos_pid >= 0 ? process[pos_pid] : '',
|
||||
ppid: pos_ppid >= 0 ? process[pos_ppid] : '',
|
||||
pgid: pos_pgid >= 0 ? process[pos_pgid] : '',
|
||||
user: pos_user >= 0 ? process[pos_user] : '',
|
||||
ruser: pos_ruser >= 0 ? process[pos_ruser] : '',
|
||||
group: pos_group >= 0 ? process[pos_group] : '',
|
||||
rgroup: pos_rgroup >= 0 ? process[pos_rgroup] : '',
|
||||
stat: pos_stat >= 0 ? process[pos_stat] : '',
|
||||
time: pos_time >= 0 ? process[pos_time] : '',
|
||||
elapsed: pos_elapsed >= 0 ? process[pos_elapsed] : '',
|
||||
nice: pos_ni >= 0 ? process[pos_ni] : '',
|
||||
rss: pos_rss >= 0 ? process[pos_rss] : '',
|
||||
vsz: pos_vsz >= 0 ? process[pos_vsz] : '',
|
||||
command: pos_command >= 0 ? process[pos_command] : ''
|
||||
});
|
||||
});
|
||||
}
|
||||
} catch (err) {
|
||||
util.noop();
|
||||
}
|
||||
if (callback) { callback(result); }
|
||||
if (callback) {
|
||||
callback(result);
|
||||
}
|
||||
resolve(result);
|
||||
});
|
||||
} else {
|
||||
if (callback) { callback(result); }
|
||||
if (callback) {
|
||||
callback(result);
|
||||
}
|
||||
resolve(result);
|
||||
}
|
||||
});
|
||||
@ -679,7 +709,6 @@ function dockerContainerProcesses(containerID, callback) {
|
||||
exports.dockerContainerProcesses = dockerContainerProcesses;
|
||||
|
||||
function dockerVolumes(callback) {
|
||||
|
||||
let result = [];
|
||||
return new Promise((resolve) => {
|
||||
process.nextTick(() => {
|
||||
@ -691,9 +720,7 @@ function dockerVolumes(callback) {
|
||||
try {
|
||||
dockerVolumes = data;
|
||||
if (dockerVolumes && dockerVolumes.Volumes && Object.prototype.toString.call(dockerVolumes.Volumes) === '[object Array]' && dockerVolumes.Volumes.length > 0) {
|
||||
|
||||
dockerVolumes.Volumes.forEach(function (element) {
|
||||
|
||||
result.push({
|
||||
name: element.Name,
|
||||
driver: element.Driver,
|
||||
@ -701,17 +728,23 @@ function dockerVolumes(callback) {
|
||||
mountpoint: element.Mountpoint,
|
||||
options: element.Options,
|
||||
scope: element.Scope,
|
||||
created: element.CreatedAt ? Math.round(new Date(element.CreatedAt).getTime() / 1000) : 0,
|
||||
created: element.CreatedAt ? Math.round(new Date(element.CreatedAt).getTime() / 1000) : 0
|
||||
});
|
||||
});
|
||||
if (callback) { callback(result); }
|
||||
if (callback) {
|
||||
callback(result);
|
||||
}
|
||||
resolve(result);
|
||||
} else {
|
||||
if (callback) { callback(result); }
|
||||
if (callback) {
|
||||
callback(result);
|
||||
}
|
||||
resolve(result);
|
||||
}
|
||||
} catch (err) {
|
||||
if (callback) { callback(result); }
|
||||
if (callback) {
|
||||
callback(result);
|
||||
}
|
||||
resolve(result);
|
||||
}
|
||||
});
|
||||
@ -724,7 +757,7 @@ exports.dockerVolumes = dockerVolumes;
|
||||
function dockerAll(callback) {
|
||||
return new Promise((resolve) => {
|
||||
process.nextTick(() => {
|
||||
dockerContainers(true).then(result => {
|
||||
dockerContainers(true).then((result) => {
|
||||
if (result && Object.prototype.toString.call(result) === '[object Array]' && result.length > 0) {
|
||||
let l = result.length;
|
||||
result.forEach(function (element) {
|
||||
@ -742,12 +775,14 @@ function dockerAll(callback) {
|
||||
element.memoryStats = res[0].memoryStats;
|
||||
element.networks = res[0].networks;
|
||||
|
||||
dockerContainerProcesses(element.id).then(processes => {
|
||||
dockerContainerProcesses(element.id).then((processes) => {
|
||||
element.processes = processes;
|
||||
|
||||
l -= 1;
|
||||
if (l === 0) {
|
||||
if (callback) { callback(result); }
|
||||
if (callback) {
|
||||
callback(result);
|
||||
}
|
||||
resolve(result);
|
||||
}
|
||||
});
|
||||
@ -755,7 +790,9 @@ function dockerAll(callback) {
|
||||
});
|
||||
});
|
||||
} else {
|
||||
if (callback) { callback(result); }
|
||||
if (callback) {
|
||||
callback(result);
|
||||
}
|
||||
resolve(result);
|
||||
}
|
||||
});
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
// ----------------------------------------------------------------------------------
|
||||
// Description: System Information - library
|
||||
// for Node.js
|
||||
// Copyright: (c) 2014 - 2025
|
||||
// Copyright: (c) 2014 - 2026
|
||||
// Author: Sebastian Hildebrandt
|
||||
// ----------------------------------------------------------------------------------
|
||||
// License: MIT
|
||||
@ -18,10 +18,8 @@ const isWin = require('os').type() === 'Windows_NT';
|
||||
const socketPath = isWin ? '//./pipe/docker_engine' : '/var/run/docker.sock';
|
||||
|
||||
class DockerSocket {
|
||||
|
||||
getInfo(callback) {
|
||||
try {
|
||||
|
||||
let socket = net.createConnection({ path: socketPath });
|
||||
let alldata = '';
|
||||
let data;
|
||||
@ -30,7 +28,7 @@ class DockerSocket {
|
||||
socket.write('GET http:/info HTTP/1.0\r\n\r\n');
|
||||
});
|
||||
|
||||
socket.on('data', data => {
|
||||
socket.on('data', (data) => {
|
||||
alldata = alldata + data.toString();
|
||||
});
|
||||
|
||||
@ -57,7 +55,6 @@ class DockerSocket {
|
||||
|
||||
listImages(all, callback) {
|
||||
try {
|
||||
|
||||
let socket = net.createConnection({ path: socketPath });
|
||||
let alldata = '';
|
||||
let data;
|
||||
@ -66,7 +63,7 @@ class DockerSocket {
|
||||
socket.write('GET http:/images/json' + (all ? '?all=1' : '') + ' HTTP/1.0\r\n\r\n');
|
||||
});
|
||||
|
||||
socket.on('data', data => {
|
||||
socket.on('data', (data) => {
|
||||
alldata = alldata + data.toString();
|
||||
});
|
||||
|
||||
@ -103,7 +100,7 @@ class DockerSocket {
|
||||
socket.write('GET http:/images/' + id + '/json?stream=0 HTTP/1.0\r\n\r\n');
|
||||
});
|
||||
|
||||
socket.on('data', data => {
|
||||
socket.on('data', (data) => {
|
||||
alldata = alldata + data.toString();
|
||||
});
|
||||
|
||||
@ -133,7 +130,6 @@ class DockerSocket {
|
||||
|
||||
listContainers(all, callback) {
|
||||
try {
|
||||
|
||||
let socket = net.createConnection({ path: socketPath });
|
||||
let alldata = '';
|
||||
let data;
|
||||
@ -142,7 +138,7 @@ class DockerSocket {
|
||||
socket.write('GET http:/containers/json' + (all ? '?all=1' : '') + ' HTTP/1.0\r\n\r\n');
|
||||
});
|
||||
|
||||
socket.on('data', data => {
|
||||
socket.on('data', (data) => {
|
||||
alldata = alldata + data.toString();
|
||||
});
|
||||
|
||||
@ -179,7 +175,7 @@ class DockerSocket {
|
||||
socket.write('GET http:/containers/' + id + '/stats?stream=0 HTTP/1.0\r\n\r\n');
|
||||
});
|
||||
|
||||
socket.on('data', data => {
|
||||
socket.on('data', (data) => {
|
||||
alldata = alldata + data.toString();
|
||||
});
|
||||
|
||||
@ -219,7 +215,7 @@ class DockerSocket {
|
||||
socket.write('GET http:/containers/' + id + '/json?stream=0 HTTP/1.0\r\n\r\n');
|
||||
});
|
||||
|
||||
socket.on('data', data => {
|
||||
socket.on('data', (data) => {
|
||||
alldata = alldata + data.toString();
|
||||
});
|
||||
|
||||
@ -259,7 +255,7 @@ class DockerSocket {
|
||||
socket.write('GET http:/containers/' + id + '/top?ps_args=-opid,ppid,pgid,vsz,time,etime,nice,ruser,user,rgroup,group,stat,rss,args HTTP/1.0\r\n\r\n');
|
||||
});
|
||||
|
||||
socket.on('data', data => {
|
||||
socket.on('data', (data) => {
|
||||
alldata = alldata + data.toString();
|
||||
});
|
||||
|
||||
@ -289,7 +285,6 @@ class DockerSocket {
|
||||
|
||||
listVolumes(callback) {
|
||||
try {
|
||||
|
||||
let socket = net.createConnection({ path: socketPath });
|
||||
let alldata = '';
|
||||
let data;
|
||||
@ -298,7 +293,7 @@ class DockerSocket {
|
||||
socket.write('GET http:/volumes HTTP/1.0\r\n\r\n');
|
||||
});
|
||||
|
||||
socket.on('data', data => {
|
||||
socket.on('data', (data) => {
|
||||
alldata = alldata + data.toString();
|
||||
});
|
||||
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
// ----------------------------------------------------------------------------------
|
||||
// Description: System Information - library
|
||||
// for Node.js
|
||||
// Copyright: (c) 2014 - 2025
|
||||
// Copyright: (c) 2014 - 2026
|
||||
// Author: Sebastian Hildebrandt
|
||||
// ----------------------------------------------------------------------------------
|
||||
// License: MIT
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
// ----------------------------------------------------------------------------------
|
||||
// Description: System Information - library
|
||||
// for Node.js
|
||||
// Copyright: (c) 2014 - 2025
|
||||
// Copyright: (c) 2014 - 2026
|
||||
// Author: Sebastian Hildebrandt
|
||||
// ----------------------------------------------------------------------------------
|
||||
// License: MIT
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
// ----------------------------------------------------------------------------------
|
||||
// Description: System Information - library
|
||||
// for Node.js
|
||||
// Copyright: (c) 2014 - 2025
|
||||
// Copyright: (c) 2014 - 2026
|
||||
// Author: Sebastian Hildebrandt
|
||||
// ----------------------------------------------------------------------------------
|
||||
// Contributors: Guillaume Legrain (https://github.com/glegrain)
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
// ----------------------------------------------------------------------------------
|
||||
// Description: System Information - library
|
||||
// for Node.js
|
||||
// Copyright: (c) 2014 - 2025
|
||||
// Copyright: (c) 2014 - 2026
|
||||
// Author: Sebastian Hildebrandt
|
||||
// ----------------------------------------------------------------------------------
|
||||
// License: MIT
|
||||
@ -17,19 +17,18 @@ const util = require('./util');
|
||||
|
||||
let _platform = process.platform;
|
||||
|
||||
const _linux = (_platform === 'linux' || _platform === 'android');
|
||||
const _darwin = (_platform === 'darwin');
|
||||
const _windows = (_platform === 'win32');
|
||||
const _freebsd = (_platform === 'freebsd');
|
||||
const _openbsd = (_platform === 'openbsd');
|
||||
const _netbsd = (_platform === 'netbsd');
|
||||
const _sunos = (_platform === 'sunos');
|
||||
const _linux = _platform === 'linux' || _platform === 'android';
|
||||
const _darwin = _platform === 'darwin';
|
||||
const _windows = _platform === 'win32';
|
||||
const _freebsd = _platform === 'freebsd';
|
||||
const _openbsd = _platform === 'openbsd';
|
||||
const _netbsd = _platform === 'netbsd';
|
||||
const _sunos = _platform === 'sunos';
|
||||
|
||||
// --------------------------
|
||||
// check if external site is available
|
||||
|
||||
function inetChecksite(url, callback) {
|
||||
|
||||
return new Promise((resolve) => {
|
||||
process.nextTick(() => {
|
||||
let result = {
|
||||
@ -39,7 +38,9 @@ function inetChecksite(url, callback) {
|
||||
ms: null
|
||||
};
|
||||
if (typeof url !== 'string') {
|
||||
if (callback) { callback(result); }
|
||||
if (callback) {
|
||||
callback(result);
|
||||
}
|
||||
return resolve(result);
|
||||
}
|
||||
let urlSanitized = '';
|
||||
@ -68,24 +69,39 @@ function inetChecksite(url, callback) {
|
||||
Object.setPrototypeOf(urlSanitized, util.stringObj);
|
||||
}
|
||||
|
||||
if (urlSanitized.startsWith('file:') || urlSanitized.startsWith('gopher:') || urlSanitized.startsWith('telnet:') || urlSanitized.startsWith('mailto:') || urlSanitized.startsWith('news:') || urlSanitized.startsWith('nntp:')) {
|
||||
if (callback) { callback(result); }
|
||||
if (
|
||||
urlSanitized.startsWith('file:') ||
|
||||
urlSanitized.startsWith('gopher:') ||
|
||||
urlSanitized.startsWith('telnet:') ||
|
||||
urlSanitized.startsWith('mailto:') ||
|
||||
urlSanitized.startsWith('news:') ||
|
||||
urlSanitized.startsWith('nntp:')
|
||||
) {
|
||||
if (callback) {
|
||||
callback(result);
|
||||
}
|
||||
return resolve(result);
|
||||
}
|
||||
|
||||
util.checkWebsite(urlSanitized).then((res) => {
|
||||
result.status = res.statusCode;
|
||||
result.ok = res.statusCode >= 200 && res.statusCode <= 399;;
|
||||
result.ms = (result.ok ? res.time : null);
|
||||
if (callback) { callback(result); }
|
||||
result.ok = res.statusCode >= 200 && res.statusCode <= 399;
|
||||
result.ms = result.ok ? res.time : null;
|
||||
if (callback) {
|
||||
callback(result);
|
||||
}
|
||||
resolve(result);
|
||||
});
|
||||
} else {
|
||||
if (callback) { callback(result); }
|
||||
if (callback) {
|
||||
callback(result);
|
||||
}
|
||||
resolve(result);
|
||||
}
|
||||
} catch (err) {
|
||||
if (callback) { callback(result); }
|
||||
if (callback) {
|
||||
callback(result);
|
||||
}
|
||||
resolve(result);
|
||||
}
|
||||
});
|
||||
@ -98,7 +114,6 @@ exports.inetChecksite = inetChecksite;
|
||||
// check inet latency
|
||||
|
||||
function inetLatency(host, callback) {
|
||||
|
||||
// fallback - if only callback is given
|
||||
if (util.isFunction(host) && !callback) {
|
||||
callback = host;
|
||||
@ -110,7 +125,9 @@ function inetLatency(host, callback) {
|
||||
return new Promise((resolve) => {
|
||||
process.nextTick(() => {
|
||||
if (typeof host !== 'string') {
|
||||
if (callback) { callback(null); }
|
||||
if (callback) {
|
||||
callback(null);
|
||||
}
|
||||
return resolve(null);
|
||||
}
|
||||
let hostSanitized = '';
|
||||
@ -136,8 +153,17 @@ function inetLatency(host, callback) {
|
||||
Object.setPrototypeOf(hostSanitized, util.stringObj);
|
||||
}
|
||||
|
||||
if (hostSanitized.startsWith('file:') || hostSanitized.startsWith('gopher:') || hostSanitized.startsWith('telnet:') || hostSanitized.startsWith('mailto:') || hostSanitized.startsWith('news:') || hostSanitized.startsWith('nntp:')) {
|
||||
if (callback) { callback(null); }
|
||||
if (
|
||||
hostSanitized.startsWith('file:') ||
|
||||
hostSanitized.startsWith('gopher:') ||
|
||||
hostSanitized.startsWith('telnet:') ||
|
||||
hostSanitized.startsWith('mailto:') ||
|
||||
hostSanitized.startsWith('news:') ||
|
||||
hostSanitized.startsWith('nntp:')
|
||||
) {
|
||||
if (callback) {
|
||||
callback(null);
|
||||
}
|
||||
return resolve(null);
|
||||
}
|
||||
let params;
|
||||
@ -154,7 +180,10 @@ function inetLatency(host, callback) {
|
||||
util.execSafe('ping', params).then((stdout) => {
|
||||
let result = null;
|
||||
if (stdout) {
|
||||
const lines = stdout.split('\n').filter((line) => (line.indexOf('rtt') >= 0 || line.indexOf('round-trip') >= 0 || line.indexOf('avg') >= 0)).join('\n');
|
||||
const lines = stdout
|
||||
.split('\n')
|
||||
.filter((line) => line.indexOf('rtt') >= 0 || line.indexOf('round-trip') >= 0 || line.indexOf('avg') >= 0)
|
||||
.join('\n');
|
||||
|
||||
const line = lines.split('=');
|
||||
if (line.length > 1) {
|
||||
@ -164,7 +193,9 @@ function inetLatency(host, callback) {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (callback) { callback(result); }
|
||||
if (callback) {
|
||||
callback(result);
|
||||
}
|
||||
resolve(result);
|
||||
});
|
||||
}
|
||||
@ -174,7 +205,10 @@ function inetLatency(host, callback) {
|
||||
util.execSafe('ping', params, { timeout: 3000 }).then((stdout) => {
|
||||
let result = null;
|
||||
if (stdout) {
|
||||
const lines = stdout.split('\n').filter(line => line.indexOf(filt) >= 0).join('\n');
|
||||
const lines = stdout
|
||||
.split('\n')
|
||||
.filter((line) => line.indexOf(filt) >= 0)
|
||||
.join('\n');
|
||||
const line = lines.split('=');
|
||||
if (line.length > 1) {
|
||||
const parts = line[1].split('/');
|
||||
@ -183,7 +217,9 @@ function inetLatency(host, callback) {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (callback) { callback(result); }
|
||||
if (callback) {
|
||||
callback(result);
|
||||
}
|
||||
resolve(result);
|
||||
});
|
||||
}
|
||||
@ -204,11 +240,15 @@ function inetLatency(host, callback) {
|
||||
}
|
||||
});
|
||||
}
|
||||
if (callback) { callback(result); }
|
||||
if (callback) {
|
||||
callback(result);
|
||||
}
|
||||
resolve(result);
|
||||
});
|
||||
} catch (e) {
|
||||
if (callback) { callback(result); }
|
||||
if (callback) {
|
||||
callback(result);
|
||||
}
|
||||
resolve(result);
|
||||
}
|
||||
}
|
||||
|
||||
451
lib/memory.js
451
lib/memory.js
@ -5,7 +5,7 @@
|
||||
// ----------------------------------------------------------------------------------
|
||||
// Description: System Information - library
|
||||
// for Node.js
|
||||
// Copyright: (c) 2014 - 2025
|
||||
// Copyright: (c) 2014 - 2026
|
||||
// Author: Sebastian Hildebrandt
|
||||
// ----------------------------------------------------------------------------------
|
||||
// License: MIT
|
||||
@ -21,13 +21,13 @@ const fs = require('fs');
|
||||
|
||||
let _platform = process.platform;
|
||||
|
||||
const _linux = (_platform === 'linux' || _platform === 'android');
|
||||
const _darwin = (_platform === 'darwin');
|
||||
const _windows = (_platform === 'win32');
|
||||
const _freebsd = (_platform === 'freebsd');
|
||||
const _openbsd = (_platform === 'openbsd');
|
||||
const _netbsd = (_platform === 'netbsd');
|
||||
const _sunos = (_platform === 'sunos');
|
||||
const _linux = _platform === 'linux' || _platform === 'android';
|
||||
const _darwin = _platform === 'darwin';
|
||||
const _windows = _platform === 'win32';
|
||||
const _freebsd = _platform === 'freebsd';
|
||||
const _openbsd = _platform === 'openbsd';
|
||||
const _netbsd = _platform === 'netbsd';
|
||||
const _sunos = _platform === 'sunos';
|
||||
|
||||
const RAM_manufacturers = {
|
||||
'00CE': 'Samsung Electronics Inc',
|
||||
@ -39,24 +39,24 @@ const RAM_manufacturers = {
|
||||
'04CB': 'A-DATA',
|
||||
'04CD': 'G.Skill International Enterprise',
|
||||
'059B': 'Crucial',
|
||||
'1315': 'Crucial',
|
||||
1315: 'Crucial',
|
||||
'2C00': 'Micron Technology Inc.',
|
||||
'5105': 'Qimonda AG i. In.',
|
||||
5105: 'Qimonda AG i. In.',
|
||||
'802C': 'Micron Technology Inc.',
|
||||
'80AD': 'Hynix Semiconductor Inc.',
|
||||
'80CE': 'Samsung Electronics Inc.',
|
||||
'8551': 'Qimonda AG i. In.',
|
||||
8551: 'Qimonda AG i. In.',
|
||||
'859B': 'Crucial',
|
||||
'AD00': 'Hynix Semiconductor Inc.',
|
||||
'CE00': 'Samsung Electronics Inc.',
|
||||
'SAMSUNG': 'Samsung Electronics Inc.',
|
||||
'HYNIX': 'Hynix Semiconductor Inc.',
|
||||
AD00: 'Hynix Semiconductor Inc.',
|
||||
CE00: 'Samsung Electronics Inc.',
|
||||
SAMSUNG: 'Samsung Electronics Inc.',
|
||||
HYNIX: 'Hynix Semiconductor Inc.',
|
||||
'G-SKILL': 'G-Skill International Enterprise',
|
||||
'G.SKILL': 'G-Skill International Enterprise',
|
||||
'TRANSCEND': 'Transcend Information',
|
||||
'APACER': 'Apacer Technology Inc',
|
||||
'MICRON': 'Micron Technology Inc.',
|
||||
'QIMONDA': 'Qimonda AG i. In.',
|
||||
TRANSCEND: 'Transcend Information',
|
||||
APACER: 'Apacer Technology Inc',
|
||||
MICRON: 'Micron Technology Inc.',
|
||||
QIMONDA: 'Qimonda AG i. In.'
|
||||
};
|
||||
|
||||
// _______________________________________________________________________________________
|
||||
@ -137,17 +137,15 @@ const RAM_manufacturers = {
|
||||
// SUnreclaim: 79352 kB
|
||||
|
||||
function mem(callback) {
|
||||
|
||||
return new Promise((resolve) => {
|
||||
process.nextTick(() => {
|
||||
|
||||
let result = {
|
||||
total: os.totalmem(),
|
||||
free: os.freemem(),
|
||||
used: os.totalmem() - os.freemem(),
|
||||
|
||||
active: os.totalmem() - os.freemem(), // temporarily (fallback)
|
||||
available: os.freemem(), // temporarily (fallback)
|
||||
active: os.totalmem() - os.freemem(), // temporarily (fallback)
|
||||
available: os.freemem(), // temporarily (fallback)
|
||||
buffers: 0,
|
||||
cached: 0,
|
||||
slab: 0,
|
||||
@ -196,45 +194,59 @@ function mem(callback) {
|
||||
result.reclaimable = parseInt(util.getValue(lines, 'sreclaimable'), 10);
|
||||
result.reclaimable = result.reclaimable ? result.reclaimable * 1024 : 0;
|
||||
}
|
||||
if (callback) { callback(result); }
|
||||
if (callback) {
|
||||
callback(result);
|
||||
}
|
||||
resolve(result);
|
||||
});
|
||||
} catch (e) {
|
||||
if (callback) { callback(result); }
|
||||
if (callback) {
|
||||
callback(result);
|
||||
}
|
||||
resolve(result);
|
||||
}
|
||||
}
|
||||
if (_freebsd || _openbsd || _netbsd) {
|
||||
try {
|
||||
exec('/sbin/sysctl hw.realmem hw.physmem vm.stats.vm.v_page_count vm.stats.vm.v_wire_count vm.stats.vm.v_active_count vm.stats.vm.v_inactive_count vm.stats.vm.v_cache_count vm.stats.vm.v_free_count vm.stats.vm.v_page_size', function (error, stdout) {
|
||||
if (!error) {
|
||||
let lines = stdout.toString().split('\n');
|
||||
const pagesize = parseInt(util.getValue(lines, 'vm.stats.vm.v_page_size'), 10);
|
||||
const inactive = parseInt(util.getValue(lines, 'vm.stats.vm.v_inactive_count'), 10) * pagesize;
|
||||
const cache = parseInt(util.getValue(lines, 'vm.stats.vm.v_cache_count'), 10) * pagesize;
|
||||
exec(
|
||||
'/sbin/sysctl hw.realmem hw.physmem vm.stats.vm.v_page_count vm.stats.vm.v_wire_count vm.stats.vm.v_active_count vm.stats.vm.v_inactive_count vm.stats.vm.v_cache_count vm.stats.vm.v_free_count vm.stats.vm.v_page_size',
|
||||
function (error, stdout) {
|
||||
if (!error) {
|
||||
let lines = stdout.toString().split('\n');
|
||||
const pagesize = parseInt(util.getValue(lines, 'vm.stats.vm.v_page_size'), 10);
|
||||
const inactive = parseInt(util.getValue(lines, 'vm.stats.vm.v_inactive_count'), 10) * pagesize;
|
||||
const cache = parseInt(util.getValue(lines, 'vm.stats.vm.v_cache_count'), 10) * pagesize;
|
||||
|
||||
result.total = parseInt(util.getValue(lines, 'hw.realmem'), 10);
|
||||
if (isNaN(result.total)) { result.total = parseInt(util.getValue(lines, 'hw.physmem'), 10); }
|
||||
result.free = parseInt(util.getValue(lines, 'vm.stats.vm.v_free_count'), 10) * pagesize;
|
||||
result.buffcache = inactive + cache;
|
||||
result.available = result.buffcache + result.free;
|
||||
result.active = result.total - result.free - result.buffcache;
|
||||
|
||||
result.swaptotal = 0;
|
||||
result.swapfree = 0;
|
||||
result.swapused = 0;
|
||||
result.total = parseInt(util.getValue(lines, 'hw.realmem'), 10);
|
||||
if (isNaN(result.total)) {
|
||||
result.total = parseInt(util.getValue(lines, 'hw.physmem'), 10);
|
||||
}
|
||||
result.free = parseInt(util.getValue(lines, 'vm.stats.vm.v_free_count'), 10) * pagesize;
|
||||
result.buffcache = inactive + cache;
|
||||
result.available = result.buffcache + result.free;
|
||||
result.active = result.total - result.free - result.buffcache;
|
||||
|
||||
result.swaptotal = 0;
|
||||
result.swapfree = 0;
|
||||
result.swapused = 0;
|
||||
}
|
||||
if (callback) {
|
||||
callback(result);
|
||||
}
|
||||
resolve(result);
|
||||
}
|
||||
if (callback) { callback(result); }
|
||||
resolve(result);
|
||||
});
|
||||
);
|
||||
} catch (e) {
|
||||
if (callback) { callback(result); }
|
||||
if (callback) {
|
||||
callback(result);
|
||||
}
|
||||
resolve(result);
|
||||
}
|
||||
}
|
||||
if (_sunos) {
|
||||
if (callback) { callback(result); }
|
||||
if (callback) {
|
||||
callback(result);
|
||||
}
|
||||
resolve(result);
|
||||
}
|
||||
if (_darwin) {
|
||||
@ -260,19 +272,29 @@ function mem(callback) {
|
||||
if (lines.length > 0) {
|
||||
let firstline = lines[0].replace(/,/g, '.').replace(/M/g, '');
|
||||
let lineArray = firstline.trim().split(' ');
|
||||
lineArray.forEach(line => {
|
||||
if (line.toLowerCase().indexOf('total') !== -1) { result.swaptotal = parseFloat(line.split('=')[1].trim()) * 1024 * 1024; }
|
||||
if (line.toLowerCase().indexOf('used') !== -1) { result.swapused = parseFloat(line.split('=')[1].trim()) * 1024 * 1024; }
|
||||
if (line.toLowerCase().indexOf('free') !== -1) { result.swapfree = parseFloat(line.split('=')[1].trim()) * 1024 * 1024; }
|
||||
lineArray.forEach((line) => {
|
||||
if (line.toLowerCase().indexOf('total') !== -1) {
|
||||
result.swaptotal = parseFloat(line.split('=')[1].trim()) * 1024 * 1024;
|
||||
}
|
||||
if (line.toLowerCase().indexOf('used') !== -1) {
|
||||
result.swapused = parseFloat(line.split('=')[1].trim()) * 1024 * 1024;
|
||||
}
|
||||
if (line.toLowerCase().indexOf('free') !== -1) {
|
||||
result.swapfree = parseFloat(line.split('=')[1].trim()) * 1024 * 1024;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
if (callback) { callback(result); }
|
||||
if (callback) {
|
||||
callback(result);
|
||||
}
|
||||
resolve(result);
|
||||
});
|
||||
});
|
||||
} catch (e) {
|
||||
if (callback) { callback(result); }
|
||||
if (callback) {
|
||||
callback(result);
|
||||
}
|
||||
resolve(result);
|
||||
}
|
||||
}
|
||||
@ -282,7 +304,10 @@ function mem(callback) {
|
||||
try {
|
||||
util.powerShell('Get-CimInstance Win32_PageFileUsage | Select AllocatedBaseSize, CurrentUsage').then((stdout, error) => {
|
||||
if (!error) {
|
||||
let lines = stdout.split('\r\n').filter(line => line.trim() !== '').filter((line, idx) => idx > 0);
|
||||
let lines = stdout
|
||||
.split('\r\n')
|
||||
.filter((line) => line.trim() !== '')
|
||||
.filter((line, idx) => idx > 0);
|
||||
lines.forEach(function (line) {
|
||||
if (line !== '') {
|
||||
line = line.trim().split(/\s\s+/);
|
||||
@ -295,11 +320,15 @@ function mem(callback) {
|
||||
result.swapused = swapused * 1024 * 1024;
|
||||
result.swapfree = result.swaptotal - result.swapused;
|
||||
|
||||
if (callback) { callback(result); }
|
||||
if (callback) {
|
||||
callback(result);
|
||||
}
|
||||
resolve(result);
|
||||
});
|
||||
} catch (e) {
|
||||
if (callback) { callback(result); }
|
||||
if (callback) {
|
||||
callback(result);
|
||||
}
|
||||
resolve(result);
|
||||
}
|
||||
}
|
||||
@ -310,129 +339,134 @@ function mem(callback) {
|
||||
exports.mem = mem;
|
||||
|
||||
function memLayout(callback) {
|
||||
|
||||
function getManufacturer(manId) {
|
||||
const manIdSearch = manId.replace('0x', '').toUpperCase();
|
||||
if (manIdSearch.length >= 4 && {}.hasOwnProperty.call(RAM_manufacturers, manIdSearch)) {
|
||||
return (RAM_manufacturers[manIdSearch]);
|
||||
return RAM_manufacturers[manIdSearch];
|
||||
}
|
||||
return manId;
|
||||
}
|
||||
|
||||
return new Promise((resolve) => {
|
||||
process.nextTick(() => {
|
||||
|
||||
let result = [];
|
||||
|
||||
if (_linux || _freebsd || _openbsd || _netbsd) {
|
||||
exec('export LC_ALL=C; dmidecode -t memory 2>/dev/null | grep -iE "Size:|Type|Speed|Manufacturer|Form Factor|Locator|Memory Device|Serial Number|Voltage|Part Number"; unset LC_ALL', function (error, stdout) {
|
||||
if (!error) {
|
||||
let devices = stdout.toString().split('Memory Device');
|
||||
devices.shift();
|
||||
devices.forEach(function (device) {
|
||||
let lines = device.split('\n');
|
||||
const sizeString = util.getValue(lines, 'Size');
|
||||
const size = sizeString.indexOf('GB') >= 0 ? parseInt(sizeString, 10) * 1024 * 1024 * 1024 : parseInt(sizeString, 10) * 1024 * 1024;
|
||||
let bank = util.getValue(lines, 'Bank Locator');
|
||||
if (bank.toLowerCase().indexOf('bad') >= 0) {
|
||||
bank = '';
|
||||
}
|
||||
if (parseInt(util.getValue(lines, 'Size'), 10) > 0) {
|
||||
const totalWidth = util.toInt(util.getValue(lines, 'Total Width'));
|
||||
const dataWidth = util.toInt(util.getValue(lines, 'Data Width'));
|
||||
result.push({
|
||||
size,
|
||||
bank,
|
||||
type: util.getValue(lines, 'Type:'),
|
||||
ecc: dataWidth && totalWidth ? totalWidth > dataWidth : false,
|
||||
clockSpeed: (util.getValue(lines, 'Configured Clock Speed:') ? parseInt(util.getValue(lines, 'Configured Clock Speed:'), 10) : (util.getValue(lines, 'Speed:') ? parseInt(util.getValue(lines, 'Speed:'), 10) : null)),
|
||||
formFactor: util.getValue(lines, 'Form Factor:'),
|
||||
manufacturer: getManufacturer(util.getValue(lines, 'Manufacturer:')),
|
||||
partNum: util.getValue(lines, 'Part Number:'),
|
||||
serialNum: util.getValue(lines, 'Serial Number:'),
|
||||
voltageConfigured: parseFloat(util.getValue(lines, 'Configured Voltage:')) || null,
|
||||
voltageMin: parseFloat(util.getValue(lines, 'Minimum Voltage:')) || null,
|
||||
voltageMax: parseFloat(util.getValue(lines, 'Maximum Voltage:')) || null,
|
||||
});
|
||||
} else {
|
||||
result.push({
|
||||
size: 0,
|
||||
bank,
|
||||
type: 'Empty',
|
||||
ecc: null,
|
||||
clockSpeed: 0,
|
||||
formFactor: util.getValue(lines, 'Form Factor:'),
|
||||
partNum: '',
|
||||
serialNum: '',
|
||||
voltageConfigured: null,
|
||||
voltageMin: null,
|
||||
voltageMax: null,
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
if (!result.length) {
|
||||
result.push({
|
||||
size: os.totalmem(),
|
||||
bank: '',
|
||||
type: '',
|
||||
ecc: null,
|
||||
clockSpeed: 0,
|
||||
formFactor: '',
|
||||
partNum: '',
|
||||
serialNum: '',
|
||||
voltageConfigured: null,
|
||||
voltageMin: null,
|
||||
voltageMax: null,
|
||||
});
|
||||
|
||||
// Try Raspberry PI
|
||||
try {
|
||||
let stdout = execSync('cat /proc/cpuinfo 2>/dev/null', util.execOptsLinux);
|
||||
let lines = stdout.toString().split('\n');
|
||||
let version = util.getValue(lines, 'revision', ':', true).toLowerCase();
|
||||
|
||||
if (util.isRaspberry(lines)) {
|
||||
|
||||
const clockSpeed = {
|
||||
'0': 400,
|
||||
'1': 450,
|
||||
'2': 450,
|
||||
'3': 3200,
|
||||
'4': 4267
|
||||
};
|
||||
result[0].type = 'LPDDR2';
|
||||
result[0].type = version && version[2] && (version[2] === '3') ? 'LPDDR4' : result[0].type;
|
||||
result[0].type = version && version[2] && (version[2] === '4') ? 'LPDDR4X' : result[0].type;
|
||||
result[0].ecc = false;
|
||||
result[0].clockSpeed = version && version[2] && clockSpeed[version[2]] || 400;
|
||||
result[0].clockSpeed = version && version[4] && version[4] === 'd' ? 500 : result[0].clockSpeed;
|
||||
result[0].formFactor = 'SoC';
|
||||
|
||||
stdout = execSync('vcgencmd get_config sdram_freq 2>/dev/null', util.execOptsLinux);
|
||||
lines = stdout.toString().split('\n');
|
||||
let freq = parseInt(util.getValue(lines, 'sdram_freq', '=', true), 10) || 0;
|
||||
if (freq) {
|
||||
result[0].clockSpeed = freq;
|
||||
exec(
|
||||
'export LC_ALL=C; dmidecode -t memory 2>/dev/null | grep -iE "Size:|Type|Speed|Manufacturer|Form Factor|Locator|Memory Device|Serial Number|Voltage|Part Number"; unset LC_ALL',
|
||||
function (error, stdout) {
|
||||
if (!error) {
|
||||
let devices = stdout.toString().split('Memory Device');
|
||||
devices.shift();
|
||||
devices.forEach(function (device) {
|
||||
let lines = device.split('\n');
|
||||
const sizeString = util.getValue(lines, 'Size');
|
||||
const size = sizeString.indexOf('GB') >= 0 ? parseInt(sizeString, 10) * 1024 * 1024 * 1024 : parseInt(sizeString, 10) * 1024 * 1024;
|
||||
let bank = util.getValue(lines, 'Bank Locator');
|
||||
if (bank.toLowerCase().indexOf('bad') >= 0) {
|
||||
bank = '';
|
||||
}
|
||||
|
||||
stdout = execSync('vcgencmd measure_volts sdram_p 2>/dev/null', util.execOptsLinux);
|
||||
lines = stdout.toString().split('\n');
|
||||
let voltage = parseFloat(util.getValue(lines, 'volt', '=', true)) || 0;
|
||||
if (voltage) {
|
||||
result[0].voltageConfigured = voltage;
|
||||
result[0].voltageMin = voltage;
|
||||
result[0].voltageMax = voltage;
|
||||
if (parseInt(util.getValue(lines, 'Size'), 10) > 0) {
|
||||
const totalWidth = util.toInt(util.getValue(lines, 'Total Width'));
|
||||
const dataWidth = util.toInt(util.getValue(lines, 'Data Width'));
|
||||
result.push({
|
||||
size,
|
||||
bank,
|
||||
type: util.getValue(lines, 'Type:'),
|
||||
ecc: dataWidth && totalWidth ? totalWidth > dataWidth : false,
|
||||
clockSpeed: util.getValue(lines, 'Configured Clock Speed:')
|
||||
? parseInt(util.getValue(lines, 'Configured Clock Speed:'), 10)
|
||||
: util.getValue(lines, 'Speed:')
|
||||
? parseInt(util.getValue(lines, 'Speed:'), 10)
|
||||
: null,
|
||||
formFactor: util.getValue(lines, 'Form Factor:'),
|
||||
manufacturer: getManufacturer(util.getValue(lines, 'Manufacturer:')),
|
||||
partNum: util.getValue(lines, 'Part Number:'),
|
||||
serialNum: util.getValue(lines, 'Serial Number:'),
|
||||
voltageConfigured: parseFloat(util.getValue(lines, 'Configured Voltage:')) || null,
|
||||
voltageMin: parseFloat(util.getValue(lines, 'Minimum Voltage:')) || null,
|
||||
voltageMax: parseFloat(util.getValue(lines, 'Maximum Voltage:')) || null
|
||||
});
|
||||
} else {
|
||||
result.push({
|
||||
size: 0,
|
||||
bank,
|
||||
type: 'Empty',
|
||||
ecc: null,
|
||||
clockSpeed: 0,
|
||||
formFactor: util.getValue(lines, 'Form Factor:'),
|
||||
partNum: '',
|
||||
serialNum: '',
|
||||
voltageConfigured: null,
|
||||
voltageMin: null,
|
||||
voltageMax: null
|
||||
});
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
util.noop();
|
||||
});
|
||||
}
|
||||
if (!result.length) {
|
||||
result.push({
|
||||
size: os.totalmem(),
|
||||
bank: '',
|
||||
type: '',
|
||||
ecc: null,
|
||||
clockSpeed: 0,
|
||||
formFactor: '',
|
||||
partNum: '',
|
||||
serialNum: '',
|
||||
voltageConfigured: null,
|
||||
voltageMin: null,
|
||||
voltageMax: null
|
||||
});
|
||||
|
||||
// Try Raspberry PI
|
||||
try {
|
||||
let stdout = execSync('cat /proc/cpuinfo 2>/dev/null', util.execOptsLinux);
|
||||
let lines = stdout.toString().split('\n');
|
||||
let version = util.getValue(lines, 'revision', ':', true).toLowerCase();
|
||||
|
||||
if (util.isRaspberry(lines)) {
|
||||
const clockSpeed = {
|
||||
0: 400,
|
||||
1: 450,
|
||||
2: 450,
|
||||
3: 3200,
|
||||
4: 4267
|
||||
};
|
||||
result[0].type = 'LPDDR2';
|
||||
result[0].type = version && version[2] && version[2] === '3' ? 'LPDDR4' : result[0].type;
|
||||
result[0].type = version && version[2] && version[2] === '4' ? 'LPDDR4X' : result[0].type;
|
||||
result[0].ecc = false;
|
||||
result[0].clockSpeed = (version && version[2] && clockSpeed[version[2]]) || 400;
|
||||
result[0].clockSpeed = version && version[4] && version[4] === 'd' ? 500 : result[0].clockSpeed;
|
||||
result[0].formFactor = 'SoC';
|
||||
|
||||
stdout = execSync('vcgencmd get_config sdram_freq 2>/dev/null', util.execOptsLinux);
|
||||
lines = stdout.toString().split('\n');
|
||||
let freq = parseInt(util.getValue(lines, 'sdram_freq', '=', true), 10) || 0;
|
||||
if (freq) {
|
||||
result[0].clockSpeed = freq;
|
||||
}
|
||||
|
||||
stdout = execSync('vcgencmd measure_volts sdram_p 2>/dev/null', util.execOptsLinux);
|
||||
lines = stdout.toString().split('\n');
|
||||
let voltage = parseFloat(util.getValue(lines, 'volt', '=', true)) || 0;
|
||||
if (voltage) {
|
||||
result[0].voltageConfigured = voltage;
|
||||
result[0].voltageMin = voltage;
|
||||
result[0].voltageMax = voltage;
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
util.noop();
|
||||
}
|
||||
}
|
||||
if (callback) {
|
||||
callback(result);
|
||||
}
|
||||
resolve(result);
|
||||
}
|
||||
if (callback) { callback(result); }
|
||||
resolve(result);
|
||||
});
|
||||
);
|
||||
}
|
||||
|
||||
if (_darwin) {
|
||||
@ -464,7 +498,7 @@ function memLayout(callback) {
|
||||
serialNum: util.getValue(lines, ' Serial Number:'),
|
||||
voltageConfigured: null,
|
||||
voltageMin: null,
|
||||
voltageMax: null,
|
||||
voltageMax: null
|
||||
});
|
||||
} else {
|
||||
result.push({
|
||||
@ -479,7 +513,7 @@ function memLayout(callback) {
|
||||
serialNum: '',
|
||||
voltageConfigured: null,
|
||||
voltageMin: null,
|
||||
voltageMax: null,
|
||||
voltageMax: null
|
||||
});
|
||||
}
|
||||
});
|
||||
@ -502,59 +536,73 @@ function memLayout(callback) {
|
||||
serialNum: '',
|
||||
voltageConfigured: null,
|
||||
voltageMin: null,
|
||||
voltageMax: null,
|
||||
voltageMax: null
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
if (callback) { callback(result); }
|
||||
if (callback) {
|
||||
callback(result);
|
||||
}
|
||||
resolve(result);
|
||||
});
|
||||
}
|
||||
if (_sunos) {
|
||||
if (callback) { callback(result); }
|
||||
if (callback) {
|
||||
callback(result);
|
||||
}
|
||||
resolve(result);
|
||||
}
|
||||
if (_windows) {
|
||||
// https://www.dmtf.org/sites/default/files/standards/documents/DSP0134_3.4.0a.pdf
|
||||
const memoryTypes = 'Unknown|Other|DRAM|Synchronous DRAM|Cache DRAM|EDO|EDRAM|VRAM|SRAM|RAM|ROM|FLASH|EEPROM|FEPROM|EPROM|CDRAM|3DRAM|SDRAM|SGRAM|RDRAM|DDR|DDR2|DDR2 FB-DIMM|Reserved|DDR3|FBD2|DDR4|LPDDR|LPDDR2|LPDDR3|LPDDR4|Logical non-volatile device|HBM|HBM2|DDR5|LPDDR5'.split('|');
|
||||
const memoryTypes =
|
||||
'Unknown|Other|DRAM|Synchronous DRAM|Cache DRAM|EDO|EDRAM|VRAM|SRAM|RAM|ROM|FLASH|EEPROM|FEPROM|EPROM|CDRAM|3DRAM|SDRAM|SGRAM|RDRAM|DDR|DDR2|DDR2 FB-DIMM|Reserved|DDR3|FBD2|DDR4|LPDDR|LPDDR2|LPDDR3|LPDDR4|Logical non-volatile device|HBM|HBM2|DDR5|LPDDR5'.split(
|
||||
'|'
|
||||
);
|
||||
const FormFactors = 'Unknown|Other|SIP|DIP|ZIP|SOJ|Proprietary|SIMM|DIMM|TSOP|PGA|RIMM|SODIMM|SRIMM|SMD|SSMP|QFP|TQFP|SOIC|LCC|PLCC|BGA|FPBGA|LGA'.split('|');
|
||||
|
||||
try {
|
||||
util.powerShell('Get-CimInstance Win32_PhysicalMemory | select DataWidth,TotalWidth,Capacity,BankLabel,MemoryType,SMBIOSMemoryType,ConfiguredClockSpeed,Speed,FormFactor,Manufacturer,PartNumber,SerialNumber,ConfiguredVoltage,MinVoltage,MaxVoltage,Tag | fl').then((stdout, error) => {
|
||||
if (!error) {
|
||||
let devices = stdout.toString().split(/\n\s*\n/);
|
||||
devices.shift();
|
||||
devices.forEach(function (device) {
|
||||
let lines = device.split('\r\n');
|
||||
const dataWidth = util.toInt(util.getValue(lines, 'DataWidth', ':'));
|
||||
const totalWidth = util.toInt(util.getValue(lines, 'TotalWidth', ':'));
|
||||
const size = parseInt(util.getValue(lines, 'Capacity', ':'), 10) || 0;
|
||||
const tag = util.getValue(lines, 'Tag', ':');
|
||||
const tagInt = util.splitByNumber(tag);
|
||||
if (size) {
|
||||
result.push({
|
||||
size,
|
||||
bank: util.getValue(lines, 'BankLabel', ':') + (tagInt[1] ? '/' + tagInt[1] : ''), // BankLabel
|
||||
type: memoryTypes[parseInt(util.getValue(lines, 'MemoryType', ':'), 10) || parseInt(util.getValue(lines, 'SMBIOSMemoryType', ':'), 10)],
|
||||
ecc: dataWidth && totalWidth ? totalWidth > dataWidth : false,
|
||||
clockSpeed: parseInt(util.getValue(lines, 'ConfiguredClockSpeed', ':'), 10) || parseInt(util.getValue(lines, 'Speed', ':'), 10) || 0,
|
||||
formFactor: FormFactors[parseInt(util.getValue(lines, 'FormFactor', ':'), 10) || 0],
|
||||
manufacturer: getManufacturer(util.getValue(lines, 'Manufacturer', ':')),
|
||||
partNum: util.getValue(lines, 'PartNumber', ':'),
|
||||
serialNum: util.getValue(lines, 'SerialNumber', ':'),
|
||||
voltageConfigured: (parseInt(util.getValue(lines, 'ConfiguredVoltage', ':'), 10) || 0) / 1000.0,
|
||||
voltageMin: (parseInt(util.getValue(lines, 'MinVoltage', ':'), 10) || 0) / 1000.0,
|
||||
voltageMax: (parseInt(util.getValue(lines, 'MaxVoltage', ':'), 10) || 0) / 1000.0,
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
if (callback) { callback(result); }
|
||||
resolve(result);
|
||||
});
|
||||
util
|
||||
.powerShell(
|
||||
'Get-CimInstance Win32_PhysicalMemory | select DataWidth,TotalWidth,Capacity,BankLabel,MemoryType,SMBIOSMemoryType,ConfiguredClockSpeed,Speed,FormFactor,Manufacturer,PartNumber,SerialNumber,ConfiguredVoltage,MinVoltage,MaxVoltage,Tag | fl'
|
||||
)
|
||||
.then((stdout, error) => {
|
||||
if (!error) {
|
||||
let devices = stdout.toString().split(/\n\s*\n/);
|
||||
devices.shift();
|
||||
devices.forEach(function (device) {
|
||||
let lines = device.split('\r\n');
|
||||
const dataWidth = util.toInt(util.getValue(lines, 'DataWidth', ':'));
|
||||
const totalWidth = util.toInt(util.getValue(lines, 'TotalWidth', ':'));
|
||||
const size = parseInt(util.getValue(lines, 'Capacity', ':'), 10) || 0;
|
||||
const tag = util.getValue(lines, 'Tag', ':');
|
||||
const tagInt = util.splitByNumber(tag);
|
||||
if (size) {
|
||||
result.push({
|
||||
size,
|
||||
bank: util.getValue(lines, 'BankLabel', ':') + (tagInt[1] ? '/' + tagInt[1] : ''), // BankLabel
|
||||
type: memoryTypes[parseInt(util.getValue(lines, 'MemoryType', ':'), 10) || parseInt(util.getValue(lines, 'SMBIOSMemoryType', ':'), 10)],
|
||||
ecc: dataWidth && totalWidth ? totalWidth > dataWidth : false,
|
||||
clockSpeed: parseInt(util.getValue(lines, 'ConfiguredClockSpeed', ':'), 10) || parseInt(util.getValue(lines, 'Speed', ':'), 10) || 0,
|
||||
formFactor: FormFactors[parseInt(util.getValue(lines, 'FormFactor', ':'), 10) || 0],
|
||||
manufacturer: getManufacturer(util.getValue(lines, 'Manufacturer', ':')),
|
||||
partNum: util.getValue(lines, 'PartNumber', ':'),
|
||||
serialNum: util.getValue(lines, 'SerialNumber', ':'),
|
||||
voltageConfigured: (parseInt(util.getValue(lines, 'ConfiguredVoltage', ':'), 10) || 0) / 1000.0,
|
||||
voltageMin: (parseInt(util.getValue(lines, 'MinVoltage', ':'), 10) || 0) / 1000.0,
|
||||
voltageMax: (parseInt(util.getValue(lines, 'MaxVoltage', ':'), 10) || 0) / 1000.0
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
if (callback) {
|
||||
callback(result);
|
||||
}
|
||||
resolve(result);
|
||||
});
|
||||
} catch (e) {
|
||||
if (callback) { callback(result); }
|
||||
if (callback) {
|
||||
callback(result);
|
||||
}
|
||||
resolve(result);
|
||||
}
|
||||
}
|
||||
@ -563,4 +611,3 @@ function memLayout(callback) {
|
||||
}
|
||||
|
||||
exports.memLayout = memLayout;
|
||||
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
// ----------------------------------------------------------------------------------
|
||||
// Description: System Information - library
|
||||
// for Node.js
|
||||
// Copyright: (c) 2014 - 2025
|
||||
// Copyright: (c) 2014 - 2026
|
||||
// Author: Sebastian Hildebrandt
|
||||
// ----------------------------------------------------------------------------------
|
||||
// License: MIT
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
// ----------------------------------------------------------------------------------
|
||||
// Description: System Information - library
|
||||
// for Node.js
|
||||
// Copyright: (c) 2014 - 2025
|
||||
// Copyright: (c) 2014 - 2026
|
||||
// Author: Sebastian Hildebrandt
|
||||
// ----------------------------------------------------------------------------------
|
||||
// License: MIT
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
// ----------------------------------------------------------------------------------
|
||||
// Description: System Information - library
|
||||
// for Node.js
|
||||
// Copyright: (c) 2014 - 2025
|
||||
// Copyright: (c) 2014 - 2026
|
||||
// Author: Sebastian Hildebrandt
|
||||
// ----------------------------------------------------------------------------------
|
||||
// License: MIT
|
||||
@ -18,13 +18,13 @@ const util = require('./util');
|
||||
|
||||
let _platform = process.platform;
|
||||
|
||||
const _linux = (_platform === 'linux' || _platform === 'android');
|
||||
const _darwin = (_platform === 'darwin');
|
||||
const _windows = (_platform === 'win32');
|
||||
const _freebsd = (_platform === 'freebsd');
|
||||
const _openbsd = (_platform === 'openbsd');
|
||||
const _netbsd = (_platform === 'netbsd');
|
||||
const _sunos = (_platform === 'sunos');
|
||||
const _linux = _platform === 'linux' || _platform === 'android';
|
||||
const _darwin = _platform === 'darwin';
|
||||
const _windows = _platform === 'win32';
|
||||
const _freebsd = _platform === 'freebsd';
|
||||
const _openbsd = _platform === 'openbsd';
|
||||
const _netbsd = _platform === 'netbsd';
|
||||
const _sunos = _platform === 'sunos';
|
||||
|
||||
const winPrinterStatus = {
|
||||
1: 'Other',
|
||||
@ -33,7 +33,7 @@ const winPrinterStatus = {
|
||||
4: 'Printing',
|
||||
5: 'Warmup',
|
||||
6: 'Stopped Printing',
|
||||
7: 'Offline',
|
||||
7: 'Offline'
|
||||
};
|
||||
|
||||
function parseLinuxCupsHeader(lines) {
|
||||
@ -70,7 +70,7 @@ function parseLinuxLpstatPrinter(lines, id) {
|
||||
result.model = lines.length > 0 && lines[0] ? lines[0].split(' ')[0] : '';
|
||||
result.uri = null;
|
||||
result.uuid = null;
|
||||
result.status = lines.length > 0 && lines[0] ? (lines[0].indexOf(' idle') > 0 ? 'idle' : (lines[0].indexOf(' printing') > 0 ? 'printing' : 'unknown')) : null;
|
||||
result.status = lines.length > 0 && lines[0] ? (lines[0].indexOf(' idle') > 0 ? 'idle' : lines[0].indexOf(' printing') > 0 ? 'printing' : 'unknown') : null;
|
||||
result.local = util.getValue(lines, 'Location', ':', true).toLowerCase().startsWith('local');
|
||||
result.default = null;
|
||||
result.shared = util.getValue(lines, 'Shared', ' ').toLowerCase().startsWith('yes');
|
||||
@ -112,7 +112,6 @@ function parseWindowsPrinters(lines, id) {
|
||||
}
|
||||
|
||||
function printer(callback) {
|
||||
|
||||
return new Promise((resolve) => {
|
||||
process.nextTick(() => {
|
||||
let result = [];
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
// ----------------------------------------------------------------------------------
|
||||
// Description: System Information - library
|
||||
// for Node.js
|
||||
// Copyright: (c) 2014 - 2025
|
||||
// Copyright: (c) 2014 - 2026
|
||||
// Author: Sebastian Hildebrandt
|
||||
// ----------------------------------------------------------------------------------
|
||||
// License: MIT
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
// ----------------------------------------------------------------------------------
|
||||
// Description: System Information - library
|
||||
// for Node.js
|
||||
// Copyright: (c) 2014 - 2025
|
||||
// Copyright: (c) 2014 - 2026
|
||||
// Author: Sebastian Hildebrandt
|
||||
// ----------------------------------------------------------------------------------
|
||||
// License: MIT
|
||||
@ -250,7 +250,7 @@ function system(callback) {
|
||||
});
|
||||
}
|
||||
if (_darwin) {
|
||||
exec('ioreg -c IOPlatformExpertDevice -d 2', (error, stdout) => {
|
||||
exec('ioreg -c IOPlatformExpertDevice -d 2', (error, stdout) => {
|
||||
if (!error) {
|
||||
const lines = stdout.toString().replace(/[<>"]/g, '').split('\n');
|
||||
|
||||
|
||||
124
lib/usb.js
124
lib/usb.js
@ -5,7 +5,7 @@
|
||||
// ----------------------------------------------------------------------------------
|
||||
// Description: System Information - library
|
||||
// for Node.js
|
||||
// Copyright: (c) 2014 - 2025
|
||||
// Copyright: (c) 2014 - 2026
|
||||
// Author: Sebastian Hildebrandt
|
||||
// ----------------------------------------------------------------------------------
|
||||
// License: MIT
|
||||
@ -18,26 +18,36 @@ const util = require('./util');
|
||||
|
||||
let _platform = process.platform;
|
||||
|
||||
const _linux = (_platform === 'linux' || _platform === 'android');
|
||||
const _darwin = (_platform === 'darwin');
|
||||
const _windows = (_platform === 'win32');
|
||||
const _freebsd = (_platform === 'freebsd');
|
||||
const _openbsd = (_platform === 'openbsd');
|
||||
const _netbsd = (_platform === 'netbsd');
|
||||
const _sunos = (_platform === 'sunos');
|
||||
const _linux = _platform === 'linux' || _platform === 'android';
|
||||
const _darwin = _platform === 'darwin';
|
||||
const _windows = _platform === 'win32';
|
||||
const _freebsd = _platform === 'freebsd';
|
||||
const _openbsd = _platform === 'openbsd';
|
||||
const _netbsd = _platform === 'netbsd';
|
||||
const _sunos = _platform === 'sunos';
|
||||
|
||||
function getLinuxUsbType(type, name) {
|
||||
let result = type;
|
||||
const str = (name + ' ' + type).toLowerCase();
|
||||
if (str.indexOf('camera') >= 0) { result = 'Camera'; }
|
||||
else if (str.indexOf('hub') >= 0) { result = 'Hub'; }
|
||||
else if (str.indexOf('keybrd') >= 0) { result = 'Keyboard'; }
|
||||
else if (str.indexOf('keyboard') >= 0) { result = 'Keyboard'; }
|
||||
else if (str.indexOf('mouse') >= 0) { result = 'Mouse'; }
|
||||
else if (str.indexOf('stora') >= 0) { result = 'Storage'; }
|
||||
else if (str.indexOf('microp') >= 0) { result = 'Microphone'; }
|
||||
else if (str.indexOf('headset') >= 0) { result = 'Audio'; }
|
||||
else if (str.indexOf('audio') >= 0) { result = 'Audio'; }
|
||||
if (str.indexOf('camera') >= 0) {
|
||||
result = 'Camera';
|
||||
} else if (str.indexOf('hub') >= 0) {
|
||||
result = 'Hub';
|
||||
} else if (str.indexOf('keybrd') >= 0) {
|
||||
result = 'Keyboard';
|
||||
} else if (str.indexOf('keyboard') >= 0) {
|
||||
result = 'Keyboard';
|
||||
} else if (str.indexOf('mouse') >= 0) {
|
||||
result = 'Mouse';
|
||||
} else if (str.indexOf('stora') >= 0) {
|
||||
result = 'Storage';
|
||||
} else if (str.indexOf('microp') >= 0) {
|
||||
result = 'Microphone';
|
||||
} else if (str.indexOf('headset') >= 0) {
|
||||
result = 'Audio';
|
||||
} else if (str.indexOf('audio') >= 0) {
|
||||
result = 'Audio';
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
@ -96,21 +106,37 @@ function parseLinuxUsb(usb) {
|
||||
|
||||
function getDarwinUsbType(name) {
|
||||
let result = '';
|
||||
if (name.indexOf('camera') >= 0) { result = 'Camera'; }
|
||||
else if (name.indexOf('touch bar') >= 0) { result = 'Touch Bar'; }
|
||||
else if (name.indexOf('controller') >= 0) { result = 'Controller'; }
|
||||
else if (name.indexOf('headset') >= 0) { result = 'Audio'; }
|
||||
else if (name.indexOf('keyboard') >= 0) { result = 'Keyboard'; }
|
||||
else if (name.indexOf('trackpad') >= 0) { result = 'Trackpad'; }
|
||||
else if (name.indexOf('sensor') >= 0) { result = 'Sensor'; }
|
||||
else if (name.indexOf('bthusb') >= 0) { result = 'Bluetooth'; }
|
||||
else if (name.indexOf('bth') >= 0) { result = 'Bluetooth'; }
|
||||
else if (name.indexOf('rfcomm') >= 0) { result = 'Bluetooth'; }
|
||||
else if (name.indexOf('usbhub') >= 0) { result = 'Hub'; }
|
||||
else if (name.indexOf(' hub') >= 0) { result = 'Hub'; }
|
||||
else if (name.indexOf('mouse') >= 0) { result = 'Mouse'; }
|
||||
else if (name.indexOf('microp') >= 0) { result = 'Microphone'; }
|
||||
else if (name.indexOf('removable') >= 0) { result = 'Storage'; }
|
||||
if (name.indexOf('camera') >= 0) {
|
||||
result = 'Camera';
|
||||
} else if (name.indexOf('touch bar') >= 0) {
|
||||
result = 'Touch Bar';
|
||||
} else if (name.indexOf('controller') >= 0) {
|
||||
result = 'Controller';
|
||||
} else if (name.indexOf('headset') >= 0) {
|
||||
result = 'Audio';
|
||||
} else if (name.indexOf('keyboard') >= 0) {
|
||||
result = 'Keyboard';
|
||||
} else if (name.indexOf('trackpad') >= 0) {
|
||||
result = 'Trackpad';
|
||||
} else if (name.indexOf('sensor') >= 0) {
|
||||
result = 'Sensor';
|
||||
} else if (name.indexOf('bthusb') >= 0) {
|
||||
result = 'Bluetooth';
|
||||
} else if (name.indexOf('bth') >= 0) {
|
||||
result = 'Bluetooth';
|
||||
} else if (name.indexOf('rfcomm') >= 0) {
|
||||
result = 'Bluetooth';
|
||||
} else if (name.indexOf('usbhub') >= 0) {
|
||||
result = 'Hub';
|
||||
} else if (name.indexOf(' hub') >= 0) {
|
||||
result = 'Hub';
|
||||
} else if (name.indexOf('mouse') >= 0) {
|
||||
result = 'Mouse';
|
||||
} else if (name.indexOf('microp') >= 0) {
|
||||
result = 'Microphone';
|
||||
} else if (name.indexOf('removable') >= 0) {
|
||||
result = 'Storage';
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -174,15 +200,25 @@ function parseDarwinUsb(usb, id) {
|
||||
|
||||
function getWindowsUsbTypeCreation(creationclass, name) {
|
||||
let result = '';
|
||||
if (name.indexOf('storage') >= 0) { result = 'Storage'; }
|
||||
else if (name.indexOf('speicher') >= 0) { result = 'Storage'; }
|
||||
else if (creationclass.indexOf('usbhub') >= 0) { result = 'Hub'; }
|
||||
else if (creationclass.indexOf('storage') >= 0) { result = 'Storage'; }
|
||||
else if (creationclass.indexOf('usbcontroller') >= 0) { result = 'Controller'; }
|
||||
else if (creationclass.indexOf('keyboard') >= 0) { result = 'Keyboard'; }
|
||||
else if (creationclass.indexOf('pointing') >= 0) { result = 'Mouse'; }
|
||||
else if (creationclass.indexOf('microp') >= 0) { result = 'Microphone'; }
|
||||
else if (creationclass.indexOf('disk') >= 0) { result = 'Storage'; }
|
||||
if (name.indexOf('storage') >= 0) {
|
||||
result = 'Storage';
|
||||
} else if (name.indexOf('speicher') >= 0) {
|
||||
result = 'Storage';
|
||||
} else if (creationclass.indexOf('usbhub') >= 0) {
|
||||
result = 'Hub';
|
||||
} else if (creationclass.indexOf('storage') >= 0) {
|
||||
result = 'Storage';
|
||||
} else if (creationclass.indexOf('usbcontroller') >= 0) {
|
||||
result = 'Controller';
|
||||
} else if (creationclass.indexOf('keyboard') >= 0) {
|
||||
result = 'Keyboard';
|
||||
} else if (creationclass.indexOf('pointing') >= 0) {
|
||||
result = 'Mouse';
|
||||
} else if (creationclass.indexOf('microp') >= 0) {
|
||||
result = 'Microphone';
|
||||
} else if (creationclass.indexOf('disk') >= 0) {
|
||||
result = 'Storage';
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -209,7 +245,6 @@ function parseWindowsUsb(lines, id) {
|
||||
}
|
||||
|
||||
function usb(callback) {
|
||||
|
||||
return new Promise((resolve) => {
|
||||
process.nextTick(() => {
|
||||
let result = [];
|
||||
@ -233,7 +268,7 @@ function usb(callback) {
|
||||
let cmd = 'ioreg -p IOUSB -c AppleUSBRootHubDevice -w0 -l';
|
||||
exec(cmd, { maxBuffer: 1024 * 1024 * 128 }, function (error, stdout) {
|
||||
if (!error) {
|
||||
const parts = (stdout.toString()).split(' +-o ');
|
||||
const parts = stdout.toString().split(' +-o ');
|
||||
for (let i = 1; i < parts.length; i++) {
|
||||
const usb = parseDarwinUsb(parts[i]);
|
||||
if (usb) {
|
||||
@ -257,7 +292,7 @@ function usb(callback) {
|
||||
const parts = stdout.toString().split(/\n\s*\n/);
|
||||
for (let i = 0; i < parts.length; i++) {
|
||||
const usb = parseWindowsUsb(parts[i].split('\n'), i);
|
||||
if (usb && result.filter(x => x.deviceId === usb.deviceId).length === 0) {
|
||||
if (usb && result.filter((x) => x.deviceId === usb.deviceId).length === 0) {
|
||||
result.push(usb);
|
||||
}
|
||||
}
|
||||
@ -276,4 +311,3 @@ function usb(callback) {
|
||||
}
|
||||
|
||||
exports.usb = usb;
|
||||
|
||||
|
||||
110
lib/users.js
110
lib/users.js
@ -5,7 +5,7 @@
|
||||
// ----------------------------------------------------------------------------------
|
||||
// Description: System Information - library
|
||||
// for Node.js
|
||||
// Copyright: (c) 2014 - 2025
|
||||
// Copyright: (c) 2014 - 2026
|
||||
// Author: Sebastian Hildebrandt
|
||||
// ----------------------------------------------------------------------------------
|
||||
// License: MIT
|
||||
@ -18,13 +18,13 @@ const util = require('./util');
|
||||
|
||||
let _platform = process.platform;
|
||||
|
||||
const _linux = (_platform === 'linux' || _platform === 'android');
|
||||
const _darwin = (_platform === 'darwin');
|
||||
const _windows = (_platform === 'win32');
|
||||
const _freebsd = (_platform === 'freebsd');
|
||||
const _openbsd = (_platform === 'openbsd');
|
||||
const _netbsd = (_platform === 'netbsd');
|
||||
const _sunos = (_platform === 'sunos');
|
||||
const _linux = _platform === 'linux' || _platform === 'android';
|
||||
const _darwin = _platform === 'darwin';
|
||||
const _windows = _platform === 'win32';
|
||||
const _freebsd = _platform === 'freebsd';
|
||||
const _openbsd = _platform === 'openbsd';
|
||||
const _netbsd = _platform === 'netbsd';
|
||||
const _sunos = _platform === 'sunos';
|
||||
|
||||
function parseUsersLinux(lines, phase) {
|
||||
let result = [];
|
||||
@ -49,11 +49,12 @@ function parseUsersLinux(lines, phase) {
|
||||
tty: l[1],
|
||||
date: l[2],
|
||||
time: l[3],
|
||||
ip: (l && l.length > 4) ? l[4].replace(/\(/g, '').replace(/\)/g, '') : ''
|
||||
ip: l && l.length > 4 ? l[4].replace(/\(/g, '').replace(/\)/g, '') : ''
|
||||
});
|
||||
} else {
|
||||
// w part
|
||||
if (w_first) { // header
|
||||
if (w_first) {
|
||||
// header
|
||||
w_header = l;
|
||||
w_header.forEach(function (item) {
|
||||
w_pos.push(line.indexOf(item));
|
||||
@ -63,11 +64,15 @@ function parseUsersLinux(lines, phase) {
|
||||
// split by w_pos
|
||||
result_w.user = line.substring(w_pos[0], w_pos[1] - 1).trim();
|
||||
result_w.tty = line.substring(w_pos[1], w_pos[2] - 1).trim();
|
||||
result_w.ip = line.substring(w_pos[2], w_pos[3] - 1).replace(/\(/g, '').replace(/\)/g, '').trim();
|
||||
result_w.ip = line
|
||||
.substring(w_pos[2], w_pos[3] - 1)
|
||||
.replace(/\(/g, '')
|
||||
.replace(/\)/g, '')
|
||||
.trim();
|
||||
result_w.command = line.substring(w_pos[7], 1000).trim();
|
||||
// find corresponding 'who' line
|
||||
who_line = result_who.filter(function (obj) {
|
||||
return (obj.user.substring(0, 8).trim() === result_w.user && obj.tty === result_w.tty);
|
||||
return obj.user.substring(0, 8).trim() === result_w.user && obj.tty === result_w.tty;
|
||||
});
|
||||
if (who_line.length === 1) {
|
||||
result.push({
|
||||
@ -105,10 +110,10 @@ function parseUsersDarwin(lines) {
|
||||
|
||||
// who part
|
||||
if (is_whopart) {
|
||||
let dt = ('' + new Date().getFullYear()) + '-' + ('0' + ('JANFEBMARAPRMAYJUNJULAUGSEPOCTNOVDEC'.indexOf(l[2].toUpperCase()) / 3 + 1)).slice(-2) + '-' + ('0' + l[3]).slice(-2);
|
||||
let dt = '' + new Date().getFullYear() + '-' + ('0' + ('JANFEBMARAPRMAYJUNJULAUGSEPOCTNOVDEC'.indexOf(l[2].toUpperCase()) / 3 + 1)).slice(-2) + '-' + ('0' + l[3]).slice(-2);
|
||||
try {
|
||||
if (new Date(dt) > new Date) {
|
||||
dt = ('' + (new Date().getFullYear() - 1)) + '-' + ('0' + ('JANFEBMARAPRMAYJUNJULAUGSEPOCTNOVDEC'.indexOf(l[2].toUpperCase()) / 3 + 1)).slice(-2) + '-' + ('0' + l[3]).slice(-2);
|
||||
if (new Date(dt) > new Date()) {
|
||||
dt = '' + (new Date().getFullYear() - 1) + '-' + ('0' + ('JANFEBMARAPRMAYJUNJULAUGSEPOCTNOVDEC'.indexOf(l[2].toUpperCase()) / 3 + 1)).slice(-2) + '-' + ('0' + l[3]).slice(-2);
|
||||
}
|
||||
} catch {
|
||||
util.noop();
|
||||
@ -117,18 +122,18 @@ function parseUsersDarwin(lines) {
|
||||
user: l[0],
|
||||
tty: l[1],
|
||||
date: dt,
|
||||
time: l[4],
|
||||
time: l[4]
|
||||
});
|
||||
} else {
|
||||
// w part
|
||||
// split by w_pos
|
||||
result_w.user = l[0];
|
||||
result_w.tty = l[1];
|
||||
result_w.ip = (l[2] !== '-') ? l[2] : '';
|
||||
result_w.ip = l[2] !== '-' ? l[2] : '';
|
||||
result_w.command = l.slice(5, 1000).join(' ');
|
||||
// find corresponding 'who' line
|
||||
who_line = result_who.filter(function (obj) {
|
||||
return (obj.user.substring(0, 10) === result_w.user.substring(0, 10) && (obj.tty.substring(3, 1000) === result_w.tty || obj.tty === result_w.tty));
|
||||
return obj.user.substring(0, 10) === result_w.user.substring(0, 10) && (obj.tty.substring(3, 1000) === result_w.tty || obj.tty === result_w.tty);
|
||||
});
|
||||
if (who_line.length === 1) {
|
||||
result.push({
|
||||
@ -147,7 +152,6 @@ function parseUsersDarwin(lines) {
|
||||
}
|
||||
|
||||
function users(callback) {
|
||||
|
||||
return new Promise((resolve) => {
|
||||
process.nextTick(() => {
|
||||
let result = [];
|
||||
@ -166,15 +170,21 @@ function users(callback) {
|
||||
lines = stdout.toString().split('\n');
|
||||
result = parseUsersLinux(lines, 2);
|
||||
}
|
||||
if (callback) { callback(result); }
|
||||
if (callback) {
|
||||
callback(result);
|
||||
}
|
||||
resolve(result);
|
||||
});
|
||||
} else {
|
||||
if (callback) { callback(result); }
|
||||
if (callback) {
|
||||
callback(result);
|
||||
}
|
||||
resolve(result);
|
||||
}
|
||||
} else {
|
||||
if (callback) { callback(result); }
|
||||
if (callback) {
|
||||
callback(result);
|
||||
}
|
||||
resolve(result);
|
||||
}
|
||||
});
|
||||
@ -186,7 +196,9 @@ function users(callback) {
|
||||
let lines = stdout.toString().split('\n');
|
||||
result = parseUsersDarwin(lines);
|
||||
}
|
||||
if (callback) { callback(result); }
|
||||
if (callback) {
|
||||
callback(result);
|
||||
}
|
||||
resolve(result);
|
||||
});
|
||||
}
|
||||
@ -197,7 +209,9 @@ function users(callback) {
|
||||
let lines = stdout.toString().split('\n');
|
||||
result = parseUsersDarwin(lines);
|
||||
}
|
||||
if (callback) { callback(result); }
|
||||
if (callback) {
|
||||
callback(result);
|
||||
}
|
||||
resolve(result);
|
||||
});
|
||||
}
|
||||
@ -209,15 +223,18 @@ function users(callback) {
|
||||
let lines = stdout.toString().split('\n');
|
||||
result = parseUsersDarwin(lines);
|
||||
}
|
||||
if (callback) { callback(result); }
|
||||
if (callback) {
|
||||
callback(result);
|
||||
}
|
||||
resolve(result);
|
||||
});
|
||||
}
|
||||
if (_windows) {
|
||||
try {
|
||||
let cmd = 'Get-CimInstance Win32_LogonSession | select LogonId,@{n="StartTime";e={$_.StartTime.ToString("yyyy-MM-dd HH:mm:ss")}} | fl' + '; echo \'#-#-#-#\';';
|
||||
cmd += 'Get-CimInstance Win32_LoggedOnUser | select antecedent,dependent | fl ' + '; echo \'#-#-#-#\';';
|
||||
cmd += '$process = (Get-CimInstance Win32_Process -Filter "name = \'explorer.exe\'"); Invoke-CimMethod -InputObject $process[0] -MethodName GetOwner | select user, domain | fl; get-process -name explorer | select-object sessionid | fl; echo \'#-#-#-#\';';
|
||||
let cmd = 'Get-CimInstance Win32_LogonSession | select LogonId,@{n="StartTime";e={$_.StartTime.ToString("yyyy-MM-dd HH:mm:ss")}} | fl' + "; echo '#-#-#-#';";
|
||||
cmd += 'Get-CimInstance Win32_LoggedOnUser | select antecedent,dependent | fl ' + "; echo '#-#-#-#';";
|
||||
cmd +=
|
||||
"$process = (Get-CimInstance Win32_Process -Filter \"name = 'explorer.exe'\"); Invoke-CimMethod -InputObject $process[0] -MethodName GetOwner | select user, domain | fl; get-process -name explorer | select-object sessionid | fl; echo '#-#-#-#';";
|
||||
cmd += 'query user';
|
||||
util.powerShell(cmd).then((data) => {
|
||||
if (data) {
|
||||
@ -231,7 +248,7 @@ function users(callback) {
|
||||
loggedons[id].dateTime = {}.hasOwnProperty.call(sessions, id) ? sessions[id] : '';
|
||||
}
|
||||
}
|
||||
users.forEach(user => {
|
||||
users.forEach((user) => {
|
||||
let dateTime = '';
|
||||
for (let id in loggedons) {
|
||||
if ({}.hasOwnProperty.call(loggedons, id)) {
|
||||
@ -251,12 +268,15 @@ function users(callback) {
|
||||
});
|
||||
});
|
||||
}
|
||||
if (callback) { callback(result); }
|
||||
if (callback) {
|
||||
callback(result);
|
||||
}
|
||||
resolve(result);
|
||||
|
||||
});
|
||||
} catch (e) {
|
||||
if (callback) { callback(result); }
|
||||
if (callback) {
|
||||
callback(result);
|
||||
}
|
||||
resolve(result);
|
||||
}
|
||||
}
|
||||
@ -266,7 +286,7 @@ function users(callback) {
|
||||
|
||||
function parseWinSessions(sessionParts) {
|
||||
const sessions = {};
|
||||
sessionParts.forEach(session => {
|
||||
sessionParts.forEach((session) => {
|
||||
const lines = session.split('\r\n');
|
||||
const id = util.getValue(lines, 'LogonId');
|
||||
const starttime = util.getValue(lines, 'starttime');
|
||||
@ -282,19 +302,23 @@ function fuzzyMatch(name1, name2) {
|
||||
name2 = name2.toLowerCase();
|
||||
let eq = 0;
|
||||
let len = name1.length;
|
||||
if (name2.length > len) { len = name2.length; }
|
||||
if (name2.length > len) {
|
||||
len = name2.length;
|
||||
}
|
||||
|
||||
for (let i = 0; i < len; i++) {
|
||||
const c1 = name1[i] || '';
|
||||
const c2 = name2[i] || '';
|
||||
if (c1 === c2) { eq++; }
|
||||
if (c1 === c2) {
|
||||
eq++;
|
||||
}
|
||||
}
|
||||
return (len > 10 ? eq / len > 0.9 : (len > 0 ? eq / len > 0.8 : false));
|
||||
return len > 10 ? eq / len > 0.9 : len > 0 ? eq / len > 0.8 : false;
|
||||
}
|
||||
|
||||
function parseWinUsers(userParts, userQuery) {
|
||||
const users = [];
|
||||
userParts.forEach(user => {
|
||||
userParts.forEach((user) => {
|
||||
const lines = user.split('\r\n');
|
||||
|
||||
const domain = util.getValue(lines, 'domain', ':', true);
|
||||
@ -302,7 +326,7 @@ function parseWinUsers(userParts, userQuery) {
|
||||
const sessionid = util.getValue(lines, 'sessionid', ':', true);
|
||||
|
||||
if (username) {
|
||||
const quser = userQuery.filter(item => fuzzyMatch(item.user, username));
|
||||
const quser = userQuery.filter((item) => fuzzyMatch(item.user, username));
|
||||
users.push({
|
||||
domain,
|
||||
user: username,
|
||||
@ -315,7 +339,7 @@ function parseWinUsers(userParts, userQuery) {
|
||||
|
||||
function parseWinLoggedOn(loggedonParts) {
|
||||
const loggedons = {};
|
||||
loggedonParts.forEach(loggedon => {
|
||||
loggedonParts.forEach((loggedon) => {
|
||||
const lines = loggedon.split('\r\n');
|
||||
|
||||
const antecendent = util.getValue(lines, 'antecedent', ':', true);
|
||||
@ -336,16 +360,16 @@ function parseWinLoggedOn(loggedonParts) {
|
||||
}
|
||||
|
||||
function parseWinUsersQuery(lines) {
|
||||
lines = lines.filter(item => item);
|
||||
lines = lines.filter((item) => item);
|
||||
let result = [];
|
||||
const header = lines[0];
|
||||
const headerDelimiter = [];
|
||||
if (header) {
|
||||
const start = (header[0] === ' ') ? 1 : 0;
|
||||
const start = header[0] === ' ' ? 1 : 0;
|
||||
headerDelimiter.push(start - 1);
|
||||
let nextSpace = 0;
|
||||
for (let i = start + 1; i < header.length; i++) {
|
||||
if (header[i] === ' ' && ((header[i - 1] === ' ') || (header[i - 1] === '.'))) {
|
||||
if (header[i] === ' ' && (header[i - 1] === ' ' || header[i - 1] === '.')) {
|
||||
nextSpace = i;
|
||||
} else {
|
||||
if (nextSpace) {
|
||||
@ -360,7 +384,7 @@ function parseWinUsersQuery(lines) {
|
||||
const tty = lines[i].substring(headerDelimiter[1] + 1, headerDelimiter[2] - 2).trim() || '';
|
||||
result.push({
|
||||
user: user,
|
||||
tty: tty,
|
||||
tty: tty
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
// ----------------------------------------------------------------------------------
|
||||
// Description: System Information - library
|
||||
// for Node.js
|
||||
// Copyright: (c) 2014 - 2025
|
||||
// Copyright: (c) 2014 - 2026
|
||||
// Author: Sebastian Hildebrandt
|
||||
// ----------------------------------------------------------------------------------
|
||||
// License: MIT
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
// ----------------------------------------------------------------------------------
|
||||
// Description: System Information - library
|
||||
// for Node.js
|
||||
// Copyright: (c) 2014 - 2025
|
||||
// Copyright: (c) 2014 - 2026
|
||||
// Author: Sebastian Hildebrandt
|
||||
// ----------------------------------------------------------------------------------
|
||||
// License: MIT
|
||||
@ -18,7 +18,6 @@ const exec = require('child_process').exec;
|
||||
const util = require('./util');
|
||||
|
||||
function vboxInfo(callback) {
|
||||
|
||||
// fallback - if only callback is given
|
||||
let result = [];
|
||||
return new Promise((resolve) => {
|
||||
@ -27,7 +26,7 @@ function vboxInfo(callback) {
|
||||
exec(util.getVboxmanage() + ' list vms --long', function (error, stdout) {
|
||||
let parts = (os.EOL + stdout.toString()).split(os.EOL + 'Name:');
|
||||
parts.shift();
|
||||
parts.forEach(part => {
|
||||
parts.forEach((part) => {
|
||||
const lines = ('Name:' + part).split(os.EOL);
|
||||
const state = util.getValue(lines, 'State');
|
||||
const running = state.startsWith('running');
|
||||
@ -89,15 +88,19 @@ function vboxInfo(callback) {
|
||||
bootDevice3: util.getValue(lines, 'Boot Device 3'),
|
||||
bootDevice4: util.getValue(lines, 'Boot Device 4'),
|
||||
timeOffset: util.getValue(lines, 'Time offset'),
|
||||
rtc: util.getValue(lines, 'RTC'),
|
||||
rtc: util.getValue(lines, 'RTC')
|
||||
});
|
||||
});
|
||||
|
||||
if (callback) { callback(result); }
|
||||
if (callback) {
|
||||
callback(result);
|
||||
}
|
||||
resolve(result);
|
||||
});
|
||||
} catch (e) {
|
||||
if (callback) { callback(result); }
|
||||
if (callback) {
|
||||
callback(result);
|
||||
}
|
||||
resolve(result);
|
||||
}
|
||||
});
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
// ----------------------------------------------------------------------------------
|
||||
// Description: System Information - library
|
||||
// for Node.js
|
||||
// Copyright: (c) 2014 - 2025
|
||||
// Copyright: (c) 2014 - 2026
|
||||
// Author: Sebastian Hildebrandt
|
||||
// ----------------------------------------------------------------------------------
|
||||
// License: MIT
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user