def site_set_name_action(self, args): if args.oldname == 'default': sys.exit("can't rename the default site") password = None if args.hashed or self.config.site_hashing['enabled'] == 'always': password = self.prompt_password(args.confirm) args.oldname = hash_site(password, args.oldname, self.config.site_hashing) args.newname = hash_site(password, args.newname, self.config.site_hashing) self.config.rename_site(args.oldname, args.newname)
def site_hash_all_action(self, args): """Hash all non-hashed sites.""" password = self.prompt_password(args.confirm) config = self.config.site_hashing if args.method is not None: config['method'] = args.method for site in self.config.get_all_sites(): if site == 'default' or is_likely_hashed_site(site): continue self.config.rename_site(site, hash_site(password, site, config))
def site_hash_action(self, args): """Hash a site. This is so that hostnames need not leak from a config file; the hashed site name is tried if the unhashed name doesn't exist. """ password = self.prompt_password(args.confirm) if args.site is None: args.site = self.prompt('Site: ') config = self.config.site_hashing if args.method is not None: config['method'] = args.method sys.stdout.write(hash_site(password, args.site, config)) if not args.no_newline: sys.stdout.write('\n')
def _get_hashed_site(self, site, password): hashed_site = generator.hash_site(password, site, self.site_hashing) return self._get_site(hashed_site)
def perhaps_hash_site(self, args): if args.hashed or (self.config.site_hashing['enabled'] == 'always' and args.site != 'default'): password = self.prompt_password(args.confirm) args.site = hash_site(password, args.site, self.config.site_hashing)