# Path: fluxghost/g.py
# USBDEVS = {}


from getpass import getuser
from shlex import split
from uuid import UUID
from fluxclient.device.host2host_usb import FluxUSBError
from fluxclient.device.manager import (DeviceManager, ManagerError,
                                       ManagerException)
from fluxclient.encryptor import KeyObject
from fluxghost import g
import logging
import socket
            import json
                    elif message.startswith("set_nickname "):
                        try:
                            self.cmd_set_nickname(message[13:])
                        except Exception:
                            logger.exception("ERR")
                    else:
                        self.on_command(*split(message))
                else:
                    if message.startswith("password "):
                        try:
                            self.manager.authorize_with_password(message[9:])
                            self.on_connected()
                        except (ManagerError, ManagerException) as e:
                            self.send_fatal(" ".join(e.err_symbol))
                    else:
                        self.send_text(STAGE_REQUIRE_AUTHORIZE)
            else:
                try:
                    self.client_key = KeyObject.load_keyobj(message)
                except ValueError:
                    self.send_fatal("BAD_PARAMS")
                    return
                except Exception:
                    logger.error("RSA Key load error: %s", message)
                    self.send_fatal("BAD_PARAMS")
                    raise

                try:
                    self.try_connect()
                except (ManagerException, ManagerError) as e:

# Path: fluxghost/g.py
# USBDEVS = {}


# Path: fluxghost/api/device_manager.py
from getpass import getuser
from shlex import split
from uuid import UUID
from fluxclient.device.host2host_usb import FluxUSBError
from fluxclient.device.manager import (DeviceManager, ManagerError,
                                       ManagerException)
from fluxclient.encryptor import KeyObject
from fluxghost import g
import logging
import socket
            import json

                    elif message.startswith("set_nickname "):
                        try:
                            self.cmd_set_nickname(message[13:])
                        except Exception:
                            logger.exception("ERR")
                    else:
                        self.on_command(*split(message))
                else:
                    if message.startswith("password "):
                        try:
                            self.manager.authorize_with_password(message[9:])
                            self.on_connected()
                        except (ManagerError, ManagerException) as e:
                            self.send_fatal(" ".join(e.err_symbol))
                    else:
                        self.send_text(STAGE_REQUIRE_AUTHORIZE)
            else:
                try:
                    self.client_key = KeyObject.load_keyobj(message)
                except ValueError:
                    self.send_fatal("BAD_PARAMS")
                    return
                except Exception:
                    logger.error("RSA Key load error: %s", message)
                    self.send_fatal("BAD_PARAMS")
                    raise

                try:
                    self.try_connect()
                except (ManagerException, ManagerError) as e:

                    self.send_fatal(" ".join(e.err_symbol))