static void Main(string[] args)
        {
            var logger = new Log4NetLogger();
            var sysinfo = new SystemInfo();
            var endpoint = new IPEndPoint(IPAddress.Any, 8006);

            WebSocketQueueServer server = new WebSocketQueueServer(endpoint, sysinfo, logger);
            ConnectionManager manager = new ConnectionManager(server, logger, sysinfo);

            var cliFactories = new ICliSessionFactory[]
            {
                // creates cmd.exe sessions
                new CommandSessionFactory(logger),

                // creates powershell sessions
                new PowerShellFactory(logger)
            };

            server.Queue.SubscribeInstance(new CreateTerminalRequestHandler(manager, cliFactories, logger, sysinfo));
            server.Queue.SubscribeInstance(new CloseTerminalRequestHandler(manager, logger));
            server.Queue.SubscribeInstance(new InputTerminalRequestHandler(manager, logger));

            Task.Run(()=>server.StartAsync());

            Console.ReadKey(true);
            server.Dispose();
        }
示例#2
0
        static void Main(string[] args)
        {
            var logger = new Log4NetLogger();
            var sysinfo = new SystemInfo();
            var endpoint = new IPEndPoint(IPAddress.Any, 8009);

            WebSocketQueueServer server = new WebSocketQueueServer(endpoint, sysinfo, logger);
            ConnectionManager manager = new ConnectionManager(server, logger, sysinfo);

            var cliFactories = new ICliSessionFactory[] 
            { 
                // creates cmd.exe sessions
                new CommandSessionFactory(logger), 

                // creates powershell sessions
                new PowerShellFactory(logger) 
            };

            server.Queue.SubscribeInstance(new CreateTerminalRequestHandler(manager, cliFactories, logger, sysinfo));
            server.Queue.SubscribeInstance(new CloseTerminalRequestHandler(manager, logger));
            server.Queue.SubscribeInstance(new InputTerminalRequestHandler(manager, logger));

            try
            {
                server.StartAsync();
                Console.ReadKey(true);
                server.Dispose();
            }
            catch (Exception ex)
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine(ex);
                Console.ResetColor();
            }

            Console.WriteLine("End.");
            Console.ReadKey(true);
        }
示例#3
0
        static void Main(string[] args)
        {
            var logger   = new Log4NetLogger();
            var sysinfo  = new SystemInfo();
            var endpoint = new IPEndPoint(IPAddress.Any, 8009);

            WebSocketQueueServer server  = new WebSocketQueueServer(endpoint, sysinfo, logger);
            ConnectionManager    manager = new ConnectionManager(server, logger, sysinfo);

            var cliFactories = new ICliSessionFactory[]
            {
                // creates cmd.exe sessions
                new CommandSessionFactory(logger),

                // creates powershell sessions
                new PowerShellFactory(logger)
            };

            server.Queue.SubscribeInstance(new CreateTerminalRequestHandler(manager, cliFactories, logger, sysinfo));
            server.Queue.SubscribeInstance(new CloseTerminalRequestHandler(manager, logger));
            server.Queue.SubscribeInstance(new InputTerminalRequestHandler(manager, logger));

            try
            {
                server.StartAsync();
                Console.ReadKey(true);
                server.Dispose();
            }
            catch (Exception ex)
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine(ex);
                Console.ResetColor();
            }

            Console.WriteLine("End.");
            Console.ReadKey(true);
        }