systeminformation 5.10.0 → 5.10.4

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/cpu.js CHANGED
@@ -515,12 +515,29 @@ const socketTypes = {
515
515
  63: 'LGA4677',
516
516
  };
517
517
 
518
+ function cpuManufacturer(str) {
519
+ let result = str;
520
+ str = str.toLowerCase();
521
+
522
+ if (str.indexOf('intel') >= 0) { result = 'Intel'; }
523
+ if (str.indexOf('amd') >= 0) { result = 'AMD'; }
524
+ if (str.indexOf('qemu') >= 0) { result = 'QEMU'; }
525
+ if (str.indexOf('hygon') >= 0) { result = 'Hygon'; }
526
+ if (str.indexOf('centaur') >= 0) { result = 'WinChip/Via'; }
527
+ if (str.indexOf('vmware') >= 0) { result = 'VMware'; }
528
+ if (str.indexOf('Xen') >= 0) { result = 'Xen Hypervisor'; }
529
+ if (str.indexOf('tcg') >= 0) { result = 'QEMU'; }
530
+ if (str.indexOf('apple') >= 0) { result = 'Apple'; }
531
+
532
+ return result;
533
+ }
534
+
518
535
  function cpuBrandManufacturer(res) {
519
536
  res.brand = res.brand.replace(/\(R\)+/g, '®').replace(/\s+/g, ' ').trim();
520
537
  res.brand = res.brand.replace(/\(TM\)+/g, '™').replace(/\s+/g, ' ').trim();
521
538
  res.brand = res.brand.replace(/\(C\)+/g, '©').replace(/\s+/g, ' ').trim();
522
539
  res.brand = res.brand.replace(/CPU+/g, '').replace(/\s+/g, ' ').trim();
523
- res.manufacturer = res.brand.split(' ')[0];
540
+ res.manufacturer = cpuManufacturer(res.brand);
524
541
 
525
542
  let parts = res.brand.split(' ');
526
543
  parts.shift();
@@ -655,7 +672,7 @@ function getCpu() {
655
672
  result.speedMax = Math.round(parseFloat(util.getValue(lines, 'cpu max mhz').replace(/,/g, '.')) / 10.0) / 100;
656
673
 
657
674
  result = cpuBrandManufacturer(result);
658
- result.vendor = util.getValue(lines, 'vendor id');
675
+ result.vendor = cpuManufacturer(util.getValue(lines, 'vendor id'));
659
676
  // if (!result.vendor) { result.vendor = util.getValue(lines, 'anbieterkennung'); }
660
677
 
661
678
  result.family = util.getValue(lines, 'cpu family');
@@ -733,7 +750,7 @@ function getCpu() {
733
750
  result.speedMax = Math.round(parseFloat(util.getValue(lines, 'max speed').replace(/Mhz/g, '')) / 10.0) / 100;
734
751
 
735
752
  result = cpuBrandManufacturer(result);
736
- result.vendor = util.getValue(lines, 'manufacturer');
753
+ result.vendor = cpuManufacturer(util.getValue(lines, 'manufacturer'));
737
754
  let sig = util.getValue(lines, 'signature');
738
755
  sig = sig.split(',');
739
756
  for (var i = 0; i < sig.length; i++) {
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,
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.0",
3
+ "version": "5.10.4",
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)",