示例#1
0
        public LocalConsoleSession(ILogger logger, string sessionId, IMbbsHost host) : base(sessionId)
        {
            _logger            = logger;
            _host              = host;
            SendToClientMethod = dataToSend => UnicodeANSIOutput(dataToSend);

            //Timer to trigger btuche() if enabled
            _timer = new Timer(_ =>
            {
                if (EchoEmptyInvokeEnabled && DataToClient.Count == 0)
                {
                    EchoEmptyInvoke = true;
                }
            }, this, TimeSpan.FromMilliseconds(500), TimeSpan.FromMilliseconds(500));

            Console.Clear();

            Console.OutputEncoding = Encoding.Unicode;

            //Detect if we're on Windows and enable VT100 on the current Terminal Window
            if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
            {
                new Win32VT100().Enable();
            }

            SessionState = EnumSessionState.Unauthenticated;

            (_logger as CustomLogger)?.DisableConsoleLogging();

            _consoleInputThreadIsRunning = true;
            _consoleInputThread          = new Thread(InputThread);
            _consoleInputThread.Start();
            _host.AddSession(this);
        }
示例#2
0
 public RloginSession(IMbbsHost host, ILogger logger, Socket rloginConnection, string moduleIdentifier = null) : base(logger, rloginConnection)
 {
     _host            = host;
     ModuleIdentifier = moduleIdentifier;
     SessionType      = EnumSessionType.Rlogin;
     SessionState     = EnumSessionState.Negotiating;
 }
示例#3
0
        public LocalConsoleSession(ILogger logger, string sessionId, IMbbsHost host) : base(sessionId)
        {
            _logger            = logger;
            _host              = host;
            SendToClientMethod = dataToSend => UnicodeANSIOutput(dataToSend);

            //Timer to trigger btuche() if enabled
            _timer = new Timer(_ =>
            {
                if (EchoEmptyInvokeEnabled && DataToClient.Count == 0)
                {
                    EchoEmptyInvoke = true;
                }
            }, this, TimeSpan.FromMilliseconds(500), TimeSpan.FromMilliseconds(500));

            Console.Clear();
            Console.OutputEncoding = Encoding.Unicode;
            SessionState           = EnumSessionState.Unauthenticated;

            (_logger as CustomLogger)?.DisableConsoleLogging();

            _consoleInputThreadIsRunning = true;
            _consoleInputThread          = new Thread(InputThread);
            _consoleInputThread.Start();
            _host.AddSession(this);
        }
示例#4
0
        public TelnetSession(Socket telnetConnection) : base(telnetConnection.RemoteEndPoint.ToString())
        {
            SessionType        = EnumSessionType.Telnet;
            SendToClientMethod = Send;
            _host   = ServiceResolver.GetService <IMbbsHost>();
            _logger = ServiceResolver.GetService <ILogger>();

            _telnetConnection = telnetConnection;
            _telnetConnection.ReceiveTimeout    = (1000 * 60) * 5; //5 Minutes
            _telnetConnection.ReceiveBufferSize = socketReceiveBuffer.Length;
            _telnetConnection.Blocking          = false;

            SessionState = EnumSessionState.Negotiating;

            _senderThread = new Thread(SendWorker);
            _senderThread.Start();

            //Add this Session to the Host
            _host.AddSession(this);

            Send(ANSI_ERASE_DISPLAY);
            Send(ANSI_RESET_CURSOR);

            SessionState = EnumSessionState.Unauthenticated;

            ListenForData();
        }
示例#5
0
 public SocketServer(ILogger logger, IMbbsHost host, AppSettings configuration, PointerDictionary <SessionBase> channelDictionary)
 {
     _logger            = logger;
     _host              = host;
     _configuration     = configuration;
     _channelDictionary = channelDictionary;
 }
示例#6
0
 public RloginSession(IMbbsHost host, ILogger logger, Socket rloginConnection, PointerDictionary <SessionBase> channelDictionary, AppSettings configuration, ITextVariableService textVariableService, string moduleIdentifier = null) : base(host, logger, rloginConnection, textVariableService)
 {
     ModuleIdentifier   = moduleIdentifier;
     _channelDictionary = channelDictionary;
     _configuration     = configuration;
     SessionType        = EnumSessionType.Rlogin;
     SessionState       = EnumSessionState.Negotiating;
 }
示例#7
0
        public TestSession(IMbbsHost host) : base("test")
        {
            SendToClientMethod = Send;
            OutputEnabled      = true;

            CurrentModule = host.GetModule("MBBSEMU");

            SessionType  = EnumSessionType.Test;
            SessionState = EnumSessionState.EnteringModule;
        }
示例#8
0
        public TestSession(IMbbsHost host, ITextVariableService textVariableService) : base(host, "test", EnumSessionState.EnteringModule, textVariableService)
        {
            SendToClientMethod = Send;
            OutputEnabled      = true;

            CurrentModule = host?.GetModule("MBBSEMU");

            SessionType = EnumSessionType.Test;

            Username = "******";
            Email    = "*****@*****.**";
        }
示例#9
0
        protected SocketSession(IMbbsHost mbbsHost, ILogger logger, Socket socket, ITextVariableService textVariableService) : base(mbbsHost, socket.RemoteEndPoint.ToString(), EnumSessionState.Negotiating, textVariableService)
        {
            _logger = logger;

            _socket = socket;
            _socket.ReceiveTimeout    = (1000 * 60) * 5; //5 Minutes
            _socket.ReceiveBufferSize = _socketReceiveBuffer.Length;
            _socket.SendBufferSize    = 64 * 1024;
            _socket.Blocking          = true;

            _senderThread = new Thread(SendWorker);
            _senderThread.Start();

            SendToClientMethod = Send;
        }
示例#10
0
        public RloginSession(Socket rloginConnection, string moduleIdentifier = null) : base(rloginConnection.RemoteEndPoint.ToString())
        {
            ModuleIdentifier   = moduleIdentifier;
            SessionType        = EnumSessionType.Rlogin;
            SendToClientMethod = Send;
            _host             = ServiceResolver.GetService <IMbbsHost>();
            _logger           = ServiceResolver.GetService <ILogger>();
            _rloginConnection = rloginConnection;
            _rloginConnection.ReceiveTimeout    = (1000 * 60) * 5;
            _rloginConnection.ReceiveBufferSize = 128;
            SessionState = EnumSessionState.Negotiating;

            //Start Listeners & Senders
            _sendThread = new Thread(SendWorker);
            _sendThread.Start();
            _receiveThread = new Thread(ReceiveWorker);
            _receiveThread.Start();

            //Add this Session to the Host
            _host.AddSession(this);
        }
示例#11
0
 public SocketServer(ILogger logger, IMbbsHost host, IConfiguration configuration)
 {
     _logger        = logger;
     _host          = host;
     _configuration = configuration;
 }