def action_unlock(self, kwargs): """ Unlock `user`. Arguments: #user:string User to unlock """ user = kwargs["user"] if self.engine.unlock(user): info("User {username} unlocked (or was already unlocked)".format(username=user)) else: error("Unable to unlock {username}, check privileges".format(username=user))
def action_modify_password(self, kwargs): """ Change `user`'s password. Arguments: #user:string User to unlock #newpassword:string New password #currpassword:string = None Current password """ user = kwargs["user"] new = kwargs["newpassword"] curr = kwargs.get("currpassword", None) if curr == "None": curr = None if self.engine.modify_password(user, curr, new): info("Password of {username} changed".format(username=user)) else: error("Unable to change {username}'s password, check privileges or try with ldaps://".format(username=user))
def misc_all(self, kwargs): """ Collect and store computers, domain_policy, zones, gpo, groups, ou, users, trusts, pso information Arguments: #output:string File prefix for the files that will be created during the execution """ output = kwargs["output"] kwargs["verbose"] = False for command, method in self.get_commands(prefix="list_"): info("Retrieving {command} output".format(command=command)) if self.has_option(method, "filter"): filter_ = self.retrieve_default_val_for_arg(method, "filter") for f in filter_: sys.stdout = Logger( "{output}_{command}_{filter}.lst".format( output=output, command=command, filter=f), quiet=True) kwargs["filter"] = f getattr(self, method)(kwargs) if self.has_option(method, "verbose"): info("Retrieving {command} verbose output".format( command=command)) sys.stdout = Logger( "{output}_{command}_{filter}.json".format( output=output, command=command, filter=f), quiet=True) kwargs["verbose"] = True getattr(self, method)(kwargs) kwargs["verbose"] = False kwargs["filter"] = None else: sys.stdout = Logger("{output}_{command}.lst".format( output=output, command=command), quiet=True) getattr(self, method)(kwargs) if self.has_option(method, "verbose"): info("Retrieving {command} verbose output".format( command=command)) sys.stdout = Logger("{output}_{command}.json".format( output=output, command=command), quiet=True) kwargs["verbose"] = True getattr(self, method)(kwargs) kwargs["verbose"] = False