systeminformation 5.30.0 → 5.30.2

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/README.md CHANGED
@@ -185,7 +185,7 @@ si.cpu()
185
185
 
186
186
  (last 7 major and minor version releases)
187
187
 
188
- - Version 5.30.0: `processes()` added user (windows)
188
+ - Version 5.30.0: `processes()` added user (windows) - needed to be reverted
189
189
  - Version 5.29.0: `osInfo()` added OS code name (windows)
190
190
  - Version 5.28.0: `cpuTemperature()` added suppurt for macos-temperature-sensor (macOS)
191
191
  - Version 5.27.0: `mem()` added reclaimable memory
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/processes.js CHANGED
@@ -935,10 +935,7 @@ function processes(callback) {
935
935
  util
936
936
  .powerShell(
937
937
  `Get-CimInstance Win32_Process | select-Object ProcessId,ParentProcessId,ExecutionState,Caption,CommandLine,ExecutablePath,UserModeTime,KernelModeTime,WorkingSetSize,Priority,PageFileUsage,
938
- @{n="CreationDate";e={$_.CreationDate.ToString("yyyy-MM-dd HH:mm:ss")}},
939
- @{n="User";e={$OwnerInfo = Invoke-CimMethod -InputObject $_ -MethodName GetOwner
940
- if($OwnerInfo.ReturnValue -eq 0) {"$($OwnerInfo.Domain)\\$($OwnerInfo.User)"} else {""}
941
- }} | ConvertTo-Json -compress`
938
+ @{n="CreationDate";e={$_.CreationDate.ToString("yyyy-MM-dd HH:mm:ss")}} | ConvertTo-Json -compress`
942
939
  )
943
940
  .then((stdout, error) => {
944
941
  if (!error) {
@@ -963,7 +960,6 @@ function processes(callback) {
963
960
  const utime = element.UserModeTime;
964
961
  const stime = element.KernelModeTime;
965
962
  const memw = element.WorkingSetSize;
966
- const user = element.User;
967
963
  allcpuu = allcpuu + utime;
968
964
  allcpus = allcpus + stime;
969
965
  result.all++;
@@ -1000,7 +996,7 @@ function processes(callback) {
1000
996
  started: element.CreationDate,
1001
997
  state: statusValue ? _winStatusValues[statusValue] : _winStatusValues[0],
1002
998
  tty: '',
1003
- user,
999
+ user: '',
1004
1000
  command: commandLine || name,
1005
1001
  path: commandPath,
1006
1002
  params: ''
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.2",
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)",