Convert Console Output to Array

Posted by theundertaker on Stack Overflow See other posts from Stack Overflow or by theundertaker
Published on 2012-09-05T21:35:59Z Indexed on 2012/09/05 21:38 UTC
Read the original article Hit count: 347

Using netsh wlan show networks mode=bssid on Windows CMD yields a listing of available wireless networks. Is it possible to convert the list, which looks something like this:

Interface name : Wireless Network Connection 
There are 11 networks currently visible. 

SSID 1 : Custom Gifts Memphis
    Network type            : Infrastructure
    Authentication          : Open
    Encryption              : WEP 
    BSSID 1                 : 00:24:93:0c:49:e0
         Signal             : 16%  
         Radio type         : 802.11g
         Channel            : 6 
         Basic rates (Mbps) : 1 2 5.5 11
         Other rates (Mbps) : 6 6 9 12 18 24 36 48 54

SSID 2 : airportthru
    Network type            : Adhoc
    Authentication          : Open
    Encryption              : None 
    BSSID 1                 : 62:4c:fe:9c:08:18
         Signal             : 53%  
         Radio type         : 802.11g
         Channel            : 10 
         Basic rates (Mbps) : 1 2 5.5 11
         Other rates (Mbps) : 6 9 12 18 24 36 48 54

SSID 3 : belkin.ffe
    Network type            : Infrastructure
    Authentication          : WPA2-Personal
    Encryption              : CCMP 
    BSSID 1                 : 08:86:3b:9c:8f:fe
         Signal             : 23%  
         Radio type         : 802.11n
         Channel            : 1 
         Basic rates (Mbps) : 1 2 5.5 11
         Other rates (Mbps) : 6 9 12 18 24 36 48 54

SSID 4 : 3333
    Network type            : Infrastructure
    Authentication          : WPA2-Personal
    Encryption              : CCMP 
    BSSID 1                 : 00:0f:cc:6d:ba:ac
         Signal             : 18%  
         Radio type         : 802.11g
         Channel            : 6 
         Basic rates (Mbps) : 1 2 5.5 11
         Other rates (Mbps) : 6 9 12 18 22 24 36 48 54
    BSSID 2                 : 06:02:6f:c3:06:27
         Signal             : 20%  
         Radio type         : 802.11g
         Channel            : 6 
         Basic rates (Mbps) : 1 2 5.5 11
         Other rates (Mbps) : 6 9 12 18 24 36 48 54

SSID 5 : linksys
    Network type            : Infrastructure
    Authentication          : Open
    Encryption              : None 
    BSSID 1                 : 98:fc:11:69:35:46
         Signal             : 38%  
         Radio type         : 802.11g
         Channel            : 6 
         Basic rates (Mbps) : 1 2 5.5 11
         Other rates (Mbps) : 6 9 12 18 24 36 48 54

SSID 6 : iHub_0060350392e0
    Network type            : Infrastructure
    Authentication          : WPA2-Personal
    Encryption              : CCMP 
    BSSID 1                 : 00:c0:02:7d:5f:4e
         Signal             : 18%  
         Radio type         : 802.11g
         Channel            : 11 
         Basic rates (Mbps) : 1 2 5.5 11
         Other rates (Mbps) : 6 9 12 18 24 36 48 54

SSID 7 : TopFlight
    Network type            : Infrastructure
    Authentication          : WPA2-Personal
    Encryption              : CCMP 
    BSSID 1                 : 00:14:6c:7a:c4:70
         Signal             : 16%  
         Radio type         : 802.11g
         Channel            : 6 
         Basic rates (Mbps) : 1 2 5.5 11
         Other rates (Mbps) : 6 9 12 18 24 36 48 54

SSID 8 : 2WIRE430
    Network type            : Infrastructure
    Authentication          : WPA2-Personal
    Encryption              : CCMP 
    BSSID 1                 : b8:e6:25:cb:56:a1
         Signal             : 16%  
         Radio type         : 802.11g
         Channel            : 6 
         Basic rates (Mbps) : 1 2 5.5 11
         Other rates (Mbps) : 6 9 12 18 24 36 48 54

SSID 9 : LUBIN
    Network type            : Infrastructure
    Authentication          : WPA-Personal
    Encryption              : TKIP 
    BSSID 1                 : 00:13:10:8d:a7:32
         Signal             : 65%  
         Radio type         : 802.11g
         Channel            : 6 
         Basic rates (Mbps) : 1 2 5.5 11
         Other rates (Mbps) : 6 9 12 18 24 36 48 54

SSID 10 : TV2 Network
    Network type            : Infrastructure
    Authentication          : WPA2-Personal
    Encryption              : CCMP 
    BSSID 1                 : b8:c7:5d:07:6e:cf
         Signal             : 79%  
         Radio type         : 802.11n
         Channel            : 11 
         Basic rates (Mbps) : 1 2 5.5 11
         Other rates (Mbps) : 6 9 12 18 24 36 48 54

SSID 11 : guywork
    Network type            : Infrastructure
    Authentication          : Open
    Encryption              : WEP 
    BSSID 1                 : 00:18:e7:cf:02:20
         Signal             : 15%  
         Radio type         : 802.11n
         Channel            : 6 
         Basic rates (Mbps) : 1 2 5.5 11
         Other rates (Mbps) : 6 9 12 18 24 36 48 54

... into an array using JavaScript or C#? I know it is but it seems like it may be rather difficult. Are there other avenues of obtaining such network information in the requested format? A JavaScript object would be perfect.

© Stack Overflow or respective owner

Related posts about c#

Related posts about JavaScript