def get_password(self, alias): keepass_path = common.keepass_path if self.master == None: raise KeePassError("Master Password Not Set") try: return get_password(keepass_path, self.master, alias) except KeePassError as e: raise e
def get_pass(alias): file = "test.kdb" if master == None: raise KeePassError("Master Password Not Set") try: return get_password(file, master, alias) except KeePassError as e: print (e) raise e
def get_password(self, alias, master=None): splitted_alias = alias.split(".") if len(splitted_alias) < 1: return None elif len(splitted_alias) == 1: list = self.loader[splitted_alias[0]]["connection"] else: list = self.loader[splitted_alias[0]]["databases"][splitted_alias[1]] if master != None: try: return kp.get_password(keepass_path, master, list["keepass"]) except (KeyError, kp.KeePassError) as e1: try: return list["passwd"] except KeyError: raise ConfigManagerError("Unable to get Password from Keepass or Passwd(" + e1 + ")") else: try: return list["passwd"] except KeyError: raise ConfigManagerError("Unable to get Password (MasterPasswordNot set or no Passwd field)")