def set_password(id): input = CharArrowKeysInput(i, o, message="Password:"******"WiFi password enter UI element") password = input.activate() if password is None: return False wpa_cli.set_network(id, 'psk', '"{}"'.format(password)) wpa_cli.save_config() Printer(["Password entered"], i, o, 1)
def set_password(id): input = NumpadCharInput(i, o, message="Password:"******"WiFi password enter UI element") password = input.activate() if password is None: return False wpa_cli.set_network(id, 'psk', '"{}"'.format(password)) wpa_cli.save_config() Printer(["Password entered"], i, o, 1)
def connect_to_network(network_info): #First, looking in the known networks configured_networks = wpa_cli.list_configured_networks() for network in configured_networks: if network_info['ssid'] == network['ssid']: Printer([network_info['ssid'], "known,connecting"], i, o, 1) wpa_cli.enable_network(network['network id']) wpa_cli.save_config() raise MenuExitException #Then, if it's an open network, just connecting if wpa_cli.is_open_network(network_info): network_id = wpa_cli.add_network() Printer(["Network is open", "adding to known"], i, o, 1) ssid = network_info['ssid'] wpa_cli.set_network(network_id, 'ssid', '"{}"'.format(ssid)) wpa_cli.set_network(network_id, 'key_mgmt', 'NONE') Printer(["Connecting to", network_info['ssid']], i, o, 1) wpa_cli.enable_network(network_id) wpa_cli.save_config() raise MenuExitException #Offering to enter a password else: input = CharArrowKeysInput(i, o, message="Password:"******"WiFi password enter UI element") password = input.activate() if password is None: return False network_id = wpa_cli.add_network() Printer(["Password entered", "adding to known"], i, o, 1) ssid = network_info['ssid'] wpa_cli.set_network(network_id, 'ssid', '"{}"'.format(ssid)) wpa_cli.set_network(network_id, 'psk', '"{}"'.format(password)) Printer(["Connecting to", network_info['ssid']], i, o, 1) wpa_cli.enable_network(network_id) wpa_cli.save_config() raise MenuExitException
def connect_to_network(network_info): #First, looking in the known networks configured_networks = wpa_cli.list_configured_networks() for network in configured_networks: if network_info['ssid'] == network['ssid']: Printer([network_info['ssid'], "known,connecting"], i, o, 1) wpa_cli.enable_network(network['network id']) wpa_cli.save_config() raise MenuExitException #Then, if it's an open network, just connecting if wpa_cli.is_open_network(network_info): network_id = wpa_cli.add_network() Printer(["Network is open", "adding to known"], i, o, 1) ssid = network_info['ssid'] wpa_cli.set_network(network_id, 'ssid', '"{}"'.format(ssid)) wpa_cli.set_network(network_id, 'key_mgmt', 'NONE') Printer(["Connecting to", network_info['ssid']], i, o, 1) wpa_cli.enable_network(network_id) wpa_cli.save_config() raise MenuExitException #Offering to enter a password else: input = NumpadCharInput(i, o, message="Password:"******"WiFi password enter UI element") password = input.activate() if password is None: return False network_id = wpa_cli.add_network() Printer(["Password entered", "adding to known"], i, o, 1) ssid = network_info['ssid'] wpa_cli.set_network(network_id, 'ssid', '"{}"'.format(ssid)) wpa_cli.set_network(network_id, 'psk', '"{}"'.format(password)) Printer(["Connecting to", network_info['ssid']], i, o, 1) wpa_cli.enable_network(network_id) wpa_cli.save_config() raise MenuExitException
def connect_to_network(network_info): #First, looking in the known networks configured_networks = wpa_cli.list_configured_networks() for network in configured_networks: if network_info['ssid'] == network['ssid']: Printer([network_info['ssid'], "known,connecting"], i, o, 1) wpa_cli.select_network(network['network id']) return True #Then, if it's an open network, just connecting if wpa_cli.is_open_network(network_info): network_id = wpa_cli.add_network() Printer(["Network is open", "adding to known"], i, o, 1) wpa_cli.set_network(network_id, 'ssid', '"' + network_info['ssid'] + '"') wpa_cli.set_network(network_id, 'key_mgmt', 'NONE') Printer(["Connecting to", network_info['ssid']], i, o, 1) wpa_cli.select_network(network_id) return True #No passkey/WPS PIN input possible yet and I cannot yet test WPS button functionality. else: o.display_data("Network password", "unknown") sleep(1) return False