From 4fdfa35c8d9b5a0dde32a16be298b94106f586f4 Mon Sep 17 00:00:00 2001 From: ricardopolo Date: Thu, 14 Nov 2019 09:37:10 -0500 Subject: [PATCH] logs new Wireless funciton 802.1x --- lib/network.js | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/lib/network.js b/lib/network.js index c2b7294..fd178ab 100644 --- a/lib/network.js +++ b/lib/network.js @@ -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) { let i8021x = { state: 'Unknown', @@ -338,10 +352,27 @@ function getWindowsIEEE8021x(connectionType, iface, ifaces) { } } catch (error) { - console.log(error); + console.log('Entro al catch del wired'); 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; }