Skip to content

Commit

Permalink
fix bugs in parse networks from hostapd mode
Browse files Browse the repository at this point in the history
  • Loading branch information
isapozhkov committed Sep 29, 2016
1 parent 8aed22a commit ce90f0d
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions wificontrol.py
Original file line number Diff line number Diff line change
Expand Up @@ -534,21 +534,22 @@ def parse_under_hostapd(self):
first = info.find('network')
info = info[first:].strip()
list_of_networks = info.split('}\n')
network_to_add = dict()
for network in list_of_networks:
network_to_add = dict()
ssid = network.find('ssid')
if ssid != -1:
ssid_last = network.find('\n', ssid)
network_to_add['ssid'] = network[ssid + 5:ssid_last]
network_to_add['ssid'] = network[ssid + 5:ssid_last].strip('\"')
else:
network_to_add['ssid'] = 'Unknown'

bssid = network.find('bssid')
if bssid != -1:
bssid_last = network.find('\n', bssid)
network_to_add['mac address'] = network[bssid + 6:bssid_last]
else:
network_to_add['mac address'] = 'any'
resuls.append(network_to_add)
result.append(network_to_add)
return result

def get_network_parameter(self, parameter):
Expand Down

0 comments on commit ce90f0d

Please sign in to comment.