예제 #1
0
 def boot_3_requests(self):
     """ Boot the requests parser """
     # Setup the resource
     validator = lambda resource: resource.name != '__base__'
     minestorm.get('resources').add('server.request_processors',
                                    subclass_of = minestorm.server.requests.BaseProcessor,
                                    name_attribute = 'name',
                                    validator = validator )
     # Create the sorter
     manager = minestorm.server.requests.RequestSorter()
     minestorm.bind('server.requests', manager)
     # Register differend requests
     manager.register( minestorm.server.requests.PingProcessor() )
     manager.register( minestorm.server.requests.NewSessionProcessor() )
     manager.register( minestorm.server.requests.RemoveSessionProcessor() )
     manager.register( minestorm.server.requests.StartServerProcessor() )
     manager.register( minestorm.server.requests.StopServerProcessor() )
     manager.register( minestorm.server.requests.StartAllServersProcessor() )
     manager.register( minestorm.server.requests.StopAllServersProcessor() )
     manager.register( minestorm.server.requests.CommandProcessor() )
     manager.register( minestorm.server.requests.StatusProcessor() )
     manager.register( minestorm.server.requests.RetrieveLinesProcessor() )
     # Listen for events
     listener = lambda event: manager.sort(event.data['request'])
     minestorm.get('events').listen('server.networking.request_received', listener, 100)
예제 #2
0
 def boot_4_servers(self):
     """ Boot the servers manager """
     manager = minestorm.server.servers.ServersManager()
     minestorm.bind('server.servers', manager)
     # Register all servers
     for section in minestorm.get('configuration').get('available_servers'):
         manager.register( section ) # Register the server
예제 #3
0
 def _init_servers(self):
     """ Initialize the servers cache """
     servers = minestorm.console.servers.ServersManager()
     syncher = minestorm.console.servers.SyncherThread()
     # Bind all things
     minestorm.bind("console.servers", servers)
     minestorm.bind("console.servers.syncher", syncher)
예제 #4
0
 def _init_networking(self):
     """ Initialize the networking """
     # Create the session
     networking = minestorm.console.networking.Session()
     networking.connect(socket.gethostname(), 45342)
     # Bind all things
     minestorm.bind("console.networking", networking)
예제 #5
0
 def boot_2_networking(self):
     """ Boot the networking """
     # Create events
     minestorm.get('events').create('server.networking.request_received')
     # Boot the networking
     manager = minestorm.server.networking.Listener()
     minestorm.bind('server.networking', manager)
     # Bind the console port
     manager.bind( minestorm.get('configuration').get('networking.port') )
예제 #6
0
 def boot_2_configuration(self):
     """ Boot configuration """
     manager = minestorm.common.configuration.ConfigurationManager()
     minestorm.bind("configuration", manager)
     # Load configuration from the default path
     if os.path.exists( manager.default_file_path() ):
         manager.load( manager.default_file_path() )
     # Else load it from the bundled sample
     else:
         manager.load(pkg_resources.resource_filename('minestorm', '_samples/configuration.json'))
예제 #7
0
 def _init_commands(self):
     """ Initialize the console manager """
     # Setup the resource
     validator = lambda resource: resource.name != "__base__"
     minestorm.get("resources").add(
         "console.commands",
         subclass_of=minestorm.console.commands.Command,
         name_attribute="name",
         validator=validator,
     )
     # Setup the manager
     commands = minestorm.console.commands.CommandsManager()
     commands.register(minestorm.console.commands.SwitchCommand())
     commands.register(minestorm.console.commands.StartCommand())
     commands.register(minestorm.console.commands.StopCommand())
     minestorm.bind("console.commands", commands)
예제 #8
0
 def __init__(self):
     minestorm.bind('console.ui', self)
     # Initialize the console
     self._initialize_screen()
     self._initialize_curses()
     self._initialize_colours()
     # Some variables
     self.keylisteners = []
     self.stop = False
     self.focus = None
     # Initialize components
     self.stream = components.StreamComponent(self)
     self.header = components.HeaderComponent(self)
     self.header.left_message('minestorm v{}'.format(minestorm.__version__))
     self.sidebar = components.SidebarComponent(self)
     self.sidebar.update()
     self.infobar = components.InfoBarComponent(self)
     self.inputbar = components.InputBarComponent(self)
예제 #9
0
 def boot_1_cli(self):
     """ Boot the cli """
     # Setup the resource
     validator = lambda resource: resource.name != '__base__'
     minestorm.get('resources').add('cli.commands',
                                    subclass_of = minestorm.cli.Command,
                                    name_attribute = 'name',
                                    validator = validator )
     # Setup the manager
     manager = minestorm.cli.CommandsManager()
     minestorm.bind("cli", manager)
     # Register commands
     manager.register( minestorm.cli.ExecuteCommand() )
     manager.register( minestorm.cli.StartCommand() )
     manager.register( minestorm.cli.StopCommand() )
     manager.register( minestorm.cli.StartAllCommand() )
     manager.register( minestorm.cli.StopAllCommand() )
     manager.register( minestorm.cli.CommandCommand() )
     manager.register( minestorm.cli.ConsoleCommand() )
     manager.register( minestorm.cli.StatusCommand() )
     manager.register( minestorm.cli.TestCommand() )
     manager.register( minestorm.cli.ConfigureCommand() )
예제 #10
0
 def boot_3_resources(self):
     """ Boot the resources manager """
     manager = minestorm.common.resources.ResourcesManager()
     minestorm.bind("resources", manager)
예제 #11
0
 def boot_1_events(self):
     """ Boot the events system """
     manager = minestorm.common.events.EventsManager()
     minestorm.bind('events', manager)
예제 #12
0
 def boot_6_manager(self):
     """ Boot the server manager """
     manager = minestorm.server.MinestormServer()
     minestorm.bind('server', manager)
     # Listen to events
     minestorm.get('events').listen('core.shutdown', lambda e: manager.shutdown())
예제 #13
0
 def boot_5_sessions(self):
     """ Boot the sessions manager """
     manager = minestorm.server.sessions.SessionsManager()
     minestorm.bind('server.sessions', manager)
예제 #14
0
 def __init__(self):
     minestorm.bind("console", self)  # Bind this in the container
     self._init_networking()
     self._init_servers()
     self._init_ui()
     self._init_commands()