コード例 #1
0
 public override void HandlePacket(Packet packet)
 {
     _client = packet.Client;
     _authClient = packet.AuthClient;
     _packet = packet;
     _builder = new MessageBuilder(_authClient, _client, _packet.EndPoint, _packet.SyncKey);
     switch (_packet.PacketType)
     {
         case PacketManager.PacketTypes.AddOrUpdateJob:
             AddOrUpdateJob();
             break;
         case PacketManager.PacketTypes.RemoveJob:
             RemoveJob();
             break;
         case PacketManager.PacketTypes.StopJobDaemon:
             StopJobDaemon();
             break;
         case PacketManager.PacketTypes.StartJobDaemon:
             StartJobDaemon();
             break;
         case PacketManager.PacketTypes.GetJobDaemonStatus:
             GetJobDaemonStatus();
             break;
         case PacketManager.PacketTypes.GetJobContents:
             GetJobContents();
             break;
         case PacketManager.PacketTypes.GetAllJobs:
             GetAllJobs();
             break;
        
     }
 }
コード例 #2
0
ファイル: MessageBuilder.cs プロジェクト: Ulterius/server
 public MessageBuilder(AuthClient authClient, WebSocket client, string endpoint, string syncKey)
 {
     _authClient = authClient;
     _client = client;
     Endpoint = endpoint;
     synckey = syncKey;
 }
コード例 #3
0
ファイル: Packet.cs プロジェクト: Ulterius/server
 /// <summary>
 ///     Create a packet
 /// </summary>
 /// <param name="authClient"></param>
 /// <param name="client"></param>
 /// <param name="endPoint"></param>
 /// <param name="syncKey"></param>
 /// <param name="args"></param>
 /// <param name="packetType"></param>
 /// <param name="packetHandler"></param>
 public Packet(AuthClient authClient, WebSocket client, string endPoint, string syncKey, List<object> args,
     PacketTypes packetType,
     Type packetHandler)
 {
     AuthClient = authClient;
     Client = client;
     EndPoint = endPoint;
     SyncKey = syncKey;
     Args = args;
     PacketType = packetType;
     _packetHandler = packetHandler;
 }
コード例 #4
0
ファイル: CpuPacketHandler.cs プロジェクト: Ulterius/server
 public override void HandlePacket(Packet packet)
 {
     _client = packet.Client;
     _authClient = packet.AuthClient;
     _packet = packet;
     _builder = new MessageBuilder(_authClient, _client, _packet.EndPoint, _packet.SyncKey);
     switch (_packet.PacketType)
     {
         case PacketManager.PacketTypes.RequestCpuInformation:
             GetCpuInformation();
             break;
     }
 }
コード例 #5
0
ファイル: ErrorPacketHandler.cs プロジェクト: Ulterius/server
 public override void HandlePacket(Packet packet)
 {
     _client = packet.Client;
     _authClient = packet.AuthClient;
     _packet = packet;
     _builder = new MessageBuilder(_authClient, _client, _packet.EndPoint, _packet.SyncKey);
     switch (_packet.PacketType)
     {
         case PacketManager.PacketTypes.InvalidOrEmptyPacket:
             InvalidPacket();
             break;
         case PacketManager.PacketTypes.NoAuth:
             NoAuth();
             break;
     }
 }
コード例 #6
0
 public override void HandlePacket(Packet packet)
 {
     _client = packet.Client;
     _authClient = packet.AuthClient;
     _packet = packet;
     _builder = new MessageBuilder(_authClient, _client, _packet.EndPoint, _packet.SyncKey);
     switch (_packet.PacketType)
     {
         case PacketManager.PacketTypes.SaveSettings:
             SaveSettings();
             break;
         case PacketManager.PacketTypes.GetCurrentSettings:
             GetCurrentSettings();
             break;
     }
 }
コード例 #7
0
 public override void HandlePacket(Packet packet)
 {
     _client = packet.Client;
     _authClient = packet.AuthClient;
     _packet = packet;
     _builder = new MessageBuilder(_authClient, _client, _packet.EndPoint, _packet.SyncKey);
     switch (_packet.PacketType)
     {
         case PacketManager.PacketTypes.RequestOsInformation:
             GetOperatingSystemInformation();
             break;
       
         case PacketManager.PacketTypes.GetEventLogs:
             // GetEventLogs();
             break;
     }
 }
コード例 #8
0
 public override void HandlePacket(Packet packet)
 {
     _client = packet.Client;
     _authClient = packet.AuthClient;
     _packet = packet;
     _builder = new MessageBuilder(_authClient, _client, _packet.EndPoint, _packet.SyncKey);
     switch (_packet.PacketType)
     {
         case PacketManager.PacketTypes.ChangeDisplayResolution:
             ChangeScreenResolution();
             break;
         case PacketManager.PacketTypes.RotateDisplay:
             RotateDisplay();
             break;
         case PacketManager.PacketTypes.SetPrimaryDisplay:
             SetPrimaryDisplay();
             break;
         case PacketManager.PacketTypes.GetEventLogs:
             // GetEventLogs();
             break;
     }
 }
コード例 #9
0
ファイル: FilePacketHandler.cs プロジェクト: Ulterius/server
 public override void HandlePacket(Packet packet)
 {
      config = Config.Load();
     _client = packet.Client;
     _authClient = packet.AuthClient;
     _packet = packet;
     _builder = new MessageBuilder(_authClient, _client, _packet.EndPoint, _packet.SyncKey);
     switch (_packet.PacketType)
     {
         case PacketTypes.SearchFiles:
             SearchFile();
             break;
         case PacketTypes.ApproveFile:
             ApproveFile();
             break;
         case PacketTypes.RequestFile:
             RequestFile();
             break;
         case PacketTypes.RemoveFile:
             RemoveFile();
             break;
         case PacketTypes.CreateFileTree:
             CreateFileTree();
             break;
     }
 }
コード例 #10
0
        public override void HandlePacket(Packet packet)
        {
            _client = packet.Client;
            _authClient = packet.AuthClient;
            _packet = packet;
            _builder = new MessageBuilder(_authClient, _client, _packet.EndPoint, _packet.SyncKey);
            switch (_packet.PacketType)
            {
                case PacketManager.PacketTypes.StartCamera:
                    StartCamera();
                    break;
                case PacketManager.PacketTypes.StopCamera:
                    StopCamera();
                    break;
                case PacketManager.PacketTypes.PauseCamera:
                    PauseCamera();
                    break;
                case PacketManager.PacketTypes.StopCameraStream:
                    StopStream();
                    break;
                case PacketManager.PacketTypes.StartCameraStream:
                    StartStream();
                    break;
                case PacketManager.PacketTypes.GetCameras:
                    GetCameras();
                    break;
                case PacketManager.PacketTypes.GetCameraFrame:

                    break;
            }
        }
コード例 #11
0
 public override void HandlePacket(Packet packet)
 {
     _client = packet.Client;
     _authClient = packet.AuthClient;
     _packet = packet;
     _builder = new MessageBuilder(_authClient, _client, _packet.EndPoint, _packet.SyncKey);
     switch (_packet.PacketType)
     {
         case PacketManager.PacketTypes.GetWindowsData:
             GetAccountData();
             break;
     }
 }
コード例 #12
0
ファイル: PacketManager.cs プロジェクト: Ulterius/server
        /// <summary>
        /// Handle a plain text packet
        /// </summary>
        /// <param name="authClient"></param>
        /// <param name="packetData"></param>
        public PacketManager(AuthClient authClient, WebSocket client, string packetData)
        {
      
            _authClient = authClient;
            _client = client;
            try
            {
              
                    var validHandshake = JObject.Parse(packetData);
                    var endpoint = validHandshake["endpoint"].ToString().Trim().ToLower();
                    if (!endpoint.Equals("aeshandshake") || authClient.AesShook)
                    {
                        Console.WriteLine("Invalid handshake protocol");
                        _packetType = PacketTypes.InvalidOrEmptyPacket;
                        return;
                    }
                
            }
            catch (Exception e)
            {
                _packetType = PacketTypes.InvalidOrEmptyPacket;
                Console.WriteLine($"Packet failed: {e.Message}");
                return;
            }

            _plainText = packetData;
        }
コード例 #13
0
ファイル: PacketManager.cs プロジェクト: Ulterius/server
 /// <summary>
 /// Decrypt a packet
 /// </summary>
 /// <param name="authClient"></param>
 /// <param name="data"></param>
 public PacketManager(AuthClient authClient, WebSocket client, byte[] data)
 {
     _authClient = authClient;
     _client = client;
     try
     {
         var keyBytes = Encoding.UTF8.GetBytes(Rsa.SecureStringToString(authClient.AesKey));
         var ivBytes = Encoding.UTF8.GetBytes(Rsa.SecureStringToString(authClient.AesIv));
         _plainText = UlteriusAes.Decrypt(data, keyBytes, ivBytes);
     }
     catch (Exception e)
     {
         Console.WriteLine($"Packet failed to decrypt: {e.Message}");
         _packetType = PacketTypes.InvalidOrEmptyPacket;
     }
 }
コード例 #14
0
        public override void HandlePacket(Packet packet)
        {
            _client = packet.Client;
            _authClient = packet.AuthClient;
            _packet = packet;
            _builder = new MessageBuilder(_authClient, _client, _packet.EndPoint, _packet.SyncKey);
            switch (_packet.PacketType)
            {
                case PacketManager.PacketTypes.MouseDown:
                    if (UlteriusApiServer.RunningAsService)
                    {
                        HandleAgentMouseDown();
                    }
                    else
                    {
                        HandleMouseDown();
                    }
                    break;
                case PacketManager.PacketTypes.MouseUp:
                    if (UlteriusApiServer.RunningAsService)
                    {
                        HandleAgentMouseUp();
                    }
                    else
                    {
                        HandleMouseUp();
                    }
                    break;
                case PacketManager.PacketTypes.CtrlAltDel:

                    HandleCtrlAltDel();

                    break;
                case PacketManager.PacketTypes.MouseScroll:
                    if (UlteriusApiServer.RunningAsService)
                    {
                        HandleAgentMouseScroll();
                    }
                    else
                    {
                        HandleScroll();
                    }

                    break;
                case PacketManager.PacketTypes.LeftDblClick:
                    break;
                case PacketManager.PacketTypes.KeyDown:
                    if (UlteriusApiServer.RunningAsService)
                    {
                        HandleAgentKeyDown();
                    }
                    else
                    {
                        HandleKeyDown();
                    }

                    break;
                case PacketManager.PacketTypes.RightDown:
                    if (UlteriusApiServer.RunningAsService)
                    {
                        HandleAgentRightDown();
                    }
                    else
                    {
                        RightDown();
                    }
                    break;
                case PacketManager.PacketTypes.RightUp:
                    if (UlteriusApiServer.RunningAsService)
                    {
                        HandleAgentRightUp();
                    }
                    else
                    {
                        RightUp();
                    }

                    break;
                case PacketManager.PacketTypes.KeyUp:
                    if (UlteriusApiServer.RunningAsService)
                    {
                        HandleAgentKeyUp();
                    }
                    else
                    {
                        HandleKeyUp();
                    }
                    break;
                case PacketManager.PacketTypes.FullFrame:
                    if (UlteriusApiServer.RunningAsService)
                    {
                        HandleAgentFullFrame();
                    }
                    else
                    {
                        HandleFullFrame();
                    }
                    break;
                case PacketManager.PacketTypes.RightClick:
                    if (UlteriusApiServer.RunningAsService)
                    {
                        HandleAgentRightClick();
                    }
                    else
                    {
                        HandleRightClick();
                    }

                    break;
                case PacketManager.PacketTypes.MouseMove:
                    if (UlteriusApiServer.RunningAsService)
                    {
                        HandleAgentMouseMove();
                    }
                    else
                    {
                        HandleMoveMouse();
                    }
                    break;
                case PacketManager.PacketTypes.CheckScreenShare:
                    CheckServer();
                    break;
                case PacketManager.PacketTypes.StartScreenShare:
                    StartScreenShare();
                    break;
                case PacketManager.PacketTypes.StopScreenShare:
                    StopScreenShare();
                    break;
            }
        }
コード例 #15
0
 public override void HandlePacket(Packet packet)
 {
     _client = packet.Client;
     _authClient = packet.AuthClient;
     _packet = packet;
     _builder = new MessageBuilder(_authClient, _client, _packet.EndPoint, _packet.SyncKey);
     switch (_packet.PacketType)
     {
         case PacketManager.PacketTypes.Authenticate:
             Login();
             break;
         case PacketManager.PacketTypes.AesHandshake:
             AesHandshake();
             break;
         case PacketManager.PacketTypes.RestartServer:
             RestartServer();
             break;
         case PacketManager.PacketTypes.ListPorts:
             ListPorts();
             break;
         case PacketManager.PacketTypes.CheckVersion:
             CheckForUpdate();
             break;
         case PacketManager.PacketTypes.GetLogs:
             GetLogs();
             break;
     }
 }