Ejemplo n.º 1
0
def run_tasks(services):
    loop = asyncio.get_event_loop()
    loop.create_task(app_svc.validate_requirements())
    loop.run_until_complete(data_svc.restore_state())
    loop.run_until_complete(knowledge_svc.restore_state())
    loop.run_until_complete(RestApi(services).enable())
    loop.run_until_complete(app_svc.register_contacts())
    loop.run_until_complete(app_svc.load_plugins(args.plugins))
    loop.run_until_complete(
        data_svc.load_data(
            loop.run_until_complete(
                data_svc.locate('plugins', dict(enabled=True)))))
    loop.run_until_complete(
        app_svc.load_plugin_expansions(
            loop.run_until_complete(
                data_svc.locate('plugins', dict(enabled=True)))))
    loop.run_until_complete(auth_svc.set_login_handlers(services))
    loop.create_task(app_svc.start_sniffer_untrusted_agents())
    loop.create_task(app_svc.resume_operations())
    loop.create_task(app_svc.run_scheduler())
    loop.create_task(learning_svc.build_model())
    loop.create_task(app_svc.watch_ability_files())
    loop.run_until_complete(start_server())
    try:
        logging.info('All systems ready.')
        loop.run_forever()
    except KeyboardInterrupt:
        loop.run_until_complete(
            services.get('app_svc').teardown(
                main_config_file=args.environment))
Ejemplo n.º 2
0
def main(services, config):
    loop = asyncio.get_event_loop()
    loop.run_until_complete(data_svc.restore_state())
    loop.run_until_complete(RestApi(services).enable())
    loop.run_until_complete(app_svc.load_plugins())
    loop.run_until_complete(data_svc.load_data(directory='data'))
    loop.create_task(app_svc.start_sniffer_untrusted_agents())
    loop.create_task(app_svc.resume_operations())
    loop.create_task(app_svc.run_scheduler())
    loop.run_until_complete(start_server(config, services))
    try:
        print('All systems ready. Navigate to http://%s:%s to log in.' %
              (config['host'], config['port']))
        loop.run_forever()
    except KeyboardInterrupt:
        loop.run_until_complete(services.get('data_svc').save_state())
        logging.debug('[!] shutting down server...good-bye')
Ejemplo n.º 3
0
def run_tasks(services):
    loop = asyncio.get_event_loop()
    loop.create_task(build_docs())
    loop.run_until_complete(data_svc.restore_state())
    loop.run_until_complete(RestApi(services).enable())
    loop.run_until_complete(app_svc.register_contacts())
    loop.run_until_complete(app_svc.load_plugins())
    loop.run_until_complete(data_svc.load_data())
    loop.create_task(app_svc.start_sniffer_untrusted_agents())
    loop.create_task(app_svc.resume_operations())
    loop.create_task(app_svc.run_scheduler())
    loop.create_task(learning_svc.build_model())
    loop.run_until_complete(start_server())
    try:
        logging.info('All systems ready.')
        loop.run_forever()
    except KeyboardInterrupt:
        loop.run_until_complete(services.get('app_svc').teardown())
Ejemplo n.º 4
0
def main(services, config):
    loop = asyncio.get_event_loop()
    loop.run_until_complete(data_svc.restore_state())
    loop.run_until_complete(RestApi(config, services).enable())
    loop.run_until_complete(contact_svc.register(Http(services)))
    loop.run_until_complete(app_svc.load_plugins())
    loop.run_until_complete(data_svc.load_data(directory='data'))
    loop.create_task(build_docs())
    loop.create_task(app_svc.start_sniffer_untrusted_agents())
    loop.create_task(app_svc.resume_operations())
    loop.create_task(app_svc.run_scheduler())
    loop.run_until_complete(start_server(config, services))
    try:
        logging.info('All systems ready. Navigate to http://%s:%s to log in.' %
                     (config['host'], config['port']))
        loop.run_forever()
    except KeyboardInterrupt:
        loop.run_until_complete(services.get('app_svc').teardown())