systeminformation 5.23.10 → 5.23.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/network.js +1 -1
- package/lib/osinfo.js +26 -18
- package/package.json +1 -1
package/lib/network.js
CHANGED
|
@@ -1536,7 +1536,7 @@ function networkConnections(callback) {
|
|
|
1536
1536
|
if (_darwin) {
|
|
1537
1537
|
// let cmd = 'netstat -natv | grep "ESTABLISHED\\|SYN_SENT\\|SYN_RECV\\|FIN_WAIT1\\|FIN_WAIT2\\|TIME_WAIT\\|CLOSE\\|CLOSE_WAIT\\|LAST_ACK\\|LISTEN\\|CLOSING\\|UNKNOWN"';
|
|
1538
1538
|
let cmd = 'netstat -natvln | grep "tcp4\\|tcp6\\|udp4\\|udp6"';
|
|
1539
|
-
const states = 'ESTABLISHED|SYN_SENT|SYN_RECV|FIN_WAIT1|FIN_WAIT2|TIME_WAIT|CLOSE|CLOSE_WAIT|LAST_ACK|LISTEN|CLOSING|UNKNOWN';
|
|
1539
|
+
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';
|
|
1540
1540
|
exec(cmd, { maxBuffer: 1024 * 20000 }, function (error, stdout) {
|
|
1541
1541
|
if (!error) {
|
|
1542
1542
|
exec('ps -axo pid,command', { maxBuffer: 1024 * 20000 }, function (err2, stdout2) {
|
package/lib/osinfo.js
CHANGED
|
@@ -34,26 +34,34 @@ const _sunos = (_platform === 'sunos');
|
|
|
34
34
|
|
|
35
35
|
function time() {
|
|
36
36
|
let t = new Date().toString().split(' ');
|
|
37
|
+
const result = {
|
|
38
|
+
current: Date.now(),
|
|
39
|
+
uptime: os.uptime(),
|
|
40
|
+
timezone: (t.length >= 7) ? t[5] : '',
|
|
41
|
+
timezoneName: Intl ? Intl.DateTimeFormat().resolvedOptions().timeZone : (t.length >= 7) ? t.slice(6).join(' ').replace(/\(/g, '').replace(/\)/g, '') : ''
|
|
42
|
+
};
|
|
37
43
|
if (_darwin || _linux) {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
lines.
|
|
44
|
+
try {
|
|
45
|
+
const stdout = execSync('date +%Z && date +%z && ls -l /etc/localtime 2>/dev/null', util.execOptsLinux);
|
|
46
|
+
const lines = stdout.toString().split(os.EOL);
|
|
47
|
+
if (lines.length > 3 && !lines[0]) {
|
|
48
|
+
lines.shift();
|
|
49
|
+
}
|
|
50
|
+
let timezone = lines[0] || '';
|
|
51
|
+
if (timezone.startsWith('+') || timezone.startsWith('-')) {
|
|
52
|
+
timezone = 'GMT';
|
|
53
|
+
}
|
|
54
|
+
return {
|
|
55
|
+
current: Date.now(),
|
|
56
|
+
uptime: os.uptime(),
|
|
57
|
+
timezone: lines[1] ? timezone + lines[1] : timezone,
|
|
58
|
+
timezoneName: lines[2] && lines[2].indexOf('/zoneinfo/') > 0 ? (lines[2].split('/zoneinfo/')[1] || '') : ''
|
|
59
|
+
};
|
|
60
|
+
} catch (e) {
|
|
61
|
+
util.noop();
|
|
42
62
|
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
uptime: os.uptime(),
|
|
46
|
-
timezone: lines[0] && lines[1] ? lines[0] + lines[1] : '',
|
|
47
|
-
timezoneName: lines[2] && lines[2].indexOf('/zoneinfo/') > 0 ? (lines[2].split('/zoneinfo/')[1] || '') : ''
|
|
48
|
-
};
|
|
49
|
-
} else {
|
|
50
|
-
return {
|
|
51
|
-
current: Date.now(),
|
|
52
|
-
uptime: os.uptime(),
|
|
53
|
-
timezone: (t.length >= 7) ? t[5] : '',
|
|
54
|
-
timezoneName: Intl ? Intl.DateTimeFormat().resolvedOptions().timeZone : (t.length >= 7) ? t.slice(6).join(' ').replace(/\(/g, '').replace(/\)/g, '') : ''
|
|
55
|
-
};
|
|
56
|
-
};
|
|
63
|
+
}
|
|
64
|
+
return result;
|
|
57
65
|
}
|
|
58
66
|
|
|
59
67
|
exports.time = time;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "systeminformation",
|
|
3
|
-
"version": "5.23.
|
|
3
|
+
"version": "5.23.11",
|
|
4
4
|
"description": "Advanced, lightweight system and OS information library",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Sebastian Hildebrandt <hildebrandt@plus-innovations.com> (https://plus-innovations.com)",
|