logs new Wireless funciton 802.1x

This commit is contained in:
ricardopolo 2019-11-14 09:37:10 -05:00
parent 746137ef47
commit 4fdfa35c8d

View File

@ -305,6 +305,20 @@ function getWindowsWiredProfilesInformation() {
} }
} }
function getWindowsWirelessIfaceSSID(interfaceName){
try {
console.log('NOMBRE DE LA INTEFACE:', interfaceName);
const result = execSync(`netsh wlan show interface name="${interfaceName}" | findstr "SSID"`, util.execOptsWin);
const SSID = result.split('\r\n').shift();
console.log('SSID COMPLETO:', SSID);
const parseSSID = SSID.split(':').pop();
console.log('SSID FINAL:', parseSSID);
return parseSSID;
} catch (error) {
return 'Unknown';
}
}
function getWindowsIEEE8021x(connectionType, iface, ifaces) { function getWindowsIEEE8021x(connectionType, iface, ifaces) {
let i8021x = { let i8021x = {
state: 'Unknown', state: 'Unknown',
@ -338,10 +352,27 @@ function getWindowsIEEE8021x(connectionType, iface, ifaces) {
} }
} catch (error) { } catch (error) {
console.log(error); console.log('Entro al catch del wired');
return i8021x; return i8021x;
} }
} else if (connectionType == 'wireless' && ifaces.length > 0){
try {
const SSID = getWindowsWirelessIfaceSSID(iface);
if(SSID !== 'Unknown') {
let i8021xState = execSync(`netsh wlan show profiles "${SSID}" | findstr "802.1X"`, util.execOptsWin);
i8021x.state = i8021xState.split(':').pop();
console.log('WIRELESS STATE 802',i8021x.state);
let i8021xProtocol = execSync(`netsh wlan show profiles "${SSID}" | findstr "EAP"`, util.execOptsWin);
i8021x.protocol = i8021xProtocol.split(':').pop();
console.log('WIRELESS PROTOCOL 802',i8021x.protocol);
}
return i8021x;
} catch (error) {
console.log('Entro al catch del wireless');
return i8021x;
}
} }
console.log('Entre al valor por defecto');
return i8021x; return i8021x;
} }