コード例 #1
0
ファイル: golismero-daemon.py プロジェクト: jekkay/golismero
def daemon_main(listen_address, listen_port, server_push):

    # Get the config file name.
    config_file = get_default_config_file()
    if not config_file:
        raise RuntimeError("Could not find config file, aborting!")

    # Load the Orchestrator options.
    orchestrator_config = OrchestratorConfig()
    orchestrator_config.config_file = config_file
    orchestrator_config.from_config_file(orchestrator_config.config_file,
                                         allow_profile = True)
    if orchestrator_config.profile:
        orchestrator_config.profile_file = get_profile(
                                            orchestrator_config.profile)
        if orchestrator_config.profile_file:
            orchestrator_config.from_config_file(
                                            orchestrator_config.profile_file)
        else:
            raise RuntimeError("Could not find profile, aborting!")

    # Get the plugins folder from the parameters.
    # If no plugins folder is given, use the default.
    plugins_folder = orchestrator_config.plugins_folder
    if not plugins_folder:
        plugins_folder = path.abspath(__file__)
        plugins_folder = path.dirname(plugins_folder)
        plugins_folder = path.join(plugins_folder, "plugins")
        if not path.isdir(plugins_folder):
            from golismero import common
            plugins_folder = path.abspath(common.__file__)
            plugins_folder = path.dirname(plugins_folder)
            plugins_folder = path.join(plugins_folder, "plugins")
            if not path.isdir(plugins_folder):
                raise RuntimeError(
                    "Default plugins folder not found, aborting!")
        orchestrator_config.plugins_folder = plugins_folder

    # Load the daemon configuration from command line.
    if listen_address:
        orchestrator_config.listen_address = listen_address
    if listen_port:
        orchestrator_config.listen_port    = listen_port
    if server_push:
        orchestrator_config.server_push    = server_push

    # Force the daemon UI plugin.
    orchestrator_config.ui_mode = "daemon"

    # Force disable colored output.
    orchestrator_config.color = False

    # Force maximum verbosity level.
    orchestrator_config.verbose = Logger.MORE_VERBOSE

    # Launch GoLismero.
    launcher.run(orchestrator_config)
コード例 #2
0
def main():

    # Get the config file name.
    config_file = get_default_config_file()
    if not config_file:
        raise RuntimeError("Could not find config file, aborting!")

    # Load the Orchestrator options.
    orchestrator_config = OrchestratorConfig()
    orchestrator_config.ui_mode = "web"
    orchestrator_config.color = False
    orchestrator_config.config_file = config_file
    orchestrator_config.from_config_file(orchestrator_config.config_file,
                                         allow_profile=True)
    if orchestrator_config.profile:
        orchestrator_config.profile_file = get_profile(
            orchestrator_config.profile)
        if orchestrator_config.profile_file:
            orchestrator_config.from_config_file(
                orchestrator_config.profile_file)
        else:
            raise RuntimeError("Could not find profile, aborting!")

    # Get the plugins folder from the parameters.
    # If no plugins folder is given, use the default.
    plugins_folder = orchestrator_config.plugins_folder
    if not plugins_folder:
        plugins_folder = path.abspath(__file__)
        plugins_folder = path.dirname(plugins_folder)
        plugins_folder = path.join(plugins_folder, "plugins")
        if not path.isdir(plugins_folder):
            from golismero import common
            plugins_folder = path.abspath(common.__file__)
            plugins_folder = path.dirname(plugins_folder)
            plugins_folder = path.join(plugins_folder, "plugins")
            if not path.isdir(plugins_folder):
                raise RuntimeError(
                    "Default plugins folder not found, aborting!")
        orchestrator_config.plugins_folder = plugins_folder

    # Check if all options are correct.
    orchestrator_config.check_params()

    # Launch GoLismero.
    launcher.run(orchestrator_config)
コード例 #3
0
def main():

    # Get the config file name.
    config_file = get_default_config_file()
    if not config_file:
        raise RuntimeError("Could not find config file, aborting!")

    # Load the Orchestrator options.
    orchestrator_config = OrchestratorConfig()
    orchestrator_config.ui_mode = "web"
    orchestrator_config.colorize = False
    orchestrator_config.config_file = config_file
    orchestrator_config.from_config_file(orchestrator_config.config_file, allow_profile = True)
    if orchestrator_config.profile:
        orchestrator_config.profile_file = get_profile(orchestrator_config.profile)
        if orchestrator_config.profile_file:
            orchestrator_config.from_config_file(orchestrator_config.profile_file)
        else:
            raise RuntimeError("Could not find profile, aborting!")

    # Get the plugins folder from the parameters.
    # If no plugins folder is given, use the default.
    plugins_folder = orchestrator_config.plugins_folder
    if not plugins_folder:
        plugins_folder = path.abspath(__file__)
        plugins_folder = path.dirname(plugins_folder)
        plugins_folder = path.join(plugins_folder, "plugins")
        if not path.isdir(plugins_folder):
            from golismero import common
            plugins_folder = path.abspath(common.__file__)
            plugins_folder = path.dirname(plugins_folder)
            plugins_folder = path.join(plugins_folder, "plugins")
            if not path.isdir(plugins_folder):
                raise RuntimeError("Default plugins folder not found, aborting!")
        orchestrator_config.plugins_folder = plugins_folder

    # Check if all options are correct.
    orchestrator_config.check_params()

    # Launch GoLismero.
    launcher.run(orchestrator_config)