Code refactor
This commit is contained in:
parent
1937eeb3ee
commit
a66fffbba7
@ -293,7 +293,7 @@ function getWindowsIfaceDNSsuffix(ifaces, ifacename) {
|
||||
}
|
||||
}
|
||||
|
||||
function getWindowsIEEE8021x(connectionType) {
|
||||
function getWindowsIEEE8021x(connectionType, iface) {
|
||||
let i8021x = {
|
||||
state: 'Unknown',
|
||||
protocol: 'Unknown',
|
||||
@ -302,9 +302,16 @@ function getWindowsIEEE8021x(connectionType) {
|
||||
try {
|
||||
|
||||
const result = execSync('netsh lan show profiles', util.execOptsWin);
|
||||
const arrayResult = result.split('\r\n');
|
||||
const arrayResult = result.split('\r\nProfile on interface');
|
||||
|
||||
// Get 802.1x information by interface name
|
||||
const iface8021xInfo = arrayResult.find((element) => {
|
||||
return element.includes(iface + '\r\n');
|
||||
});
|
||||
|
||||
const state8021x = arrayResult.find((element) => {
|
||||
const arrayIface8021xInfo = iface8021xInfo.split('\r\n')
|
||||
|
||||
const state8021x = arrayIface8021xInfo.find((element) => {
|
||||
return element.includes('802.1x');
|
||||
});
|
||||
|
||||
@ -313,9 +320,10 @@ function getWindowsIEEE8021x(connectionType) {
|
||||
i8021x.protocol = "Not Configured";
|
||||
return i8021x;
|
||||
} else {
|
||||
const protocol8021x = arrayResult.find((element) => {
|
||||
const protocol8021x = arrayIface8021xInfo.find((element) => {
|
||||
return element.includes('EAP');
|
||||
});
|
||||
|
||||
i8021x.protocol = protocol8021x.split(':').pop();
|
||||
i8021x.state = "Enabled";
|
||||
return i8021x;
|
||||
@ -665,7 +673,7 @@ function networkInterfaces(callback) {
|
||||
type = detail.type;
|
||||
}
|
||||
});
|
||||
const IEEE8021x = getWindowsIEEE8021x(type);
|
||||
const IEEE8021x = getWindowsIEEE8021x(type, dev);
|
||||
auth8021x = IEEE8021x.protocol;
|
||||
state8021x = IEEE8021x.state;
|
||||
if (dev.toLowerCase().indexOf('wlan') >= 0 || ifaceName.toLowerCase().indexOf('wlan') >= 0 || ifaceName.toLowerCase().indexOf('wireless') >= 0) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user