Example #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;
        
     }
 }
Example #2
0
 public MessageBuilder(AuthClient authClient, WebSocket client, string endpoint, string syncKey)
 {
     _authClient = authClient;
     _client = client;
     Endpoint = endpoint;
     synckey = syncKey;
 }
Example #3
0
 /// <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;
 }
Example #4
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.RequestCpuInformation:
             GetCpuInformation();
             break;
     }
 }
Example #5
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.InvalidOrEmptyPacket:
             InvalidPacket();
             break;
         case PacketManager.PacketTypes.NoAuth:
             NoAuth();
             break;
     }
 }
Example #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;
     }
 }
 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;
     }
 }
Example #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;
     }
 }
Example #9
0
 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;
     }
 }
Example #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;
            }
        }
Example #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;
     }
 }
Example #12
0
        /// <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;
        }
Example #13
0
 /// <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;
     }
 }
        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;
            }
        }
Example #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;
     }
 }