5.23.10 |
2024-12-12 |
diff --git a/docs/index.html b/docs/index.html
index 11fe7c1f..88c76fa2 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -170,7 +170,7 @@
systeminformation
- New Version: 5.23.10
+ New Version: 5.23.11
diff --git a/lib/network.js b/lib/network.js
index 4071aef1..160bd343 100644
--- a/lib/network.js
+++ b/lib/network.js
@@ -1536,7 +1536,7 @@ function networkConnections(callback) {
if (_darwin) {
// let cmd = 'netstat -natv | grep "ESTABLISHED\\|SYN_SENT\\|SYN_RECV\\|FIN_WAIT1\\|FIN_WAIT2\\|TIME_WAIT\\|CLOSE\\|CLOSE_WAIT\\|LAST_ACK\\|LISTEN\\|CLOSING\\|UNKNOWN"';
let cmd = 'netstat -natvln | grep "tcp4\\|tcp6\\|udp4\\|udp6"';
- const states = 'ESTABLISHED|SYN_SENT|SYN_RECV|FIN_WAIT1|FIN_WAIT2|TIME_WAIT|CLOSE|CLOSE_WAIT|LAST_ACK|LISTEN|CLOSING|UNKNOWN';
+ const states = 'ESTABLISHED|SYN_SENT|SYN_RECV|FIN_WAIT1|FIN_WAIT_1|FIN_WAIT2|FIN_WAIT_2|TIME_WAIT|CLOSE|CLOSE_WAIT|LAST_ACK|LISTEN|CLOSING|UNKNOWN';
exec(cmd, { maxBuffer: 1024 * 20000 }, function (error, stdout) {
if (!error) {
exec('ps -axo pid,command', { maxBuffer: 1024 * 20000 }, function (err2, stdout2) {
diff --git a/lib/osinfo.js b/lib/osinfo.js
index 16eb8074..cf645172 100644
--- a/lib/osinfo.js
+++ b/lib/osinfo.js
@@ -34,26 +34,34 @@ const _sunos = (_platform === 'sunos');
function time() {
let t = new Date().toString().split(' ');
+ const result = {
+ current: Date.now(),
+ uptime: os.uptime(),
+ timezone: (t.length >= 7) ? t[5] : '',
+ timezoneName: Intl ? Intl.DateTimeFormat().resolvedOptions().timeZone : (t.length >= 7) ? t.slice(6).join(' ').replace(/\(/g, '').replace(/\)/g, '') : ''
+ };
if (_darwin || _linux) {
- const stdout = execSync('date +%Z && date +%z && ls -l /etc/localtime 2>/dev/null', util.execOptsLinux);
- const lines = stdout.toString().split(os.EOL);
- if (lines.length > 3 && !lines[0]) {
- lines.shift();
+ try {
+ const stdout = execSync('date +%Z && date +%z && ls -l /etc/localtime 2>/dev/null', util.execOptsLinux);
+ const lines = stdout.toString().split(os.EOL);
+ if (lines.length > 3 && !lines[0]) {
+ lines.shift();
+ }
+ let timezone = lines[0] || '';
+ if (timezone.startsWith('+') || timezone.startsWith('-')) {
+ timezone = 'GMT';
+ }
+ return {
+ current: Date.now(),
+ uptime: os.uptime(),
+ timezone: lines[1] ? timezone + lines[1] : timezone,
+ timezoneName: lines[2] && lines[2].indexOf('/zoneinfo/') > 0 ? (lines[2].split('/zoneinfo/')[1] || '') : ''
+ };
+ } catch (e) {
+ util.noop();
}
- return {
- current: Date.now(),
- uptime: os.uptime(),
- timezone: lines[0] && lines[1] ? lines[0] + lines[1] : '',
- timezoneName: lines[2] && lines[2].indexOf('/zoneinfo/') > 0 ? (lines[2].split('/zoneinfo/')[1] || '') : ''
- };
- } else {
- return {
- current: Date.now(),
- uptime: os.uptime(),
- timezone: (t.length >= 7) ? t[5] : '',
- timezoneName: Intl ? Intl.DateTimeFormat().resolvedOptions().timeZone : (t.length >= 7) ? t.slice(6).join(' ').replace(/\(/g, '').replace(/\)/g, '') : ''
- };
- };
+ }
+ return result;
}
exports.time = time;