systeminformation 5.9.7 → 5.9.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/README.md +5 -0
- package/lib/audio.js +219 -219
- package/lib/battery.js +309 -309
- package/lib/bluetooth.js +183 -183
- package/lib/cpu.js +87 -56
- package/lib/docker.js +6 -1
- package/lib/dockerSocket.js +1 -1
- package/lib/filesystem.js +80 -75
- package/lib/graphics.js +44 -45
- package/lib/index.d.ts +60 -24
- package/lib/memory.js +31 -28
- package/lib/network.js +192 -106
- package/lib/osinfo.js +14 -15
- package/lib/printer.js +212 -212
- package/lib/processes.js +1240 -1240
- package/lib/system.js +40 -40
- package/lib/usb.js +305 -305
- package/lib/users.js +192 -81
- package/lib/util.js +23 -7
- package/lib/wifi.js +15 -8
- package/package.json +1 -1
- package/CHANGELOG.md +0 -680
package/lib/memory.js
CHANGED
|
@@ -198,7 +198,7 @@ function mem(callback) {
|
|
|
198
198
|
});
|
|
199
199
|
}
|
|
200
200
|
if (_freebsd || _openbsd || _netbsd) {
|
|
201
|
-
exec('/sbin/sysctl
|
|
201
|
+
exec('/sbin/sysctl hw.realmem hw.physmem vm.stats.vm.v_page_count vm.stats.vm.v_wire_count vm.stats.vm.v_active_count vm.stats.vm.v_inactive_count vm.stats.vm.v_cache_count vm.stats.vm.v_free_count vm.stats.vm.v_page_size', function (error, stdout) {
|
|
202
202
|
if (!error) {
|
|
203
203
|
let lines = stdout.toString().split('\n');
|
|
204
204
|
const pagesize = parseInt(util.getValue(lines, 'vm.stats.vm.v_page_size'), 10);
|
|
@@ -256,14 +256,14 @@ function mem(callback) {
|
|
|
256
256
|
let swaptotal = 0;
|
|
257
257
|
let swapused = 0;
|
|
258
258
|
try {
|
|
259
|
-
util.
|
|
259
|
+
util.powerShell('Get-CimInstance Win32_PageFileUsage | Select AllocatedBaseSize, CurrentUsage').then((stdout, error) => {
|
|
260
260
|
if (!error) {
|
|
261
261
|
let lines = stdout.split('\r\n').filter(line => line.trim() !== '').filter((line, idx) => idx > 0);
|
|
262
262
|
lines.forEach(function (line) {
|
|
263
263
|
if (line !== '') {
|
|
264
264
|
line = line.trim().split(/\s\s+/);
|
|
265
|
-
swaptotal = swaptotal + parseInt(line[0], 10);
|
|
266
|
-
swapused = swapused + parseInt(line[1], 10);
|
|
265
|
+
swaptotal = swaptotal + (parseInt(line[0], 10) || 0);
|
|
266
|
+
swapused = swapused + (parseInt(line[1], 10) || 0);
|
|
267
267
|
}
|
|
268
268
|
});
|
|
269
269
|
}
|
|
@@ -329,9 +329,9 @@ function memLayout(callback) {
|
|
|
329
329
|
manufacturer: getManufacturerLinux(util.getValue(lines, 'Manufacturer:')),
|
|
330
330
|
partNum: util.getValue(lines, 'Part Number:'),
|
|
331
331
|
serialNum: util.getValue(lines, 'Serial Number:'),
|
|
332
|
-
voltageConfigured: parseFloat(util.getValue(lines, 'Configured Voltage:') || null
|
|
333
|
-
voltageMin: parseFloat(util.getValue(lines, 'Minimum Voltage:') || null
|
|
334
|
-
voltageMax: parseFloat(util.getValue(lines, 'Maximum Voltage:') || null
|
|
332
|
+
voltageConfigured: parseFloat(util.getValue(lines, 'Configured Voltage:')) || null,
|
|
333
|
+
voltageMin: parseFloat(util.getValue(lines, 'Minimum Voltage:')) || null,
|
|
334
|
+
voltageMax: parseFloat(util.getValue(lines, 'Maximum Voltage:')) || null,
|
|
335
335
|
});
|
|
336
336
|
} else {
|
|
337
337
|
result.push({
|
|
@@ -384,14 +384,14 @@ function memLayout(callback) {
|
|
|
384
384
|
result[0].type = version && version[2] && version[2] === '3' ? 'LPDDR4' : result[0].type;
|
|
385
385
|
result[0].ecc = false;
|
|
386
386
|
result[0].clockSpeed = version && version[2] && clockSpeed[version[2]] || 400;
|
|
387
|
-
result[0].clockSpeed = version && version[4] && version[4] === 'd' ?
|
|
387
|
+
result[0].clockSpeed = version && version[4] && version[4] === 'd' ? 500 : result[0].clockSpeed;
|
|
388
388
|
result[0].formFactor = 'SoC';
|
|
389
389
|
|
|
390
390
|
stdout = execSync('vcgencmd get_config sdram_freq 2>/dev/null');
|
|
391
391
|
lines = stdout.toString().split('\n');
|
|
392
392
|
let freq = parseInt(util.getValue(lines, 'sdram_freq', '=', true), 10) || 0;
|
|
393
393
|
if (freq) {
|
|
394
|
-
result.clockSpeed = freq;
|
|
394
|
+
result[0].clockSpeed = freq;
|
|
395
395
|
}
|
|
396
396
|
|
|
397
397
|
stdout = execSync('vcgencmd measure_volts sdram_p 2>/dev/null');
|
|
@@ -469,7 +469,7 @@ function memLayout(callback) {
|
|
|
469
469
|
if (size && type) {
|
|
470
470
|
result.push({
|
|
471
471
|
size: size * 1024 * 1024 * 1024,
|
|
472
|
-
bank: 0,
|
|
472
|
+
bank: '0',
|
|
473
473
|
type,
|
|
474
474
|
ecc: false,
|
|
475
475
|
clockSpeed: 0,
|
|
@@ -497,28 +497,31 @@ function memLayout(callback) {
|
|
|
497
497
|
const FormFactors = 'Unknown|Other|SIP|DIP|ZIP|SOJ|Proprietary|SIMM|DIMM|TSOP|PGA|RIMM|SODIMM|SRIMM|SMD|SSMP|QFP|TQFP|SOIC|LCC|PLCC|BGA|FPBGA|LGA'.split('|');
|
|
498
498
|
|
|
499
499
|
try {
|
|
500
|
-
util.
|
|
500
|
+
util.powerShell('Get-WmiObject Win32_PhysicalMemory | fl *').then((stdout, error) => {
|
|
501
501
|
if (!error) {
|
|
502
|
-
let devices = stdout.toString().split(
|
|
502
|
+
let devices = stdout.toString().split(/\n\s*\n/);
|
|
503
503
|
devices.shift();
|
|
504
504
|
devices.forEach(function (device) {
|
|
505
505
|
let lines = device.split('\r\n');
|
|
506
|
-
const dataWidth = util.toInt(util.getValue(lines, 'DataWidth', '
|
|
507
|
-
const totalWidth = util.toInt(util.getValue(lines, 'TotalWidth', '
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
506
|
+
const dataWidth = util.toInt(util.getValue(lines, 'DataWidth', ':'));
|
|
507
|
+
const totalWidth = util.toInt(util.getValue(lines, 'TotalWidth', ':'));
|
|
508
|
+
const size = parseInt(util.getValue(lines, 'Capacity', ':'), 10) || 0;
|
|
509
|
+
if (size) {
|
|
510
|
+
result.push({
|
|
511
|
+
size,
|
|
512
|
+
bank: util.getValue(lines, 'BankLabel', ':'), // BankLabel
|
|
513
|
+
type: memoryTypes[parseInt(util.getValue(lines, 'MemoryType', ':'), 10) || parseInt(util.getValue(lines, 'SMBIOSMemoryType', ':'), 10)],
|
|
514
|
+
ecc: dataWidth && totalWidth ? totalWidth > dataWidth : false,
|
|
515
|
+
clockSpeed: parseInt(util.getValue(lines, 'ConfiguredClockSpeed', ':'), 10) || parseInt(util.getValue(lines, 'Speed', ':'), 10) || 0,
|
|
516
|
+
formFactor: FormFactors[parseInt(util.getValue(lines, 'FormFactor', ':'), 10) || 0],
|
|
517
|
+
manufacturer: util.getValue(lines, 'Manufacturer', ':'),
|
|
518
|
+
partNum: util.getValue(lines, 'PartNumber', ':'),
|
|
519
|
+
serialNum: util.getValue(lines, 'SerialNumber', ':'),
|
|
520
|
+
voltageConfigured: (parseInt(util.getValue(lines, 'ConfiguredVoltage', ':'), 10) || 0) / 1000.0,
|
|
521
|
+
voltageMin: (parseInt(util.getValue(lines, 'MinVoltage', ':'), 10) || 0) / 1000.0,
|
|
522
|
+
voltageMax: (parseInt(util.getValue(lines, 'MaxVoltage', ':'), 10) || 0) / 1000.0,
|
|
523
|
+
});
|
|
524
|
+
}
|
|
522
525
|
});
|
|
523
526
|
}
|
|
524
527
|
if (callback) { callback(result); }
|
package/lib/network.js
CHANGED
|
@@ -218,23 +218,23 @@ function parseLinesWindowsNics(sections, nconfigsections) {
|
|
|
218
218
|
|
|
219
219
|
let lines = sections[i].trim().split('\r\n');
|
|
220
220
|
let linesNicConfig = nconfigsections[i].trim().split('\r\n');
|
|
221
|
-
let netEnabled = util.getValue(lines, 'NetEnabled', '
|
|
222
|
-
let adapterType = util.getValue(lines, 'AdapterTypeID', '
|
|
223
|
-
let ifacename = util.getValue(lines, 'Name', '
|
|
224
|
-
let iface = util.getValue(lines, 'NetConnectionID', '
|
|
221
|
+
let netEnabled = util.getValue(lines, 'NetEnabled', ':');
|
|
222
|
+
let adapterType = util.getValue(lines, 'AdapterTypeID', ':') === '9' ? 'wireless' : 'wired';
|
|
223
|
+
let ifacename = util.getValue(lines, 'Name', ':').replace(/\]/g, ')').replace(/\[/g, '(');
|
|
224
|
+
let iface = util.getValue(lines, 'NetConnectionID', ':').replace(/\]/g, ')').replace(/\[/g, '(');
|
|
225
225
|
if (ifacename.toLowerCase().indexOf('wi-fi') >= 0 || ifacename.toLowerCase().indexOf('wireless') >= 0) {
|
|
226
226
|
adapterType = 'wireless';
|
|
227
227
|
}
|
|
228
228
|
if (netEnabled !== '') {
|
|
229
|
-
const speed = parseInt(util.getValue(lines, 'speed', '
|
|
229
|
+
const speed = parseInt(util.getValue(lines, 'speed', ':').trim(), 10) / 1000000;
|
|
230
230
|
nics.push({
|
|
231
|
-
mac: util.getValue(lines, 'MACAddress', '
|
|
232
|
-
dhcp: util.getValue(linesNicConfig, 'dhcpEnabled', '
|
|
231
|
+
mac: util.getValue(lines, 'MACAddress', ':').toLowerCase(),
|
|
232
|
+
dhcp: util.getValue(linesNicConfig, 'dhcpEnabled', ':').toLowerCase() === 'true',
|
|
233
233
|
name: ifacename,
|
|
234
234
|
iface,
|
|
235
235
|
netEnabled: netEnabled === 'TRUE',
|
|
236
236
|
speed: isNaN(speed) ? null : speed,
|
|
237
|
-
operstate: util.getValue(lines, 'NetConnectionStatus', '
|
|
237
|
+
operstate: util.getValue(lines, 'NetConnectionStatus', ':') === '2' ? 'up' : 'down',
|
|
238
238
|
type: adapterType
|
|
239
239
|
});
|
|
240
240
|
}
|
|
@@ -245,15 +245,24 @@ function parseLinesWindowsNics(sections, nconfigsections) {
|
|
|
245
245
|
}
|
|
246
246
|
|
|
247
247
|
function getWindowsNics() {
|
|
248
|
-
const cmd = util.getWmic() + ' nic get /value';
|
|
249
|
-
const cmdnicconfig = util.getWmic() + ' nicconfig get dhcpEnabled /value';
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
248
|
+
// const cmd = util.getWmic() + ' nic get /value';
|
|
249
|
+
// const cmdnicconfig = util.getWmic() + ' nicconfig get dhcpEnabled /value';
|
|
250
|
+
return new Promise((resolve) => {
|
|
251
|
+
process.nextTick(() => {
|
|
252
|
+
let cmd = 'Get-WmiObject Win32_NetworkAdapter | fl *' + '; echo \'#-#-#-#\';';
|
|
253
|
+
cmd += 'Get-WmiObject Win32_NetworkAdapterConfiguration | fl DHCPEnabled' + '';
|
|
254
|
+
try {
|
|
255
|
+
util.powerShell(cmd).then(data => {
|
|
256
|
+
data = data.split('#-#-#-#');
|
|
257
|
+
const nsections = data[0].split(/\n\s*\n/);
|
|
258
|
+
const nconfigsections = data[1].split(/\n\s*\n/);
|
|
259
|
+
resolve(parseLinesWindowsNics(nsections, nconfigsections));
|
|
260
|
+
});
|
|
261
|
+
} catch (e) {
|
|
262
|
+
resolve([]);
|
|
263
|
+
}
|
|
264
|
+
});
|
|
265
|
+
});
|
|
257
266
|
}
|
|
258
267
|
|
|
259
268
|
function getWindowsDNSsuffixes() {
|
|
@@ -743,7 +752,8 @@ function networkInterfaces(callback, rescan) {
|
|
|
743
752
|
_networkInterfaces = result;
|
|
744
753
|
if (callback) { callback(result); }
|
|
745
754
|
resolve(result);
|
|
746
|
-
}
|
|
755
|
+
}
|
|
756
|
+
if (_linux) {
|
|
747
757
|
if ((JSON.stringify(ifaces) === JSON.stringify(_ifaces)) && !rescan) {
|
|
748
758
|
// no changes - just return object
|
|
749
759
|
result = _networkInterfaces;
|
|
@@ -751,35 +761,9 @@ function networkInterfaces(callback, rescan) {
|
|
|
751
761
|
if (callback) { callback(result); }
|
|
752
762
|
resolve(result);
|
|
753
763
|
} else {
|
|
754
|
-
_ifaces =
|
|
755
|
-
|
|
756
|
-
if (_windows) {
|
|
757
|
-
nics = getWindowsNics();
|
|
758
|
-
nics.forEach(nic => {
|
|
759
|
-
let found = false;
|
|
760
|
-
Object.keys(ifaces).forEach(key => {
|
|
761
|
-
if (!found) {
|
|
762
|
-
ifaces[key].forEach(value => {
|
|
763
|
-
if (Object.keys(value).indexOf('mac') >= 0) {
|
|
764
|
-
found = value['mac'] === nic.mac;
|
|
765
|
-
}
|
|
766
|
-
});
|
|
767
|
-
}
|
|
768
|
-
});
|
|
769
|
-
|
|
770
|
-
if (!found) {
|
|
771
|
-
ifaces[nic.name] = [{ mac: nic.mac }];
|
|
772
|
-
}
|
|
773
|
-
});
|
|
774
|
-
|
|
775
|
-
nics8021xInfo = getWindowsWiredProfilesInformation();
|
|
776
|
-
dnsSuffixes = getWindowsDNSsuffixes();
|
|
777
|
-
}
|
|
778
|
-
if (_linux) {
|
|
779
|
-
_dhcpNics = getLinuxDHCPNics();
|
|
780
|
-
}
|
|
764
|
+
_ifaces = JSON.parse(JSON.stringify(ifaces));
|
|
765
|
+
_dhcpNics = getLinuxDHCPNics();
|
|
781
766
|
for (let dev in ifaces) {
|
|
782
|
-
let iface = dev;
|
|
783
767
|
let ip4 = '';
|
|
784
768
|
let ip4subnet = '';
|
|
785
769
|
let ip6 = '';
|
|
@@ -819,9 +803,8 @@ function networkInterfaces(callback, rescan) {
|
|
|
819
803
|
mac = _mac[dev] || '';
|
|
820
804
|
}
|
|
821
805
|
});
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
const cmd = `echo -n "addr_assign_type: "; cat /sys/class/net/${iface}/addr_assign_type 2>/dev/null; echo;
|
|
806
|
+
let iface = dev.split(':')[0].trim().toLowerCase();
|
|
807
|
+
const cmd = `echo -n "addr_assign_type: "; cat /sys/class/net/${iface}/addr_assign_type 2>/dev/null; echo;
|
|
825
808
|
echo -n "address: "; cat /sys/class/net/${iface}/address 2>/dev/null; echo;
|
|
826
809
|
echo -n "addr_len: "; cat /sys/class/net/${iface}/addr_len 2>/dev/null; echo;
|
|
827
810
|
echo -n "broadcast: "; cat /sys/class/net/${iface}/broadcast 2>/dev/null; echo;
|
|
@@ -847,57 +830,32 @@ function networkInterfaces(callback, rescan) {
|
|
|
847
830
|
echo -n "wireless: "; cat /proc/net/wireless 2>/dev/null | grep ${iface}; echo;
|
|
848
831
|
echo -n "wirelessspeed: "; iw dev ${iface} link 2>&1 | grep bitrate; echo;`;
|
|
849
832
|
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
833
|
+
let lines = [];
|
|
834
|
+
try {
|
|
835
|
+
lines = execSync(cmd).toString().split('\n');
|
|
836
|
+
const connectionName = getLinuxIfaceConnectionName(iface);
|
|
837
|
+
dhcp = getLinuxIfaceDHCPstatus(iface, connectionName, _dhcpNics);
|
|
838
|
+
dnsSuffix = getLinuxIfaceDNSsuffix(connectionName);
|
|
839
|
+
ieee8021xAuth = getLinuxIfaceIEEE8021xAuth(connectionName);
|
|
840
|
+
ieee8021xState = getLinuxIfaceIEEE8021xState(ieee8021xAuth);
|
|
841
|
+
} catch (e) {
|
|
842
|
+
util.noop();
|
|
843
|
+
}
|
|
844
|
+
duplex = util.getValue(lines, 'duplex');
|
|
845
|
+
duplex = duplex.startsWith('cat') ? '' : duplex;
|
|
846
|
+
mtu = parseInt(util.getValue(lines, 'mtu'), 10);
|
|
847
|
+
let myspeed = parseInt(util.getValue(lines, 'speed'), 10);
|
|
848
|
+
speed = isNaN(myspeed) ? null : myspeed;
|
|
849
|
+
let wirelessspeed = util.getValue(lines, 'wirelessspeed').split('tx bitrate: ');
|
|
850
|
+
if (speed === null && wirelessspeed.length === 2) {
|
|
851
|
+
myspeed = parseFloat(wirelessspeed[1]);
|
|
865
852
|
speed = isNaN(myspeed) ? null : myspeed;
|
|
866
|
-
let wirelessspeed = util.getValue(lines, 'wirelessspeed').split('tx bitrate: ');
|
|
867
|
-
if (speed === null && wirelessspeed.length === 2) {
|
|
868
|
-
myspeed = parseFloat(wirelessspeed[1]);
|
|
869
|
-
speed = isNaN(myspeed) ? null : myspeed;
|
|
870
|
-
}
|
|
871
|
-
carrierChanges = parseInt(util.getValue(lines, 'carrier_changes'), 10);
|
|
872
|
-
operstate = util.getValue(lines, 'operstate');
|
|
873
|
-
type = operstate === 'up' ? (util.getValue(lines, 'wireless').trim() ? 'wireless' : 'wired') : 'unknown';
|
|
874
|
-
if (iface === 'lo' || iface.startsWith('bond')) { type = 'virtual'; }
|
|
875
853
|
}
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
let foundFirst = false;
|
|
881
|
-
nics.forEach(detail => {
|
|
882
|
-
if (detail.mac === mac && !foundFirst) {
|
|
883
|
-
iface = detail.iface || iface;
|
|
884
|
-
ifaceName = detail.name;
|
|
885
|
-
dhcp = detail.dhcp;
|
|
886
|
-
operstate = detail.operstate;
|
|
887
|
-
speed = detail.speed;
|
|
888
|
-
type = detail.type;
|
|
889
|
-
foundFirst = true;
|
|
890
|
-
}
|
|
891
|
-
});
|
|
892
|
-
|
|
893
|
-
if (dev.toLowerCase().indexOf('wlan') >= 0 || ifaceName.toLowerCase().indexOf('wlan') >= 0 || ifaceName.toLowerCase().indexOf('802.11n') >= 0 || ifaceName.toLowerCase().indexOf('wireless') >= 0 || ifaceName.toLowerCase().indexOf('wi-fi') >= 0 || ifaceName.toLowerCase().indexOf('wifi') >= 0) {
|
|
894
|
-
type = 'wireless';
|
|
895
|
-
}
|
|
854
|
+
carrierChanges = parseInt(util.getValue(lines, 'carrier_changes'), 10);
|
|
855
|
+
operstate = util.getValue(lines, 'operstate');
|
|
856
|
+
type = operstate === 'up' ? (util.getValue(lines, 'wireless').trim() ? 'wireless' : 'wired') : 'unknown';
|
|
857
|
+
if (iface === 'lo' || iface.startsWith('bond')) { type = 'virtual'; }
|
|
896
858
|
|
|
897
|
-
const IEEE8021x = getWindowsIEEE8021x(type, dev, nics8021xInfo);
|
|
898
|
-
ieee8021xAuth = IEEE8021x.protocol;
|
|
899
|
-
ieee8021xState = IEEE8021x.state;
|
|
900
|
-
}
|
|
901
859
|
let internal = (ifaces[dev] && ifaces[dev][0]) ? ifaces[dev][0].internal : false;
|
|
902
860
|
if (dev.toLowerCase().indexOf('loopback') > -1 || ifaceName.toLowerCase().indexOf('loopback') > -1) {
|
|
903
861
|
internal = true;
|
|
@@ -931,6 +889,134 @@ function networkInterfaces(callback, rescan) {
|
|
|
931
889
|
resolve(result);
|
|
932
890
|
}
|
|
933
891
|
}
|
|
892
|
+
if (_windows) {
|
|
893
|
+
if ((JSON.stringify(ifaces) === JSON.stringify(_ifaces)) && !rescan) {
|
|
894
|
+
// no changes - just return object
|
|
895
|
+
result = _networkInterfaces;
|
|
896
|
+
|
|
897
|
+
if (callback) { callback(result); }
|
|
898
|
+
resolve(result);
|
|
899
|
+
} else {
|
|
900
|
+
_ifaces = JSON.parse(JSON.stringify(ifaces));
|
|
901
|
+
|
|
902
|
+
getWindowsNics().then(function (nics) {
|
|
903
|
+
nics.forEach(nic => {
|
|
904
|
+
let found = false;
|
|
905
|
+
Object.keys(ifaces).forEach(key => {
|
|
906
|
+
if (!found) {
|
|
907
|
+
ifaces[key].forEach(value => {
|
|
908
|
+
if (Object.keys(value).indexOf('mac') >= 0) {
|
|
909
|
+
found = value['mac'] === nic.mac;
|
|
910
|
+
}
|
|
911
|
+
});
|
|
912
|
+
}
|
|
913
|
+
});
|
|
914
|
+
|
|
915
|
+
if (!found) {
|
|
916
|
+
ifaces[nic.name] = [{ mac: nic.mac }];
|
|
917
|
+
}
|
|
918
|
+
});
|
|
919
|
+
nics8021xInfo = getWindowsWiredProfilesInformation();
|
|
920
|
+
dnsSuffixes = getWindowsDNSsuffixes();
|
|
921
|
+
for (let dev in ifaces) {
|
|
922
|
+
let iface = dev;
|
|
923
|
+
let ip4 = '';
|
|
924
|
+
let ip4subnet = '';
|
|
925
|
+
let ip6 = '';
|
|
926
|
+
let ip6subnet = '';
|
|
927
|
+
let mac = '';
|
|
928
|
+
let duplex = '';
|
|
929
|
+
let mtu = '';
|
|
930
|
+
let speed = null;
|
|
931
|
+
let carrierChanges = 0;
|
|
932
|
+
let operstate = 'down';
|
|
933
|
+
let dhcp = false;
|
|
934
|
+
let dnsSuffix = '';
|
|
935
|
+
let ieee8021xAuth = '';
|
|
936
|
+
let ieee8021xState = '';
|
|
937
|
+
let type = '';
|
|
938
|
+
|
|
939
|
+
if ({}.hasOwnProperty.call(ifaces, dev)) {
|
|
940
|
+
let ifaceName = dev;
|
|
941
|
+
ifaces[dev].forEach(function (details) {
|
|
942
|
+
if (details.family === 'IPv4') {
|
|
943
|
+
ip4 = details.address;
|
|
944
|
+
ip4subnet = details.netmask;
|
|
945
|
+
}
|
|
946
|
+
if (details.family === 'IPv6') {
|
|
947
|
+
if (!ip6 || ip6.match(/^fe80::/i)) {
|
|
948
|
+
ip6 = details.address;
|
|
949
|
+
ip6subnet = details.netmask;
|
|
950
|
+
}
|
|
951
|
+
}
|
|
952
|
+
mac = details.mac;
|
|
953
|
+
// fallback due to https://github.com/nodejs/node/issues/13581 (node 8.1 - node 8.2)
|
|
954
|
+
const nodeMainVersion = parseInt(process.versions.node.split('.'), 10);
|
|
955
|
+
if (mac.indexOf('00:00:0') > -1 && (_linux || _darwin) && (!details.internal) && nodeMainVersion >= 8 && nodeMainVersion <= 11) {
|
|
956
|
+
if (Object.keys(_mac).length === 0) {
|
|
957
|
+
_mac = getMacAddresses();
|
|
958
|
+
}
|
|
959
|
+
mac = _mac[dev] || '';
|
|
960
|
+
}
|
|
961
|
+
});
|
|
962
|
+
|
|
963
|
+
|
|
964
|
+
|
|
965
|
+
dnsSuffix = getWindowsIfaceDNSsuffix(dnsSuffixes.ifaces, dev);
|
|
966
|
+
let foundFirst = false;
|
|
967
|
+
nics.forEach(detail => {
|
|
968
|
+
if (detail.mac === mac && !foundFirst) {
|
|
969
|
+
iface = detail.iface || iface;
|
|
970
|
+
ifaceName = detail.name;
|
|
971
|
+
dhcp = detail.dhcp;
|
|
972
|
+
operstate = detail.operstate;
|
|
973
|
+
speed = detail.speed;
|
|
974
|
+
type = detail.type;
|
|
975
|
+
foundFirst = true;
|
|
976
|
+
}
|
|
977
|
+
});
|
|
978
|
+
|
|
979
|
+
if (dev.toLowerCase().indexOf('wlan') >= 0 || ifaceName.toLowerCase().indexOf('wlan') >= 0 || ifaceName.toLowerCase().indexOf('802.11n') >= 0 || ifaceName.toLowerCase().indexOf('wireless') >= 0 || ifaceName.toLowerCase().indexOf('wi-fi') >= 0 || ifaceName.toLowerCase().indexOf('wifi') >= 0) {
|
|
980
|
+
type = 'wireless';
|
|
981
|
+
}
|
|
982
|
+
|
|
983
|
+
const IEEE8021x = getWindowsIEEE8021x(type, dev, nics8021xInfo);
|
|
984
|
+
ieee8021xAuth = IEEE8021x.protocol;
|
|
985
|
+
ieee8021xState = IEEE8021x.state;
|
|
986
|
+
let internal = (ifaces[dev] && ifaces[dev][0]) ? ifaces[dev][0].internal : false;
|
|
987
|
+
if (dev.toLowerCase().indexOf('loopback') > -1 || ifaceName.toLowerCase().indexOf('loopback') > -1) {
|
|
988
|
+
internal = true;
|
|
989
|
+
}
|
|
990
|
+
const virtual = internal ? false : testVirtualNic(dev, ifaceName, mac);
|
|
991
|
+
result.push({
|
|
992
|
+
iface,
|
|
993
|
+
ifaceName,
|
|
994
|
+
ip4,
|
|
995
|
+
ip4subnet,
|
|
996
|
+
ip6,
|
|
997
|
+
ip6subnet,
|
|
998
|
+
mac,
|
|
999
|
+
internal,
|
|
1000
|
+
virtual,
|
|
1001
|
+
operstate,
|
|
1002
|
+
type,
|
|
1003
|
+
duplex,
|
|
1004
|
+
mtu,
|
|
1005
|
+
speed,
|
|
1006
|
+
dhcp,
|
|
1007
|
+
dnsSuffix,
|
|
1008
|
+
ieee8021xAuth,
|
|
1009
|
+
ieee8021xState,
|
|
1010
|
+
carrierChanges,
|
|
1011
|
+
});
|
|
1012
|
+
}
|
|
1013
|
+
}
|
|
1014
|
+
_networkInterfaces = result;
|
|
1015
|
+
if (callback) { callback(result); }
|
|
1016
|
+
resolve(result);
|
|
1017
|
+
});
|
|
1018
|
+
}
|
|
1019
|
+
}
|
|
934
1020
|
});
|
|
935
1021
|
});
|
|
936
1022
|
}
|
|
@@ -1048,13 +1134,13 @@ function networkStatsSingle(iface) {
|
|
|
1048
1134
|
if (sections[i].trim() !== '') {
|
|
1049
1135
|
let lines = sections[i].trim().split('\r\n');
|
|
1050
1136
|
perfData.push({
|
|
1051
|
-
name: util.getValue(lines, 'Name', '
|
|
1052
|
-
rx_bytes: parseInt(util.getValue(lines, 'BytesReceivedPersec', '
|
|
1053
|
-
rx_errors: parseInt(util.getValue(lines, 'PacketsReceivedErrors', '
|
|
1054
|
-
rx_dropped: parseInt(util.getValue(lines, 'PacketsReceivedDiscarded', '
|
|
1055
|
-
tx_bytes: parseInt(util.getValue(lines, 'BytesSentPersec', '
|
|
1056
|
-
tx_errors: parseInt(util.getValue(lines, 'PacketsOutboundErrors', '
|
|
1057
|
-
tx_dropped: parseInt(util.getValue(lines, 'PacketsOutboundDiscarded', '
|
|
1137
|
+
name: util.getValue(lines, 'Name', ':').replace(/[()[\] ]+/g, '').replace('#', '_').toLowerCase(),
|
|
1138
|
+
rx_bytes: parseInt(util.getValue(lines, 'BytesReceivedPersec', ':'), 10),
|
|
1139
|
+
rx_errors: parseInt(util.getValue(lines, 'PacketsReceivedErrors', ':'), 10),
|
|
1140
|
+
rx_dropped: parseInt(util.getValue(lines, 'PacketsReceivedDiscarded', ':'), 10),
|
|
1141
|
+
tx_bytes: parseInt(util.getValue(lines, 'BytesSentPersec', ':'), 10),
|
|
1142
|
+
tx_errors: parseInt(util.getValue(lines, 'PacketsOutboundErrors', ':'), 10),
|
|
1143
|
+
tx_dropped: parseInt(util.getValue(lines, 'PacketsOutboundDiscarded', ':'), 10)
|
|
1058
1144
|
});
|
|
1059
1145
|
}
|
|
1060
1146
|
}
|
|
@@ -1182,7 +1268,7 @@ function networkStatsSingle(iface) {
|
|
|
1182
1268
|
let ifaceName = ifaceSanitized;
|
|
1183
1269
|
|
|
1184
1270
|
// Performance Data
|
|
1185
|
-
util.
|
|
1271
|
+
util.powerShell('Get-WmiObject Win32_PerfRawData_Tcpip_NetworkInterface | fl *').then((stdout, error) => {
|
|
1186
1272
|
if (!error) {
|
|
1187
1273
|
const psections = stdout.toString().split(/\n\s*\n/);
|
|
1188
1274
|
perfData = parseLinesWindowsPerfData(psections);
|
|
@@ -1425,7 +1511,7 @@ function networkConnections(callback) {
|
|
|
1425
1511
|
peeraddress.pop();
|
|
1426
1512
|
peerip = peeraddress.join(':');
|
|
1427
1513
|
}
|
|
1428
|
-
let pid = line[4];
|
|
1514
|
+
let pid = util.toInt(line[4]);
|
|
1429
1515
|
let connstate = line[3];
|
|
1430
1516
|
if (connstate === 'HERGESTELLT') { connstate = 'ESTABLISHED'; }
|
|
1431
1517
|
if (connstate.startsWith('ABH')) { connstate = 'LISTEN'; }
|
package/lib/osinfo.js
CHANGED
|
@@ -196,7 +196,7 @@ function osInfo(callback) {
|
|
|
196
196
|
process.nextTick(() => {
|
|
197
197
|
let result = {
|
|
198
198
|
|
|
199
|
-
platform: (_platform === '
|
|
199
|
+
platform: (_platform === 'win32' ? 'Windows' : _platform),
|
|
200
200
|
distro: 'unknown',
|
|
201
201
|
release: 'unknown',
|
|
202
202
|
codename: '',
|
|
@@ -299,6 +299,7 @@ function osInfo(callback) {
|
|
|
299
299
|
result.codename = (result.release.indexOf('10.14') > -1 ? 'macOS Mojave' : result.codename);
|
|
300
300
|
result.codename = (result.release.indexOf('10.15') > -1 ? 'macOS Catalina' : result.codename);
|
|
301
301
|
result.codename = (result.release.startsWith('11.') ? 'macOS Big Sur' : result.codename);
|
|
302
|
+
result.codename = (result.release.startsWith('12.') ? 'macOS Monterey' : result.codename);
|
|
302
303
|
result.uefi = true;
|
|
303
304
|
result.codepage = util.getCodepage();
|
|
304
305
|
if (callback) {
|
|
@@ -322,7 +323,7 @@ function osInfo(callback) {
|
|
|
322
323
|
result.release = result.kernel;
|
|
323
324
|
try {
|
|
324
325
|
const workload = [];
|
|
325
|
-
workload.push(util.
|
|
326
|
+
workload.push(util.powerShell('Get-WmiObject Win32_OperatingSystem | fl *'));
|
|
326
327
|
// workload.push(execPromise('systeminfo', util.execOptsWin));
|
|
327
328
|
// workload.push(util.powerShell('Get-ComputerInfo -property "HyperV*"'));
|
|
328
329
|
workload.push(util.powerShell('(Get-CimInstance Win32_ComputerSystem).HypervisorPresent'));
|
|
@@ -331,10 +332,10 @@ function osInfo(callback) {
|
|
|
331
332
|
workload
|
|
332
333
|
).then(data => {
|
|
333
334
|
let lines = data.results[0] ? data.results[0].toString().split('\r\n') : [''];
|
|
334
|
-
result.distro = util.getValue(lines, 'Caption', '
|
|
335
|
-
result.serial = util.getValue(lines, 'SerialNumber', '
|
|
336
|
-
result.build = util.getValue(lines, 'BuildNumber', '
|
|
337
|
-
result.servicepack = util.getValue(lines, 'ServicePackMajorVersion', '
|
|
335
|
+
result.distro = util.getValue(lines, 'Caption', ':').trim();
|
|
336
|
+
result.serial = util.getValue(lines, 'SerialNumber', ':').trim();
|
|
337
|
+
result.build = util.getValue(lines, 'BuildNumber', ':').trim();
|
|
338
|
+
result.servicepack = util.getValue(lines, 'ServicePackMajorVersion', ':').trim() + '.' + util.getValue(lines, 'ServicePackMinorVersion', ':').trim();
|
|
338
339
|
result.codepage = util.getCodepage();
|
|
339
340
|
// const systeminfo = data.results[1] ? data.results[1].toString() : '';
|
|
340
341
|
// result.hypervisor = (systeminfo.indexOf('hypervisor has been detected') !== -1) || (systeminfo.indexOf('ein Hypervisor erkannt') !== -1) || (systeminfo.indexOf('Un hyperviseur a ') !== -1);
|
|
@@ -737,12 +738,12 @@ function versions(apps, callback) {
|
|
|
737
738
|
});
|
|
738
739
|
} else {
|
|
739
740
|
if (_windows) {
|
|
740
|
-
util.
|
|
741
|
+
util.powerShell('Get-WmiObject Win32_Service | fl *').then((stdout) => {
|
|
741
742
|
let serviceSections = stdout.split(/\n\s*\n/);
|
|
742
743
|
for (let i = 0; i < serviceSections.length; i++) {
|
|
743
744
|
if (serviceSections[i].trim() !== '') {
|
|
744
745
|
let lines = serviceSections[i].trim().split('\r\n');
|
|
745
|
-
let srvCaption = util.getValue(lines, 'caption', '
|
|
746
|
+
let srvCaption = util.getValue(lines, 'caption', ':', true).toLowerCase();
|
|
746
747
|
if (srvCaption.indexOf('postgresql') > -1) {
|
|
747
748
|
const parts = srvCaption.split(' server ');
|
|
748
749
|
if (parts.length > 1) {
|
|
@@ -1110,12 +1111,10 @@ echo -n "hardware: "; cat /sys/class/dmi/id/product_uuid 2> /dev/null; echo;`;
|
|
|
1110
1111
|
});
|
|
1111
1112
|
}
|
|
1112
1113
|
if (_freebsd || _openbsd || _netbsd) {
|
|
1113
|
-
|
|
1114
|
-
echo -n "hardware: "; sysctl -n kern.hostuuid; echo;`;
|
|
1115
|
-
exec(cmd, function (error, stdout) {
|
|
1114
|
+
exec('sysctl -i kern.hostid kern.hostuuid', function (error, stdout) {
|
|
1116
1115
|
const lines = stdout.toString().split('\n');
|
|
1117
|
-
result.os = util.getValue(lines, '
|
|
1118
|
-
result.hardware = util.getValue(lines, '
|
|
1116
|
+
result.os = util.getValue(lines, 'kern.hostid', ':').toLowerCase();
|
|
1117
|
+
result.hardware = util.getValue(lines, 'kern.hostuuid', ':').toLowerCase();
|
|
1119
1118
|
if (result.os.indexOf('unknown') >= 0) { result.os = ''; }
|
|
1120
1119
|
if (result.hardware.indexOf('unknown') >= 0) { result.hardware = ''; }
|
|
1121
1120
|
if (callback) {
|
|
@@ -1132,10 +1131,10 @@ echo -n "hardware: "; sysctl -n kern.hostuuid; echo;`;
|
|
|
1132
1131
|
exec(`${sysdir}\\reg query "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Cryptography" /v MachineGuid`, util.execOptsWin, function (error, stdout) {
|
|
1133
1132
|
parts = stdout.toString().split('\n\r')[0].split('REG_SZ');
|
|
1134
1133
|
result.os = parts.length > 1 ? parts[1].replace(/\r+|\n+|\s+/ig, '').toLowerCase() : '';
|
|
1135
|
-
util.
|
|
1134
|
+
util.powerShell('Get-WmiObject Win32_ComputerSystemProduct | fl *').then((stdout) => {
|
|
1136
1135
|
// let lines = stdout.split('\r\n').filter(line => line.trim() !== '').filter((line, idx) => idx > 0)[0].trim().split(/\s\s+/);
|
|
1137
1136
|
let lines = stdout.split('\r\n');
|
|
1138
|
-
result.hardware = util.getValue(lines, 'uuid', '
|
|
1137
|
+
result.hardware = util.getValue(lines, 'uuid', ':').toLowerCase();
|
|
1139
1138
|
if (callback) {
|
|
1140
1139
|
callback(result);
|
|
1141
1140
|
}
|