diff --git a/pupy/modules/creds.py b/pupy/modules/creds.py index 3e59d4e8..b0205024 100644 --- a/pupy/modules/creds.py +++ b/pupy/modules/creds.py @@ -8,6 +8,7 @@ ROOT=os.path.abspath(os.path.join(os.path.dirname(__file__),"..")) @config(category="creds") class Creds(PupyModule): """ database containing all passwords found """ + need_at_least_one_client=False def init_argparse(self): self.arg_parser = PupyArgumentParser(prog="Creds", description=self.__doc__) diff --git a/pupy/pupylib/PupyCmd.py b/pupy/pupylib/PupyCmd.py index ea67c07c..eaf3ad0b 100644 --- a/pupy/pupylib/PupyCmd.py +++ b/pupy/pupylib/PupyCmd.py @@ -585,13 +585,15 @@ class PupyCmd(cmd.Cmd): except PupyModuleExit: return - l=self.pupsrv.get_clients(selected_clients) - if not l: - if not self.pupsrv.clients: - self.display_error("no clients currently connected") - else: - self.display_error("no clients match this search!") - return + l=[None] + if mod.need_at_least_one_client: + l=self.pupsrv.get_clients(selected_clients) + if not l: + if not self.pupsrv.clients: + self.display_error("no clients currently connected") + else: + self.display_error("no clients match this search!") + return if mod.max_clients!=0 and len(l)>mod.max_clients: self.display_error("This module is limited to %s client(s) at a time and you selected %s clients"%(mod.max_clients, len(l))) diff --git a/pupy/pupylib/PupyModule.py b/pupy/pupylib/PupyModule.py index 3d5aa297..1d4a6ba5 100644 --- a/pupy/pupylib/PupyModule.py +++ b/pupy/pupylib/PupyModule.py @@ -67,12 +67,13 @@ class PupyModule(object): daemon_script -> script that will continue running in background once started """ max_clients=0 #define on how much clients you module can be run in one command. For example an interactive module should be 1 client max at a time. set to 0 for unlimited + need_at_least_one_client=True #set to False if your module doesn't need any client connected daemon=False #if your module is meant to run in background, set this to True and override the stop_daemon method. unique_instance=False # if True, don't start a new module and use another instead dependencies=[] #dependencies to push on the remote target. same as calling self.client.load_package - compatible_systems=[] #should be changed by - category="general" # to sort modules by categories - tags=[] # to add search keywords + compatible_systems=[] #should be changed by decorator @config + category="general" # to sort modules by categories. should be changed by decorator @config + tags=[] # to add search keywords. should be changed by decorator @config def __init__(self, client, job, formatter=None, stdout=None): """ client must be a PupyClient instance """