コード例 #1
0
 def __call__(self):
     root_dir = path.abspath("..")  # Relative to tests/ directory
     options = self.WEB + self.NOT_INTERACTIVE + self.target  # Example options to initialise the framework
     self.core_instance = Core(root_dir)
     processed_options = self.process_options(options)
     self.core_instance.initialise_framework(processed_options)
     self.core_instance.PluginHandler.CanPluginRun = lambda arg1, arg2: True
     return self.core_instance
コード例 #2
0
ファイル: driver.py プロジェクト: colingm/SLAP
    def get_config(self):

        # Get the global config value for raise on js error
        from framework.core import Core
        core = Core()
        raise_on_js_error = core.get_config_value('RAISE_ON_JS_ERROR')
        if raise_on_js_error is None or raise_on_js_error.lower() == 'false':
            raise_on_js_error = False
        else:
            raise_on_js_error = True

        self.raise_on_js_error = raise_on_js_error
コード例 #3
0
 def __call__(self):
     root_dir = path.abspath("..")  # Relative to tests/ directory
     options = self.WEB + self.NOT_INTERACTIVE + self.target  # Example options to initialise the framework
     self.core_instance = Core(root_dir)
     processed_options = self.process_options(options)
     self.core_instance.initialise_framework(processed_options)
     self.core_instance.PluginHandler.CanPluginRun = lambda arg1, arg2: True
     return self.core_instance
コード例 #4
0
class CoreInitialiser():
    """Callable class that instantiates the core object."""

    WEB = " -g web "
    NOT_INTERACTIVE = " -i no "

    def __init__(self, target):
        self.target = target

    def __call__(self):
        root_dir = path.abspath("..")  # Relative to tests/ directory
        options = self.WEB + self.NOT_INTERACTIVE + self.target  # Example options to initialise the framework
        self.core_instance = Core(root_dir)
        processed_options = self.process_options(options)
        self.core_instance.initialise_framework(processed_options)
        self.core_instance.PluginHandler.CanPluginRun = lambda arg1, arg2: True
        return self.core_instance

    def process_options(self, options):
        args = shlex.split(options)
        return ProcessOptions(self.core_instance, args)
コード例 #5
0
class CoreInitialiser():
    """Callable class that instantiates the core object."""

    WEB = " -g web "
    NOT_INTERACTIVE = " -i no "

    def __init__(self, target):
        self.target = target

    def __call__(self):
        root_dir = path.abspath("..")  # Relative to tests/ directory
        options = self.WEB + self.NOT_INTERACTIVE + self.target  # Example options to initialise the framework
        self.core_instance = Core(root_dir)
        processed_options = self.process_options(options)
        self.core_instance.initialise_framework(processed_options)
        self.core_instance.PluginHandler.CanPluginRun = lambda arg1, arg2: True
        return self.core_instance

    def process_options(self, options):
        args = shlex.split(options)
        return ProcessOptions(self.core_instance, args)
コード例 #6
0
ファイル: owtf.py プロジェクト: wuyasec/owtf
def main(args):
    banner()

    # Get tool path from script path:
    root_dir = os.path.dirname(os.path.abspath(args[0])) or '.'
    owtf_pid = os.getpid()
    if "--update" not in args[1:]:
        try:
            ComponentInitialiser.initialisation_phase_1(root_dir, owtf_pid)
        except DatabaseNotRunningException:
            exit(-1)

        args = process_options(args[1:])
        ServiceLocator.get_component("config").ProcessOptionsPhase1(args)
        ComponentInitialiser.initialisation_phase_2(args)

        # Initialise Framework.
        core = Core()
        logging.warn(
            "OWTF Version: %s, Release: %s " %
            (ServiceLocator.get_component("config").FrameworkConfigGet(
                'VERSION'), ServiceLocator.get_component(
                    "config").FrameworkConfigGet('RELEASE')))
        run_owtf(core, args)
    else:
        # First confirming that --update flag is present in args and then
        # creating a different parser for parsing the args.
        try:
            arg = parse_update_options(args[1:])
        except Exception as e:
            usage("Invalid OWTF option(s) %s" % e)
        # Updater class is imported
        updater = update.Updater(root_dir)
        # If outbound proxy is set, those values are added to updater.
        if arg.OutboundProxy:
            if arg.OutboundProxyAuth:
                updater.set_proxy(arg.OutboundProxy,
                                  proxy_auth=arg.OutboundProxyAuth)
            else:
                updater.set_proxy(arg.OutboundProxy)
        # Update method called to perform update.
        updater.update()