Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
import sys
import yaml
def parse_wifi_map(map_path):
with open(map_path, 'r') as f:
data =
wifi_map = yaml.load(data)
devices = set()
for ssid in wifi_map:
print('ssid = {}'.format(ssid))
ssid_node = wifi_map[ssid]
for bssid in ssid_node:
print('\tbssid = {}'.format(bssid))
bssid_node = ssid_node[bssid]
if 'devices' in bssid_node:
for device in bssid_node['devices']:
devices |= {device}
print('\t\tdevice = {}'.format(device))
print('\n\nSSID count: {}, Device count: {}'.format(len(wifi_map), len(devices)))
if __name__ == '__main__':
wifi_map_path = 'wifi_map.yaml'
if len(sys.argv) > 1:
wifi_map_path = sys.argv[1]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.