def autoconnect_command(args): ssids = [cell.ssid for cell in Cell.all(args.interface)] for scheme in Scheme.all(): # TODO: make it easier to get the SSID off of a scheme. ssid = scheme.options.get('wpa-ssid', scheme.options.get('wireless-essid')) if ssid in ssids: sys.stderr.write('Connecting to "%s".\n' % ssid) try: scheme.activate() except ConnectionError: assert False, "Failed to connect to %s." % scheme.name break else: assert False, "Couldn't find any schemes that are currently available."
def scan_command(args): print_table([[cell.signal, cell.ssid, 'protected' if cell.encrypted else 'unprotected'] for cell in Cell.all(args.interface)])