systeminformation 5.10.1 → 5.10.5

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
@@ -982,6 +982,7 @@ Written by Sebastian Hildebrandt [sebhildebrandt](https://github.com/sebhildebra
982
982
  - Maria Camila Cubides [MariaCamilaCubides](https://github.com/MariaCamilaCubides)
983
983
  - Aleksander Krasnicki [plakak](https://github.com/plakak)
984
984
  - Alexis Tyler [OmgImAlexis](https://github.com/OmgImAlexis)
985
+ - Simon Smith [si458](https://github.com/si458)
985
986
 
986
987
  OSX Temperature: credits here are going to:
987
988
 
package/lib/battery.js CHANGED
@@ -244,13 +244,13 @@ module.exports = function (callback) {
244
244
  batteries[batteries.length - 1].push(parts[i]);
245
245
  }
246
246
  }
247
- let designCapacities = data.results[1].split('\r\n');
248
- let fullChargeCapacities = data.results[2].split('\r\n');
247
+ let designCapacities = data.results[1].split('\r\n').filter(e => e);
248
+ let fullChargeCapacities = data.results[2].split('\r\n').filter(e => e);
249
249
  if (batteries.length) {
250
250
  let first = false;
251
251
  let additionalBatteries = [];
252
252
  for (let i = 0; i < batteries.length; i++) {
253
- let lines = batteries[i];
253
+ let lines = batteries[i][0].split('\r\n');
254
254
  const designedCapacity = designCapacities && designCapacities.length >= (i + 1) && designCapacities[i] ? util.toInt(designCapacities[i]) : 0;
255
255
  const fullChargeCapacity = fullChargeCapacities && fullChargeCapacities.length >= (i + 1) && fullChargeCapacities[i] ? util.toInt(fullChargeCapacities[i]) : 0;
256
256
  const parsed = parseWinBatteryPart(lines, designedCapacity, fullChargeCapacity);
package/lib/osinfo.js CHANGED
@@ -1132,13 +1132,13 @@ echo -n "hardware: "; cat /sys/class/dmi/id/product_uuid 2> /dev/null; echo;`;
1132
1132
  if (process.arch === 'ia32' && Object.prototype.hasOwnProperty.call(process.env, 'PROCESSOR_ARCHITEW6432')) {
1133
1133
  sysdir = '%windir%\\sysnative\\cmd.exe /c %windir%\\System32';
1134
1134
  }
1135
- exec(`${sysdir}\\reg query "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Cryptography" /v MachineGuid`, util.execOptsWin, function (error, stdout) {
1136
- parts = stdout.toString().split('\n\r')[0].split('REG_SZ');
1137
- result.os = parts.length > 1 ? parts[1].replace(/\r+|\n+|\s+/ig, '').toLowerCase() : '';
1138
- util.powerShell('Get-WmiObject Win32_ComputerSystemProduct | fl *').then((stdout) => {
1139
- // let lines = stdout.split('\r\n').filter(line => line.trim() !== '').filter((line, idx) => idx > 0)[0].trim().split(/\s\s+/);
1140
- let lines = stdout.split('\r\n');
1141
- result.hardware = util.getValue(lines, 'uuid', ':').toLowerCase();
1135
+ util.powerShell('Get-WmiObject Win32_ComputerSystemProduct | fl *').then((stdout) => {
1136
+ // let lines = stdout.split('\r\n').filter(line => line.trim() !== '').filter((line, idx) => idx > 0)[0].trim().split(/\s\s+/);
1137
+ let lines = stdout.split('\r\n');
1138
+ result.hardware = util.getValue(lines, 'uuid', ':').toLowerCase();
1139
+ exec(`${sysdir}\\reg query "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Cryptography" /v MachineGuid`, util.execOptsWin, function (error, stdout) {
1140
+ parts = stdout.toString().split('\n\r')[0].split('REG_SZ');
1141
+ result.os = parts.length > 1 ? parts[1].replace(/\r+|\n+|\s+/ig, '').toLowerCase() : '';
1142
1142
  if (callback) {
1143
1143
  callback(result);
1144
1144
  }
package/lib/processes.js CHANGED
@@ -324,7 +324,16 @@ function services(srv, callback) {
324
324
  }
325
325
  if (_windows) {
326
326
  try {
327
- util.powerShell('Get-WmiObject Win32_Service | fl *').then((stdout, error) => {
327
+ let wincommand = 'Get-WmiObject Win32_Service';
328
+ if (srvs[0] !== '*') {
329
+ wincommand += ' -Filter "';
330
+ for (let i = 0; i < srvs.length; i++) {
331
+ wincommand += `Name='${srvs[i]}' or `;
332
+ }
333
+ wincommand = `${wincommand.slice(0, -4)}"`;
334
+ }
335
+ wincommand += ' | fl *';
336
+ util.powerShell(wincommand).then((stdout, error) => {
328
337
  if (!error) {
329
338
  let serviceSections = stdout.split(/\n\s*\n/);
330
339
  for (let i = 0; i < serviceSections.length; i++) {
@@ -338,7 +347,7 @@ function services(srv, callback) {
338
347
  if (srvString === '*' || srvs.indexOf(srvName) >= 0 || srvs.indexOf(srvCaption) >= 0) {
339
348
  result.push({
340
349
  name: srvName,
341
- running: (started === 'TRUE'),
350
+ running: (started.toLowerCase() === 'true'),
342
351
  startmode: startMode,
343
352
  pids: [pid],
344
353
  cpu: 0,
@@ -808,8 +817,8 @@ function processes(callback) {
808
817
  let utime = parseInt(util.getValue(lines, 'UserModeTime', ':', true), 10);
809
818
  let stime = parseInt(util.getValue(lines, 'KernelModeTime', ':', true), 10);
810
819
  let memw = parseInt(util.getValue(lines, 'WorkingSetSize', ':', true), 10);
811
- allcpuu = allcpuu + utime;
812
- allcpus = allcpus + stime;
820
+ allcpuu += utime - (_processes_cpu.list[pid] ? _processes_cpu.list[pid].utime : 0);
821
+ allcpus += stime - (_processes_cpu.list[pid] ? _processes_cpu.list[pid].stime : 0);
813
822
  result.all++;
814
823
  if (!statusValue) { result.unknown++; }
815
824
  if (statusValue === '3') { result.running++; }
@@ -973,8 +982,8 @@ function processLoad(proc, callback) {
973
982
  let utime = parseInt(util.getValue(lines, 'UserModeTime', ':', true), 10);
974
983
  let stime = parseInt(util.getValue(lines, 'KernelModeTime', ':', true), 10);
975
984
  let mem = parseInt(util.getValue(lines, 'WorkingSetSize', ':', true), 10);
976
- allcpuu = allcpuu + utime;
977
- allcpus = allcpus + stime;
985
+ allcpuu += utime - (_process_cpu.list[pid] ? _process_cpu.list[pid].utime : 0);
986
+ allcpus += stime - (_process_cpu.list[pid] ? _process_cpu.list[pid].stime : 0);
978
987
 
979
988
  procStats.push({
980
989
  pid: pid,
package/lib/system.js CHANGED
@@ -353,33 +353,21 @@ function system(callback) {
353
353
  result.serial = util.getValue(lines, 'identifyingnumber', ':');
354
354
  result.uuid = util.getValue(lines, 'uuid', ':').toLowerCase();
355
355
  // detect virtual (1)
356
- if (result.model.toLowerCase() === 'virtualbox' || result.model.toLowerCase() === 'kvm' || result.model.toLowerCase() === 'virtual machine' || result.model.toLowerCase() === 'bochs' || result.model.toLowerCase().startsWith('vmware')) {
356
+ const model = result.model.toLowerCase();
357
+ if (model === 'virtualbox' || model === 'kvm' || model === 'virtual machine' || model === 'bochs' || model.startsWith('vmware') || model.startsWith('qemu')) {
357
358
  result.virtual = true;
358
- switch (result.model.toLowerCase()) {
359
- case 'virtualbox':
360
- result.virtualHost = 'VirtualBox';
361
- break;
362
- case 'vmware':
363
- result.virtualHost = 'VMware';
364
- break;
365
- case 'kvm':
366
- result.virtualHost = 'KVM';
367
- break;
368
- case 'bochs':
369
- result.virtualHost = 'bochs';
370
- break;
371
- }
359
+ if (model.startsWith('virtualbox')) { result.virtualHost = 'VirtualBox'; }
360
+ if (model.startsWith('vmware')) { result.virtualHost = 'VMware'; }
361
+ if (model.startsWith('kvm')) { result.virtualHost = 'KVM'; }
362
+ if (model.startsWith('bochs')) { result.virtualHost = 'bochs'; }
363
+ if (model.startsWith('qemu')) { result.virtualHost = 'KVM'; }
372
364
  }
373
- if (result.manufacturer.toLowerCase().startsWith('vmware') || result.manufacturer.toLowerCase() === 'xen') {
365
+ const manufacturer = result.manufacturer.toLowerCase();
366
+ if (manufacturer.startsWith('vmware') || manufacturer.startsWith('qemu') || manufacturer === 'xen') {
374
367
  result.virtual = true;
375
- switch (result.manufacturer.toLowerCase()) {
376
- case 'vmware':
377
- result.virtualHost = 'VMware';
378
- break;
379
- case 'xen':
380
- result.virtualHost = 'Xen';
381
- break;
382
- }
368
+ if (manufacturer.startsWith('vmware')) { result.virtualHost = 'VMware'; }
369
+ if (manufacturer.startsWith('xen')) { result.virtualHost = 'Xen'; }
370
+ if (manufacturer.startsWith('qemu')) { result.virtualHost = 'KVM'; }
383
371
  }
384
372
  util.powerShell('Get-WmiObject MS_Systeminformation -Namespace "root/wmi" | fl *').then((stdout, error) => {
385
373
  if (!error) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "systeminformation",
3
- "version": "5.10.1",
3
+ "version": "5.10.5",
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)",