systeminformation 5.11.12 → 5.11.13
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/battery.js +1 -1
- package/lib/network.js +60 -44
- package/package.json +1 -1
package/lib/battery.js
CHANGED
|
@@ -185,7 +185,7 @@ module.exports = function (callback) {
|
|
|
185
185
|
result.voltage = parseInt('0' + util.getValue(lines, 'voltage', '='), 10) / 1000.0;
|
|
186
186
|
result.capacityUnit = result.voltage ? 'mWh' : 'mAh';
|
|
187
187
|
result.maxCapacity = Math.round(parseInt('0' + util.getValue(lines, 'applerawmaxcapacity', '='), 10) * (result.voltage || 1));
|
|
188
|
-
result.currentCapacity = Math.round(parseInt('0' + util.getValue(lines, '
|
|
188
|
+
result.currentCapacity = Math.round(parseInt('0' + util.getValue(lines, 'applerawcurrentcapacity', '='), 10) * (result.voltage || 1));
|
|
189
189
|
result.designedCapacity = Math.round(parseInt('0' + util.getValue(lines, 'DesignCapacity', '='), 10) * (result.voltage || 1));
|
|
190
190
|
result.manufacturer = 'Apple';
|
|
191
191
|
result.serial = util.getValue(lines, 'BatterySerialNumber', '=');
|
package/lib/network.js
CHANGED
|
@@ -108,6 +108,7 @@ function getDefaultNetworkInterface() {
|
|
|
108
108
|
if (_linux) { cmd = 'ip route 2> /dev/null | grep default | awk \'{print $5}\''; }
|
|
109
109
|
if (_darwin) { cmd = 'route -n get default 2>/dev/null | grep interface: | awk \'{print $2}\''; }
|
|
110
110
|
if (_freebsd || _openbsd || _netbsd || _sunos) { cmd = 'route get 0.0.0.0 | grep interface:'; }
|
|
111
|
+
// console.log('SYNC - default darwin 3');
|
|
111
112
|
let result = execSync(cmd);
|
|
112
113
|
ifacename = result.toString().split('\n')[0];
|
|
113
114
|
if (ifacename.indexOf(':') > -1) {
|
|
@@ -172,6 +173,7 @@ function getMacAddresses() {
|
|
|
172
173
|
if (_darwin) {
|
|
173
174
|
try {
|
|
174
175
|
const cmd = '/sbin/ifconfig';
|
|
176
|
+
// console.log('SYNC - macAde darwin 6');
|
|
175
177
|
let res = execSync(cmd);
|
|
176
178
|
const lines = res.toString().split('\n');
|
|
177
179
|
for (let i = 0; i < lines.length; i++) {
|
|
@@ -504,6 +506,7 @@ function parseLinesDarwinNics(sections) {
|
|
|
504
506
|
function getDarwinNics() {
|
|
505
507
|
const cmd = '/sbin/ifconfig -v';
|
|
506
508
|
try {
|
|
509
|
+
// console.log('SYNC - Nics darwin 12');
|
|
507
510
|
const lines = execSync(cmd, { maxBuffer: 1024 * 20000 }).toString().split('\n');
|
|
508
511
|
const nsections = splitSectionsNics(lines);
|
|
509
512
|
return (parseLinesDarwinNics(nsections));
|
|
@@ -622,6 +625,7 @@ function getDarwinIfaceDHCPstatus(iface) {
|
|
|
622
625
|
let result = false;
|
|
623
626
|
const cmd = `ipconfig getpacket "${iface}" 2>/dev/null | grep lease_time;`;
|
|
624
627
|
try {
|
|
628
|
+
// console.log('SYNC - DHCP status darwin 17');
|
|
625
629
|
const lines = execSync(cmd).toString().split('\n');
|
|
626
630
|
if (lines.length && lines[0].startsWith('lease_time')) {
|
|
627
631
|
result = true;
|
|
@@ -713,7 +717,6 @@ function networkInterfaces(callback, rescan, defaultString) {
|
|
|
713
717
|
|
|
714
718
|
return new Promise((resolve) => {
|
|
715
719
|
process.nextTick(() => {
|
|
716
|
-
const defaultInterface = getDefaultNetworkInterface();
|
|
717
720
|
|
|
718
721
|
let ifaces = os.networkInterfaces();
|
|
719
722
|
|
|
@@ -723,56 +726,67 @@ function networkInterfaces(callback, rescan, defaultString) {
|
|
|
723
726
|
let nics8021xInfo = [];
|
|
724
727
|
// seperate handling in OSX
|
|
725
728
|
if (_darwin || _freebsd || _openbsd || _netbsd) {
|
|
726
|
-
|
|
729
|
+
if ((JSON.stringify(ifaces) === JSON.stringify(_ifaces)) && !rescan) {
|
|
730
|
+
// no changes - just return object
|
|
731
|
+
result = _networkInterfaces;
|
|
727
732
|
|
|
733
|
+
if (callback) { callback(result); }
|
|
734
|
+
resolve(result);
|
|
735
|
+
} else {
|
|
736
|
+
const defaultInterface = getDefaultNetworkInterface();
|
|
737
|
+
_ifaces = JSON.parse(JSON.stringify(ifaces));
|
|
728
738
|
|
|
729
|
-
|
|
739
|
+
nics = getDarwinNics();
|
|
730
740
|
|
|
731
|
-
if ({}.hasOwnProperty.call(ifaces, nic.iface)) {
|
|
732
|
-
ifaces[nic.iface].forEach(function (details) {
|
|
733
|
-
if (details.family === 'IPv4') {
|
|
734
|
-
nic.ip4subnet = details.netmask;
|
|
735
|
-
}
|
|
736
|
-
if (details.family === 'IPv6') {
|
|
737
|
-
nic.ip6subnet = details.netmask;
|
|
738
|
-
}
|
|
739
|
-
});
|
|
740
|
-
}
|
|
741
741
|
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
742
|
+
nics.forEach(nic => {
|
|
743
|
+
|
|
744
|
+
if ({}.hasOwnProperty.call(ifaces, nic.iface)) {
|
|
745
|
+
ifaces[nic.iface].forEach(function (details) {
|
|
746
|
+
if (details.family === 'IPv4') {
|
|
747
|
+
nic.ip4subnet = details.netmask;
|
|
748
|
+
}
|
|
749
|
+
if (details.family === 'IPv6') {
|
|
750
|
+
nic.ip6subnet = details.netmask;
|
|
751
|
+
}
|
|
752
|
+
});
|
|
753
|
+
}
|
|
754
|
+
|
|
755
|
+
result.push({
|
|
756
|
+
iface: nic.iface,
|
|
757
|
+
ifaceName: nic.iface,
|
|
758
|
+
default: nic.iface === defaultInterface,
|
|
759
|
+
ip4: nic.ip4,
|
|
760
|
+
ip4subnet: nic.ip4subnet || '',
|
|
761
|
+
ip6: nic.ip6,
|
|
762
|
+
ip6subnet: nic.ip6subnet || '',
|
|
763
|
+
mac: nic.mac,
|
|
764
|
+
internal: nic.internal,
|
|
765
|
+
virtual: nic.internal ? false : testVirtualNic(nic.iface, nic.iface, nic.mac),
|
|
766
|
+
operstate: nic.operstate,
|
|
767
|
+
type: nic.type,
|
|
768
|
+
duplex: nic.duplex,
|
|
769
|
+
mtu: nic.mtu,
|
|
770
|
+
speed: nic.speed,
|
|
771
|
+
dhcp: getDarwinIfaceDHCPstatus(nic.iface),
|
|
772
|
+
dnsSuffix: '',
|
|
773
|
+
ieee8021xAuth: '',
|
|
774
|
+
ieee8021xState: '',
|
|
775
|
+
carrierChanges: 0
|
|
776
|
+
});
|
|
763
777
|
});
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
778
|
+
_networkInterfaces = result;
|
|
779
|
+
if (defaultString.toLowerCase().indexOf('default') >= 0) {
|
|
780
|
+
result = result.filter(item => item.default);
|
|
781
|
+
if (result.length > 0) {
|
|
782
|
+
result = result[0];
|
|
783
|
+
} else {
|
|
784
|
+
result = [];
|
|
785
|
+
}
|
|
772
786
|
}
|
|
787
|
+
if (callback) { callback(result); }
|
|
788
|
+
resolve(result);
|
|
773
789
|
}
|
|
774
|
-
if (callback) { callback(result); }
|
|
775
|
-
resolve(result);
|
|
776
790
|
}
|
|
777
791
|
if (_linux) {
|
|
778
792
|
if ((JSON.stringify(ifaces) === JSON.stringify(_ifaces)) && !rescan) {
|
|
@@ -784,6 +798,7 @@ function networkInterfaces(callback, rescan, defaultString) {
|
|
|
784
798
|
} else {
|
|
785
799
|
_ifaces = JSON.parse(JSON.stringify(ifaces));
|
|
786
800
|
_dhcpNics = getLinuxDHCPNics();
|
|
801
|
+
const defaultInterface = getDefaultNetworkInterface();
|
|
787
802
|
for (let dev in ifaces) {
|
|
788
803
|
let ip4 = '';
|
|
789
804
|
let ip4subnet = '';
|
|
@@ -927,6 +942,7 @@ function networkInterfaces(callback, rescan, defaultString) {
|
|
|
927
942
|
resolve(result);
|
|
928
943
|
} else {
|
|
929
944
|
_ifaces = JSON.parse(JSON.stringify(ifaces));
|
|
945
|
+
const defaultInterface = getDefaultNetworkInterface();
|
|
930
946
|
|
|
931
947
|
getWindowsNics().then(function (nics) {
|
|
932
948
|
nics.forEach(nic => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "systeminformation",
|
|
3
|
-
"version": "5.11.
|
|
3
|
+
"version": "5.11.13",
|
|
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)",
|