Example #1
0
        static bool InjectDLL()
        {
            Console.WriteLine("Waiting for process");
            Process driver = null;
            while (driver == null)
            {
                Process[] procs = Process.GetProcessesByName("Driver");
                if (procs.Length != 0)
                {
                    driver = procs[0];
                }
                else
                {
                    Console.Write(".");
                    System.Threading.Thread.Sleep(1000);
                }
            }
            Console.WriteLine();

            syringe = new Injector(driver);
            try
            {
                syringe.InjectLibrary(LIB_NAME);
            }
            catch (Exception e)
            {
                Console.WriteLine("INJECTION ERROR: " + e.Message);
                return false;
            }

            return true;
        }
Example #2
0
        public static void RunGameCommand(string cmd)
        {
            if (process == null)
            {
                return;
            }

            if (!File.Exists(Directory.GetCurrentDirectory() + "\\Components\\TitanfallInjection.dll"))
            {
                using (WebClient webClient = new WebClient())
                {
                    webClient.DownloadFileAsync(new Uri(INJECTION_DLL_LINK),
                                                Directory.GetCurrentDirectory() + "\\Components\\TitanfallInjection.dll");
                }

                return;
            }

            var syringe = new Injector(process);

            syringe.InjectLibrary(Directory.GetCurrentDirectory() + "\\Components\\TitanfallInjection.dll");

            var consolecmd = new ConsoleCommand();

            consolecmd.Cmd = cmd;
            syringe.CallExport("TitanfallInjection.dll", "FzzyConsoleCommand", consolecmd);
        }
Example #3
0
        static void Main(string[] args)
        {
            Console.WriteLine("Trying to inject dll into notepad.exe");
            MessageStruct messageData = new MessageStruct()
            {
                Text = "Custom Message", Caption = "Custom Message Box"
            };

            using (Injector syringe = new Injector(Process.GetProcessesByName("notepad")[0]))
            {
                syringe.InjectLibrary("Stub.dll");

                Console.WriteLine("Stub.dll injected into notepad, trying to call void Initialise() with no parameters");
                Console.ReadLine();
                syringe.CallExport("Stub.dll", "Initialise");
                Console.WriteLine("Waiting...");
                Console.ReadLine();
                Console.WriteLine("Trying to call InitWithMessage( PVOID ) with custom data {0}", messageData);
                Console.ReadLine();
                syringe.CallExport("Stub.dll", "InitWithMessage", messageData);
                Console.WriteLine("Waiting...");
                Console.ReadLine();
            }
            Console.WriteLine("Stub.dll should be ejected");
            Console.ReadLine();
        }
Example #4
0
 void TryInject(Injector injector)
 {
     try {
         injector.InjectLibrary(Path.Combine(_spec.SteamPath, "GameOverlayRenderer.dll"));
     } catch (Win32Exception) {
         TryInject64(injector);
     }
 }
Example #5
0
 void TryInject64(Injector injector)
 {
     try {
         injector.InjectLibrary(Path.Combine(_spec.SteamPath,
                                             "GameOverlayRenderer64.dll"));
     } catch (Win32Exception e) {
         MainLog.Logger.FormattedWarnException(e);
     }
 }
Example #6
0
        public void Inject(String dll, String process)
        {
            //String dll = "C:\\Users\\emist\\Documents\\Visual Studio 2008\\Projects\\InjectDLL\\Debug\\InjectDLL.dll";

            Console.WriteLine("Trying to inject " + dll + " into " + process);
            MessageStruct messageData = new MessageStruct() { Text = "Custom Message", Caption = "Custom Message Box" };
            Process[] processes = Process.GetProcessesByName(process);
            Array.Sort(processes, delegate(Process x, Process y) { return -1 * (x.StartTime.CompareTo(y.StartTime)); });
            syringe = new Injector(processes[0]);
            syringe.InjectLibrary(dll);
            Console.WriteLine(dll + " injected into " + process);
        }
Example #7
0
        public void Inject(String dll, String process)
        {
            //String dll = "C:\\Users\\emist\\Documents\\Visual Studio 2008\\Projects\\InjectDLL\\Debug\\InjectDLL.dll";

            Console.WriteLine("Trying to inject " + dll + " into " + process);
            MessageStruct messageData = new MessageStruct()
            {
                Text = "Custom Message", Caption = "Custom Message Box"
            };

            Process[] processes = Process.GetProcessesByName(process);
            Array.Sort(processes, delegate(Process x, Process y) { return(-1 * (x.StartTime.CompareTo(y.StartTime))); });
            syringe = new Injector(processes[0]);
            syringe.InjectLibrary(dll);
            Console.WriteLine(dll + " injected into " + process);
        }
Example #8
0
        static void Main(string[] args)
        {
            Console.WriteLine("Trying to inject dll into notepad.exe");
            MessageStruct messageData = new MessageStruct() { Text = "Custom Message", Caption = "Custom Message Box" };
            using (Injector syringe = new Injector(Process.GetProcessesByName("notepad")[0]))
            {
                syringe.InjectLibrary("Stub.dll");

                Console.WriteLine("Stub.dll injected into notepad, trying to call void Initialise() with no parameters");
                Console.ReadLine();
                syringe.CallExport("Stub.dll", "Initialise");
                Console.WriteLine("Waiting...");
                Console.ReadLine();
                Console.WriteLine("Trying to call InitWithMessage( PVOID ) with custom data {0}", messageData);
                Console.ReadLine();
                syringe.CallExport("Stub.dll", "InitWithMessage", messageData);
                Console.WriteLine("Waiting...");
                Console.ReadLine();
            }
            Console.WriteLine("Stub.dll should be ejected");
            Console.ReadLine();
        }
Example #9
0
        protected static void InjectSDK(Process targetProcess)
        {
            if (OnInjectingIntoProcess != null)
            {
                OnInjectingIntoProcess();
            }

            Injector syringe = new Injector(targetProcess);

            syringe.SetDLLSearchPath(AppDomain.CurrentDomain.BaseDirectory);
            syringe.InjectLibrary(SDKDllName);

            SDKSettings settings = new SDKSettings();

            settings.BasePath      = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, SDKDataPath);
            settings.DeveloperMode = Api.IcepickRegistry.ReadEnableDeveloperMode();
            syringe.CallExport(SDKDllName, InitializeFunction, settings);

            if (OnInjectionComplete != null)
            {
                OnInjectionComplete();
            }
        }
Example #10
0
 void TryInject64(Injector injector) {
     try {
         injector.InjectLibrary(Path.Combine(_spec.SteamPath,
             "GameOverlayRenderer64.dll"));
     } catch (Win32Exception e) {
         MainLog.Logger.FormattedWarnException(e);
     }
 }
Example #11
0
 void TryInject(Injector injector) {
     try {
         injector.InjectLibrary(Path.Combine(_spec.SteamPath, "GameOverlayRenderer.dll"));
     } catch (Win32Exception) {
         TryInject64(injector);
     }
 }
Example #12
0
        public void Update()
        {
            if (m_GameProcess == null || m_GameProcess.HasExited)
            {
                if (m_SkipUpdates > 0)
                {
                    --m_SkipUpdates;
                    return;
                }

                m_SkipUpdates = 4;

                m_GameProcess = null;
                Active = false;

                if (Reader != null)
                {
                    Reader.CloseHandle();
                    Reader = null;
                }

                if (m_Injector != null)
                {
                    m_Injector.Dispose();
                    m_Injector = null;
                }

                var s_Processes = Process.GetProcessesByName("HitmanBloodMoney");

                if (s_Processes.Length == 0)
                    return;

                // We always select the first process.
                m_GameProcess = s_Processes[0];

                // Setup our Memory Reader.
                Reader = new ProcessMemoryReader(m_GameProcess);

                try
                {
                    if (Reader.OpenProcess())
                    {
                        m_SkipUpdates = 0;
                        Active = true;

                        // Create our injector and inject our stat module.
                        m_Injector = new Injector(m_GameProcess, false);
                        m_Injector.InjectLibrary("HM3.dll");

                        // Setup our main control.
                        MainApp.MainWindow.Dispatcher.Invoke(() =>
                        {
                            Control = new MainControl();
                        });

                        // Setup our engine-specific classes.
                        StatTracker = new StatTracker(this);
                        TimeTracker = new TimeTracker(this);

                        // Update level labels.
                        CurrentLevel = "No Level";
                        CurrentLevelScene = "No Level";
                        InGame = false;

                        Control.SetCurrentLevel(CurrentLevel);
                        Control.SetCurrentLevelScene(CurrentLevelScene);

                        // Set our control in the main window.
                        InitMenuItems();
                        MainApp.MainWindow.SetEngineControl(Control, m_MenuItems);
                    }
                }
                catch (Exception)
                {
                    m_GameProcess = null;
                    Active = false;
                }
            }

            if (!Active)
                return;

            // Update our trackers.
            TimeTracker.Update();
            StatTracker.Update();

            // Set game time.
            if (StatTracker.CurrentStats.m_Time > 0 || !InGame)
                Control.SetCurrentTime(StatTracker.CurrentStats.m_Time);
            else
                Control.SetCurrentTime(TimeTracker.CurrentTime);
        }
Example #13
0
        public void Update()
        {
            if (m_GameProcess == null || m_GameProcess.HasExited)
            {
                if (m_SkipUpdates > 0)
                {
                    --m_SkipUpdates;
                    return;
                }

                m_SkipUpdates = 4;

                m_GameProcess = null;
                Active        = false;

                if (Reader != null)
                {
                    Reader.CloseHandle();
                    Reader = null;
                }

                if (m_Injector != null)
                {
                    m_Injector.Dispose();
                    m_Injector = null;
                }

                var s_Processes = Process.GetProcessesByName("HitmanBloodMoney");

                if (s_Processes.Length == 0)
                {
                    return;
                }

                // We always select the first process.
                m_GameProcess = s_Processes[0];

                // Setup our Memory Reader.
                Reader = new ProcessMemoryReader(m_GameProcess);

                try
                {
                    if (Reader.OpenProcess())
                    {
                        m_SkipUpdates = 0;
                        Active        = true;

                        // Create our injector and inject our stat module.
                        m_Injector = new Injector(m_GameProcess, false);
                        m_Injector.InjectLibrary("HM3.dll");

                        // Setup our main control.
                        MainApp.MainWindow.Dispatcher.Invoke(() =>
                        {
                            Control = new MainControl();
                        });

                        // Setup our engine-specific classes.
                        StatTracker = new StatTracker(this);
                        TimeTracker = new TimeTracker(this);

                        // Update level labels.
                        CurrentLevel      = "No Level";
                        CurrentLevelScene = "No Level";
                        InGame            = false;

                        Control.SetCurrentLevel(CurrentLevel);
                        Control.SetCurrentLevelScene(CurrentLevelScene);

                        // Set our control in the main window.
                        InitMenuItems();
                        MainApp.MainWindow.SetEngineControl(Control, m_MenuItems);
                    }
                }
                catch (Exception)
                {
                    m_GameProcess = null;
                    Active        = false;
                }
            }

            if (!Active)
            {
                return;
            }

            // Update our trackers.
            TimeTracker.Update();
            StatTracker.Update();

            // Set game time.
            if (StatTracker.CurrentStats.m_Time > 0 || !InGame)
            {
                Control.SetCurrentTime(StatTracker.CurrentStats.m_Time);
            }
            else
            {
                Control.SetCurrentTime(TimeTracker.CurrentTime);
            }
        }
Example #14
0
        public void StartMS()
        {
            using (Process process = Process.Start(client, "GameLaunching"))
            {
                while (process.MainWindowHandle == IntPtr.Zero && !process.HasExited)
                    Thread.Sleep(waitWindowSleep);

                if (process.HasExited)
                    return;

                for (int i = 0; i < maxTryCount; i++)
                {
                    try
                    {
                        using (Injector injector = new Injector(process))
                        {

                            injector.EjectOnDispose = false;
                            injector.InjectLibrary(dll);

                            if (ip != IPAddress.Loopback.ToString())
                                injector.CallExport<IPInfo>(dll, "SetIP", new IPInfo(ip));

                            // Add any additional IPs you want maped here, you can also unmap them with UnMapIP if needed
                            return;
                        }
                    }
                    catch
                    {
                        Thread.Sleep(failInjectSleep);
                    }
                }
            }
        }