Пример #1
0
 def check_interfaces(normal_interface, wii_u_interface):
     if normal_interface == wii_u_interface:
         LoggerCli.throw(
             Exception(
                 "The Wii U and normal interfaces cannot be the same."))
     try:
         InterfaceUtil.get_mac(normal_interface)
         InterfaceUtil.get_mac(wii_u_interface)
     except ValueError:
         LoggerCli.throw(Exception("Invalid interface selected."))
Пример #2
0
 def prompt_unmanaged(interface):
     if not InterfaceUtil.is_managed_by_network_manager(interface):
         return
     LoggerCli.info(
         "The interface \"%s\" is managed by Network Manager. It must be set to "
         "unmanaged to function with DRC Sim. Network manager will not be able to "
         "use this interface after it is set to unmanaged.", interface)
     response = input("Set %s as unmanaged? (y/n)" % interface)
     LoggerCli.debug(response)
     if response in ("y", "yes", "Y", "Yes", "YES"):
         InterfaceUtil.set_unmanaged_by_network_manager(interface)
     else:
         LoggerCli.throw(
             Exception("Interface is managed by Network Manager."))
Пример #3
0
 def get_key(self):
     LoggerCli.info("Getting key")
     wii_u_interface = Args.args.wii_u_interface
     try:
         InterfaceUtil.get_mac(wii_u_interface)
     except ValueError:
         LoggerCli.throw(Exception("Invalid interface selected."))
     if len(Args.args.wps_pin) != 4:
         LoggerCli.throw(Exception("WPS PIN should be 4 digits"))
     self.prompt_unmanaged(wii_u_interface)
     self.create_temp_config_file()
     self.wpa_supplicant = WpaSupplicant()
     self.wpa_supplicant.get_psk(constants.PATH_CONF_CONNECT_TMP,
                                 wii_u_interface, Args.args.wps_pin)
     self.wpa_supplicant.add_status_change_listener(self.status_changed_key)
     self.getting_key = True
     while self.getting_key:
         time.sleep(1)