Code refactor
This commit is contained in:
parent
e6603ab742
commit
bbd11de7b0
@ -214,7 +214,7 @@ function parseLinesWindowsNics(sections, nconfigsections) {
|
||||
|
||||
function getWindowsNics() {
|
||||
const cmd = util.getWmic() + ' nic get MACAddress, name, NetEnabled, Speed, NetConnectionStatus, AdapterTypeId /value';
|
||||
const cmdnicconfig = util.getWmic() + ' nicconfig get dhcpEnabled, DNSDomainSuffixSearchOrder /value';
|
||||
const cmdnicconfig = util.getWmic() + ' nicconfig get dhcpEnabled /value';
|
||||
try {
|
||||
const nsections = execSync(cmd, util.execOptsWin).split(/\n\s*\n/);
|
||||
const nconfigsections = execSync(cmdnicconfig, util.execOptsWin).split(/\n\s*\n/);
|
||||
@ -315,7 +315,6 @@ function getWindowsWirelessIfaceSSID(interfaceName){
|
||||
return 'Unknown';
|
||||
}
|
||||
}
|
||||
|
||||
function getWindowsIEEE8021x(connectionType, iface, ifaces) {
|
||||
let i8021x = {
|
||||
state: 'Unknown',
|
||||
@ -340,31 +339,29 @@ function getWindowsIEEE8021x(connectionType, iface, ifaces) {
|
||||
i8021x.state = "Disabled";
|
||||
i8021x.protocol = "Not defined";
|
||||
return i8021x;
|
||||
} else {
|
||||
} else if (state8021x.includes('Enabled')) {
|
||||
const protocol8021x = arrayIface8021xInfo.find((element) => {
|
||||
return element.includes('EAP');
|
||||
});
|
||||
|
||||
i8021x.protocol = protocol8021x.split(':').pop();
|
||||
i8021x.state = "Enabled";
|
||||
return i8021x;
|
||||
}
|
||||
|
||||
} catch (error) {
|
||||
// console.log('Entro al catch del wired');
|
||||
// console.log('Error getting wired information:', error);
|
||||
return i8021x;
|
||||
}
|
||||
} else if (connectionType == 'wireless'){
|
||||
try {
|
||||
const SSID = getWindowsWirelessIfaceSSID(iface);
|
||||
// const SSID = '1';
|
||||
if(SSID !== 'Unknown') {
|
||||
i8021xState = execSync(`netsh wlan show profiles "${SSID}" | findstr "802.1X"`, util.execOptsWin);
|
||||
i8021xProtocol = execSync(`netsh wlan show profiles "${SSID}" | findstr "EAP"`, util.execOptsWin);
|
||||
}
|
||||
|
||||
} catch (error) {
|
||||
// console.log('Entro al catch del wireless');
|
||||
// console.log('Error getting wireless information:', error);
|
||||
i8021x.state = "Disabled";
|
||||
i8021x.protocol = "Not defined";
|
||||
return i8021x;
|
||||
@ -374,9 +371,8 @@ function getWindowsIEEE8021x(connectionType, iface, ifaces) {
|
||||
i8021x.state = i8021xState.split(':').pop();
|
||||
i8021x.protocol = i8021xProtocol.split(':').pop();
|
||||
}
|
||||
return i8021x;
|
||||
}
|
||||
// console.log('Entre al valor por defecto');
|
||||
|
||||
return i8021x;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user