Пример #1
0
def connect(file_name, environment_name):
    config = load_config(file_name)
    environment_websocket = None
    for environment in config['environments']:
        if environment['name'] == environment_name:
            master = Master(
                environment_name,
                C2Manager(
                    Factory(PROVIDER_AWS_WEBSOCKETS,
                            {'url': environment['url']}),
                    environment['master-password'], environment_name))
            master.show_c2_menu()
    if environment_websocket is None:
        print(
            '[-] "{}" environment not found in the "{}" configuration file. Do you want to sync "{}" configuration file from AWS? Y/n'
            .format(environment_name, file_name, file_name))
        user_input = input()
        if user_input.lower() == 'y' or user_input == '':
            sync_environments(file_name)
    config = load_config(file_name)
    for environment in config['environments']:
        if environment['name'] == environment_name:
            master = Master(
                environment_name,
                C2Manager(
                    Factory(PROVIDER_AWS_WEBSOCKETS,
                            {'url': environment['url']}),
                    environment['master-password'], environment_name))
            master.show_c2_menu()

    print(
        '[-] {} environment not found in the {} configuration file. Add it manually to config file or create a new environment with -d (--deploy) option'
        .format(environment_name, file_name))
Пример #2
0
 def handle(self, *args, **options):
     from django.conf import settings
     translation.activate(settings.LANGUAGE_CODE)
     if len(options) > 0:
         config_file = options['config']
     else:
         config_file = defaults.DEFAULT_CONFIG
     try:
         self.stdout.write(
             'Starting Twisted Brew (config:{0})'.format(config_file))
         master = None
         config = coreutils.parse_config(config_file)
         if config.master is not None:
             master = Master(config.communication, config.master)
         coreutils.start_workers(config)
         if master is not None:
             master.info()
             master.start()
         else:
             log.set_log_receiver(log.LOG_RECEIVER_STD)
     except Exception as e:
         raise CommandError('Could not start Twisted Brew: {0}'.format(
             e.__class__.__name__))
     self.stdout.write('Successfully started Twisted Brew')
Пример #3
0
#!/usr/bin python
import django.conf
import sys
import twisted_brew.settings

django.conf.settings.configure()
django.conf.settings.DATABASES = twisted_brew.settings.DATABASES
django.conf.settings.INSTALLED_APPS = twisted_brew.settings.INSTALLED_APPS

from core.utils import coreutils
import core.defaults as defaults
from core.master import Master

configfile = defaults.DEFAULT_CONFIG

if len(sys.argv) > 1:
    configfile = sys.argv[1]

print('Starting Twisted Brew (config:{0})'.format(configfile))

master = None
config = coreutils.parse_config(configfile)
if config.master is not None:
    master = Master(config.communication, config.master)
coreutils.start_workers(config)
if master is not None:
    master.info()
    master.start()
Пример #4
0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
@time    : 2019/5/4 20:42
@file    : submit.py
@author  : zhipeng.zhao
@contact : [email protected]
"""
import os
import sys

bin_dir = os.path.dirname(os.path.abspath(__file__))
sys.path.append(os.path.dirname(bin_dir))

from conf import settings
settings.BIN_DIR = os.path.abspath(os.path.dirname(__file__))

from core.params_parser import ParamsParser
from core.master import Master


if __name__ == '__main__':
    params_obj = ParamsParser()
    if params_obj.is_ready:
        maser = Master(params_obj)
        maser.run()
Пример #5
0
def run(config, cli):
    master = Master(cli)
    master.init(config)
    master.run()