Trying to parse the values of SSID, BSSID and Signal from CMD output by using python. The thing that confuses me is how to get those three values each time to store it in a list of lists. I could do it for every single line like so..
import subprocess, re
cmd = subprocess.Popen('netsh wlan show networks mode=BSSID',
shell=True, stdout=subprocess.PIPE)
for line in cmd.stdout:
if "BSSID" in line:
print re.search(r'([0-9A-F]{2}[:-]){5}([0-9A-F]{2})', line, re.I).group()
But the problem is that i can understand it's not a good practice. What i am trying to achive is to have SSID, BSSID and Signal in lists so i can print any information from within the list. For example, print the BSSID of the second access point from my list, or for AP in APS: print SSID.
Any help would be appreciated!
Here is how you could parse the output into a list of dictionaries: