private void ExistingProcessInjection()
        {
            lock (thisLock)
            {
                List <Process> processList = Process.GetProcessesByName(ProcessName).ToList <Process>();

                foreach (Process prc in processList)
                {
                    //PatchedClients n'est plus utilisé
                    prc.WaitForInputIdle();

                    string result;
                    try
                    {
                        RemoteHooking.Inject(prc.Id, FilePath, FilePath, ChannelName, Constants.LoginAddresses.ToList(), 5555);
                        result = "Success";
                    }
                    catch (Exception ex)
                    {
                        Logger.Error("(ProcessInjector) " + ex.Message);
                        result = "Failed";
                    }

                    ConsoleManager.Debug(string.Format("Existing Process Injection Result: ID={0}; RESULT={1};", prc.Id, result.ToString()));
                }
            }
        }
 public static void Error(string Text)
 {
     if (Logger != null)
     {
         Logger.Error(Text);
     }
 }
Beispiel #3
0
        public static void LoadProgram(ContainerLogger logger)
        {
            int time = Environment.TickCount;

            ConsoleManager.InitLogger(logger);
            logger.Info("#Démarrage de la solution...");

            if (!ConfigurationManager.IsFileExists() || ConfigurationManager.GetEntryByName("GamePath") == null)
            {
                logger.Warning("Aucun fichier de configuration trouvé.");

                ConfigurationManager.SerializeConfig();

                Application.Run(new PathForm());

                if (ConfigurationManager.GetEntryByName("GamePath") == null)
                {
                    System.Environment.Exit(1);
                    return;
                }

                logger.Debug("Configuration définie.");
            }
            else
            {
                ConfigurationManager.DeserializeConfig();
                logger.Debug("Fichier de configuration chargé.");
            }

            ProtocolTypeManager.Initialize();
            MessageReceiver.Initialize();

            try
            {
                NetworkManager.StartServers();
                logger.Debug("Serveurs démarrés.");
            }
            catch (Exception ex)
            {
                logger.Error("[SERVERS] " + ex.Message);
                logger.Error("SERVERS - OFF");
            }

            logger.Debug(string.Format("{0}ms", Environment.TickCount - time));

            OnProgramLoaded(null);
        }
        public AutoInjector(string processName, string filePath, ContainerLogger logger)
        {
            RemoteHooking.IpcCreateServer <HookInterface>(ref ChannelName, WellKnownObjectMode.Singleton);
            PatchedClients = new List <int>();
            ProcessName    = processName;
            FilePath       = filePath;
            Running        = false;
            Logger         = logger;

            try
            {
                ExistingProcessInjection();
            }
            catch (Exception ex) { Logger.Error("(ProcessInjector) " + ex.Message); }
        }