async def initialize(app, services): ac_data_svc = ACDatabase(CoreDao('ac.db', False), services.get('utility_svc')) ac_api = AtomicCaldera(services, ac_data_svc) data_svc = services.get('data_svc') app.router.add_static('/atomiccaldera', 'plugins/atomiccaldera/static', append_version=True) app.router.add_route('*', '/plugin/atomiccaldera/gui', ac_api.landing) app.router.add_route('*', '/plugin/atomiccaldera/rest', ac_api.rest_api)
required=False, default='local', help='Select an env. file to use') args = parser.parse_args() with open('conf/%s.yml' % args.environment) as c: cfg = yaml.load(c) logging.getLogger('aiohttp.access').setLevel(logging.FATAL) logging.getLogger('aiohttp_session').setLevel(logging.FATAL) logging.getLogger('aiohttp.server').setLevel(logging.FATAL) logging.getLogger('asyncio').setLevel(logging.FATAL) logging.getLogger().setLevel(logging.DEBUG) sys.path.append('') plugin_modules = build_plugins(cfg['plugins']) utility_svc = UtilityService() data_svc = DataService(CoreDao('core.db'), utility_svc) planning_svc = PlanningService(data_svc, utility_svc) operation_svc = OperationService(data_svc=data_svc, utility_svc=utility_svc, planning_svc=planning_svc, planner=cfg['planner']) auth_svc = AuthService(utility_svc=utility_svc) logging.debug('Uploaded files will be put in %s' % cfg['exfil_dir']) logging.debug('Downloaded payloads will come from %s' % cfg['payloads']) file_svc = FileSvc(cfg['payloads'], cfg['exfil_dir']) services = dict(data_svc=data_svc, auth_svc=auth_svc, utility_svc=utility_svc, operation_svc=operation_svc, file_svc=file_svc,
parser.add_argument('-E', '--environment', required=True, default='local', help='Select an env. file to use') args = parser.parse_args() with open('conf/%s.yml' % args.environment) as c: config = yaml.load(c) logging.getLogger('aiohttp.access').setLevel(logging.WARNING) logging.getLogger('asyncio').setLevel(logging.FATAL) logging.getLogger().setLevel(config['debug_level']) sys.path.append('') plugin_modules = build_plugins(config['plugins']) utility_svc = UtilityService() data_svc = DataService(CoreDao('core.db')) operation_svc = OperationService(data_svc=data_svc, utility_svc=utility_svc, planner=config['planner']) auth_svc = AuthService(data_svc=data_svc, ssl_cert=SSL_CERT) file_svc = FileSvc(config['stores']) services = dict(data_svc=data_svc, auth_svc=auth_svc, utility_svc=utility_svc, operation_svc=operation_svc, file_svc=file_svc, logger=Logger('plugin'), plugins=plugin_modules) main(services=services, host=config['host'], port=config['port'],
if __name__ == '__main__': parser = argparse.ArgumentParser('Welcome to the system') parser.add_argument('-E', '--environment', required=False, default='local', help='Select an env. file to use') args = parser.parse_args() with open('conf/%s.yml' % args.environment) as c: cfg = yaml.load(c, Loader=yaml.FullLoader) set_logging_state() sys.path.append('') plugin_modules = build_plugins(cfg['plugins']) plugin_svc = PluginService(plugin_modules) data_svc = DataService(CoreDao('core.db', memory=cfg['memory'])) logging.debug('Using an in-memory database: %s' % cfg['memory']) planning_svc = PlanningService() parsing_svc = ParsingService() operation_svc = OperationService() auth_svc = AuthService(cfg['api_key']) logging.debug('Uploaded files will be put in %s' % cfg['exfil_dir']) file_svc = FileSvc([p.name.lower() for p in plugin_modules], cfg['exfil_dir']) agent_svc = AgentService(untrusted_timer=cfg['untrusted_timer']) logging.debug( 'Agents will be considered untrusted after %s seconds of silence' % cfg['untrusted_timer']) logging.debug('Serving at http://%s:%s' % (cfg['host'], cfg['port']))