systeminformation 5.30.0 → 5.30.1

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 CHANGED
@@ -425,8 +425,9 @@ function getWindowsIEEE8021x(connectionType, iface, ifaces) {
425
425
  ifaceSanitized = ifaceSanitized + s[i];
426
426
  }
427
427
  }
428
- i8021xState = execSync(`netsh wlan show profiles "${ifaceSanitized}" | findstr "802.1X"`, util.execOptsWin);
429
- i8021xProtocol = execSync(`netsh wlan show profiles "${ifaceSanitized}" | findstr "EAP"`, util.execOptsWin);
428
+ const profiles = execSync(`netsh wlan show profiles "${ifaceSanitized}"`, util.execOptsWin).split('\r\n');
429
+ i8021xState = (profiles.find((l) => l.indexOf('802.1X') >= 0) || '').trim();
430
+ i8021xProtocol = (profiles.find((l) => l.indexOf('EAP') >= 0) || '').trim();
430
431
  }
431
432
 
432
433
  if (i8021xState.includes(':') && i8021xProtocol.includes(':')) {
package/lib/users.js CHANGED
@@ -26,9 +26,22 @@ const _openbsd = _platform === 'openbsd';
26
26
  const _netbsd = _platform === 'netbsd';
27
27
  const _sunos = _platform === 'sunos';
28
28
 
29
+ function parseDate(dtMon, dtDay) {
30
+ let dt = new Date().toISOString().slice(0, 10);
31
+ try {
32
+ dt = '' + new Date().getFullYear() + '-' + ('0' + ('JANFEBMARAPRMAYJUNJULAUGSEPOCTNOVDEC'.indexOf(dtMon.toUpperCase()) / 3 + 1)).slice(-2) + '-' + ('0' + dtDay).slice(-2);
33
+ if (new Date(dt) > new Date()) {
34
+ dt = '' + (new Date().getFullYear() - 1) + '-' + ('0' + ('JANFEBMARAPRMAYJUNJULAUGSEPOCTNOVDEC'.indexOf(dtMon.toUpperCase()) / 3 + 1)).slice(-2) + '-' + ('0' + dtDay).slice(-2);
35
+ }
36
+ } catch {
37
+ util.noop();
38
+ }
39
+ return dt;
40
+ }
41
+
29
42
  function parseUsersLinux(lines, phase) {
30
43
  const result = [];
31
- const result_who = [];
44
+ let result_who = [];
32
45
  const result_w = {};
33
46
  let w_first = true;
34
47
  let w_header = [];
@@ -36,21 +49,29 @@ function parseUsersLinux(lines, phase) {
36
49
  let who_line = {};
37
50
 
38
51
  let is_whopart = true;
52
+ let is_whoerror = false;
39
53
  lines.forEach((line) => {
40
54
  if (line === '---') {
41
55
  is_whopart = false;
42
56
  } else {
43
57
  const l = line.replace(/ +/g, ' ').split(' ');
44
-
45
58
  // who part
46
59
  if (is_whopart) {
47
- result_who.push({
48
- user: l[0],
49
- tty: l[1],
50
- date: l[2],
51
- time: l[3],
52
- ip: l && l.length > 4 ? l[4].replace(/\(/g, '').replace(/\)/g, '') : ''
53
- });
60
+ if (line.toLowerCase().indexOf('unexpected') >= 0 || line.toLowerCase().indexOf('unrecognized') >= 0) {
61
+ is_whoerror = true;
62
+ result_who = [];
63
+ }
64
+ if (!is_whoerror) {
65
+ const timePos = l && l.length > 4 && l[4].indexOf(':') > 0 ? 4 : 3;
66
+ result_who.push({
67
+ user: l[0],
68
+ tty: l[1],
69
+ date: timePos === 4 ? parseDate(l[2], l[3]) : l[2],
70
+ time: l[timePos],
71
+ ip: l && l.length > timePos + 1 ? l[timePos + 1].replace(/\(/g, '').replace(/\)/g, '') : '',
72
+ command: ''
73
+ });
74
+ }
54
75
  } else {
55
76
  // w part
56
77
  if (w_first) {
@@ -116,18 +137,10 @@ function parseUsersDarwin(lines) {
116
137
 
117
138
  // who part
118
139
  if (is_whopart) {
119
- let dt = '' + new Date().getFullYear() + '-' + ('0' + ('JANFEBMARAPRMAYJUNJULAUGSEPOCTNOVDEC'.indexOf(l[2].toUpperCase()) / 3 + 1)).slice(-2) + '-' + ('0' + l[3]).slice(-2);
120
- try {
121
- if (new Date(dt) > new Date()) {
122
- dt = '' + (new Date().getFullYear() - 1) + '-' + ('0' + ('JANFEBMARAPRMAYJUNJULAUGSEPOCTNOVDEC'.indexOf(l[2].toUpperCase()) / 3 + 1)).slice(-2) + '-' + ('0' + l[3]).slice(-2);
123
- }
124
- } catch {
125
- util.noop();
126
- }
127
140
  result_who.push({
128
141
  user: l[0],
129
142
  tty: l[1],
130
- date: dt,
143
+ date: parseDate(l[2], l[3]),
131
144
  time: l[4]
132
145
  });
133
146
  } else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "systeminformation",
3
- "version": "5.30.0",
3
+ "version": "5.30.1",
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)",