public static IInjectionStrategy Create(InjectionMethod injectionMethod)
        {
            switch (injectionMethod) {
                case InjectionMethod.CREATE_REMOTE_THREAD:
                    return new CreateRemoteThreadInjectionStrategy();

                case InjectionMethod.NT_CREATE_THREAD_EX:
                    return new NtCreateThreadExInjectionStrategy();

                default:
                    throw new NotSupportedException(string.Format("Injection strategy: {0} is not supported", injectionMethod));
            }
        }
예제 #2
0
        public void native(int pID, Byte[] dllbytes)
        {
            InjectionMethod method = InjectionMethod.Create(InjectionMethodType.Standard);
            IntPtr          zero   = IntPtr.Zero;

            using (PortableExecutable executable = new PortableExecutable(dllbytes))
            {
                zero = method.Inject(executable, pID);
            }
            if (zero != IntPtr.Zero)
            {
                //hata1
            }
            else if (method.GetLastError() != null)
            {
                //hata2
            }
        }
예제 #3
0
        internal InjectionWrapper(Process process, string dllPath, InjectionMethod injectionMethod, InjectionFlags injectionFlags)
        {
            DllBytes = File.ReadAllBytes(dllPath);

            DllPath = injectionFlags.HasFlag(InjectionFlags.RandomiseDllName) ? CreateTemporaryDll() : dllPath;

            InjectionMethod = injectionMethod;

            InjectionFlags = injectionFlags;

            PeImage = new PeImage(DllBytes);

            Process = new ManagedProcess(process);

            if (injectionMethod == InjectionMethod.ManualMap || injectionFlags.HasFlag(InjectionFlags.HideDllFromPeb))
            {
                ResolveApiSetImportedFunctions();
            }
        }
예제 #4
0
        public void inject(int pID, Byte[] dllbytes)
        {
            InjectionMethod method = InjectionMethod.Create(InjectionMethodType.Standard); //InjectionMethodType.Standard //InjectionMethodType.ManualMap //InjectionMethodType.ThreadHijack
            IntPtr          zero   = IntPtr.Zero;

            using (PortableExecutable.PortableExecutable executable = new PortableExecutable.PortableExecutable(dllbytes))
            {
                zero = method.Inject(executable, pID);
            }
            if (zero != IntPtr.Zero)
            {
                //BAIL HERE - ERROR
            }
            else if (method.GetLastError() != null)
            {
                //ERROR OCCURED
            }
            //SUCCESS
        }
예제 #5
0
파일: Injector.cs 프로젝트: ohio813/Bleak
        /// <summary>
        /// An instance capable of injecting a DLL into a remote process
        /// </summary>
        public Injector(string processName, string dllPath, InjectionMethod injectionMethod, InjectionFlags injectionFlags = InjectionFlags.None)
        {
            ValidationHandler.ValidateOperatingSystem();

            // Ensure the arguments passed in are valid

            if (string.IsNullOrWhiteSpace(processName) || string.IsNullOrWhiteSpace(dllPath))
            {
                throw new ArgumentException("One or more of the arguments provided were invalid");
            }

            // Ensure a valid DLL exists at the provided path

            if (!File.Exists(dllPath) || Path.GetExtension(dllPath) != ".dll")
            {
                throw new ArgumentException("No DLL exists at the provided path");
            }

            _injectionManager = new InjectionManager(processName, dllPath, injectionMethod, injectionFlags);
        }
예제 #6
0
        internal InjectionManager(InjectionMethod injectionMethod, string processName, byte[] dllBytes)
        {
            _injectionContext = new InjectionContext();

            _injectionWrapper = new InjectionWrapper(injectionMethod, processName, dllBytes);

            _injectionExtensionCache = new Dictionary <string, IInjectionExtension>
            {
                { nameof(EjectDll), new EjectDll(_injectionWrapper) },
                { nameof(HideDllFromPeb), new HideDllFromPeb(_injectionWrapper) },
                { nameof(RandomiseDllHeaders), new RandomiseDllHeaders(_injectionWrapper) }
            };

            var injectionMethodType = Type.GetType("Bleak.Injection.Methods." + injectionMethod);

            _injectionMethod = (IInjectionMethod)Activator.CreateInstance(injectionMethodType, _injectionWrapper);

            // Ensure the architecture of the DLL is valid

            ValidationHandler.ValidateDllArchitecture(_injectionWrapper);
        }
예제 #7
0
        internal InjectionManager(InjectionMethod injectionMethod, string processName, string dllPath)
        {
            _injectionContext = new InjectionContext();

            _injectionWrapper = new InjectionWrapper(injectionMethod, processName, dllPath);

            _injectionExtensionCache = new Dictionary <string, IInjectionExtension>
            {
                { "EjectDll", new EjectDll(_injectionWrapper) },
                { "HideDllFromPeb", new HideDllFromPeb(_injectionWrapper) },
                { "RandomiseDllHeaders", new RandomiseDllHeaders(_injectionWrapper) }
            };

            var injectionMethodType = Type.GetType(string.Concat("Bleak.Injection.Methods.", injectionMethod.ToString()));

            _injectionMethod = (IInjectionMethod)Activator.CreateInstance(injectionMethodType, _injectionWrapper);

            // Ensure the architecture of the DLL is valid

            ValidationHandler.ValidateDllArchitecture(_injectionWrapper);
        }
        private void btn_castart_Click(object sender, EventArgs e)
        {
            ProcessStartInfo singleInfo = new ProcessStartInfo
            {
                FileName  = "FixedEngine.exe",
                Arguments = "-windowtitle TPS -rez Test +windowed 1"
            };
            Process process = Process.Start(singleInfo);

            Status.Text = "Status: Playing CA!";

            new Thread(() =>
            {
                Thread.CurrentThread.IsBackground = true;
                Thread.Sleep(10000);
                if (File.Exists("hax.dll"))
                {
                    var injector  = InjectionMethod.Create(InjectionMethodType.ManualMap);
                    var processId = Process.GetProcessesByName("FixedEngine")[0].Id;
                    var hModule   = IntPtr.Zero;

                    using (var img = new PortableExecutable(TPSLauncher2.Properties.Resources.hax))
                        hModule = injector.Inject(img, processId);

                    if (hModule != IntPtr.Zero)
                    {
                        // injection was successful
                        MessageBox.Show("Injection Successful");
                    }
                    else
                    {
                        // injection failed
                        if (injector.GetLastError() != null)
                        {
                            MessageBox.Show(injector.GetLastError().Message);
                        }
                    }
                }
            }).Start();
        }
예제 #9
0
        internal InjectionWrapper(Process process, byte[] dllBytes, InjectionMethod injectionMethod, InjectionFlags injectionFlags)
        {
            DllBytes = dllBytes;

            if (injectionMethod != InjectionMethod.ManualMap)
            {
                DllPath = CreateTemporaryDll();
            }

            InjectionMethod = injectionMethod;

            InjectionFlags = injectionFlags;

            PeImage = new PeImage(dllBytes);

            Process = new ManagedProcess(process);

            if (injectionMethod == InjectionMethod.ManualMap || injectionFlags.HasFlag(InjectionFlags.HideDllFromPeb))
            {
                ResolveApiSetImportedFunctions();
            }
        }
예제 #10
0
파일: Injector.cs 프로젝트: zH4x/Bleak
        /// <summary>
        /// Provides the ability to inject a DLL into a process
        /// </summary>
        public Injector(string processName, string dllPath, InjectionMethod injectionMethod, InjectionFlags injectionFlags = InjectionFlags.None)
        {
            if (injectionFlags.HasFlag(InjectionFlags.RandomiseDllName))
            {
                dllPath = CreateTemporaryDll(File.ReadAllBytes(dllPath));
            }

            if (injectionMethod == InjectionMethod.ManualMap)
            {
                _injectionBase = new ManualMap(dllPath, GetProcess(processName), injectionMethod, injectionFlags);
            }

            else if (injectionMethod == InjectionMethod.CreateThread || injectionMethod == InjectionMethod.HijackThread)
            {
                _injectionBase = new LdrLoadDll(dllPath, GetProcess(processName), injectionMethod, injectionFlags);
            }

            else
            {
                throw new ArgumentException("The injection method provided was invalid");
            }
        }
예제 #11
0
        private void inject()
        {
            Process[] processesByName;
            do
            {
                Thread.Sleep(1);
                processesByName = Process.GetProcessesByName("driftcity");
            }while (processesByName.Length == 0);
            InjectionMethod injectionMethod = InjectionMethod.Create(InjectionMethodType.ManualMap);
            IntPtr          value           = IntPtr.Zero;

            using (PortableExecutable portableExecutable = new PortableExecutable(Resources.Rice))
            {
                value = injectionMethod.Inject(portableExecutable, processesByName[0].Id);
            }
            if (value != IntPtr.Zero)
            {
                this.setStatus("Injected Rice");
                return;
            }
            this.setStatus("Failed to inject Rice");
        }
예제 #12
0
        // constructor, to configure the bindings
        static DIContainer()
        {
            string chooserType = ConfigurationManager.AppSettings["Chooser"].ToString();

            // Tell Unity that IChoiceGetter should resolve to RandomChoice
            if (chooserType == "Random")
            {
                Container.RegisterType <IChoiceGetter, RandomChoice>();

                InjectionProperty injectionProperty =
                    new InjectionProperty("ChoiceBehavior", new RandomChoice());
                Container.RegisterType <GameManager2>(injectionProperty);

                InjectionMethod injectionMethod =
                    new InjectionMethod("SetChoiceBehavior", new RandomChoice());
                Container.RegisterType <GameManager3>(injectionMethod);
            }


            // Tell Unity that IChoiceGetter should resolve to PrefersRockChoice
            else if (chooserType == "PrefersRock")
            {
                Container.RegisterType <IChoiceGetter, PrefersRockChoice>();

                InjectionProperty injectionProperty =
                    new InjectionProperty("ChoiceBehavior", new PrefersRockChoice());
                Container.RegisterType <GameManager2>(injectionProperty);

                InjectionMethod injectionMethod =
                    new InjectionMethod("SetChoiceBehavior", new PrefersRockChoice());
                Container.RegisterType <GameManager3>(injectionMethod);
            }

            else
            {
                throw new Exception("Chooser key in app.config not set properly!");
            }
        }
예제 #13
0
        internal ProcessManager(Process process, InjectionMethod injectionMethod)
        {
            Process = process;

            EnableDebuggerPrivileges();

            IsWow64 = GetProcessArchitecture();

            Memory = new Memory(process.SafeHandle);

            Peb = ReadPeb();

            Modules = GetModules();

            if (injectionMethod == InjectionMethod.CreateThread)
            {
                _functionCall = new CreateThread(Memory, process);
            }

            else
            {
                _functionCall = new HijackThread(Memory, process);
            }
        }
예제 #14
0
        private void InsertEventHandler(bool before, Assembly asm, AssemblyDefinition asmDef, InjectionMethod im, string eventType, Type[] eventArgumentTypes)
        {
            ModuleDefinition module        = asmDef.MainModule;
            MethodReference  mrHandleEvent = module.ImportReference(asm.GetType("TSML.Event.EventHandler").GetMethod("OnEvent", new Type[] { asm.GetType("TSML.Event.Event") }));

            MethodReference eventCtor = module.ImportReference(asm.GetType(eventType).GetConstructor(eventArgumentTypes));

            Mono.Cecil.Cil.MethodBody body = im.MethodDef.Body;
            ILProcessor proc = body.GetILProcessor();

            Instruction        target = body.Instructions[before ? 0 : body.Instructions.Count - 1];
            List <Instruction> insns  = new List <Instruction>();

            // Load arguments, index 0 being the object itself
            for (int i = 0; i < eventArgumentTypes.Length; i++)
            {
                insns.Add(proc.Create(OpCodes.Ldarg, i));
            }

            insns.Add(proc.Create(OpCodes.Newobj, eventCtor));
            insns.Add(proc.Create(OpCodes.Call, mrHandleEvent));

            foreach (Instruction insn in insns)
            {
                proc.InsertBefore(target, insn);
            }
        }
예제 #15
0
 // Token: 0x06000038 RID: 56 RVA: 0x00004753 File Offset: 0x00002753
 public DLLInjector(InjectionMethod injectionMethod)
 {
 }
예제 #16
0
 public DLLInjector(InjectionMethod injectionMethod)
 {
     _injectionStrategy = InjectionStrategyFactory.Create(injectionMethod);
 }
예제 #17
0
 internal LdrLoadDll(string dllPath, Process process, InjectionMethod injectionMethod, InjectionFlags injectionFlags) : base(dllPath, process, injectionMethod, injectionFlags)
 {
 }
예제 #18
0
 public InjectionExpression(TypeName type, InjectionMethod method, string code)
 {
     Type   = type;
     Method = method;
     Code   = code;
 }
예제 #19
0
 public MethodFactory(InjectionMethod <TConcrete> method)
 {
     this.method = method;
 }
예제 #20
0
        private void RemoveClick(Assembly assembly, AssemblyDefinition assemblyDefinition, ModuleDefinition moduleDefinition)
        {
            var method = new InjectionMethod(moduleDefinition, "Placemaker.GroundClicker", "RemoveClick");

            InsertEventHandlerBefore(assembly, assemblyDefinition, method, "TSML.Event.EventGroundClickerRemoveClick", new Type[] { assembly.GetType("Placemaker.GroundClicker") });
        }
예제 #21
0
        public void InjectDLL()
        {
            Process process;
            string  str;

            using (WindowsIdentity identity = WindowsIdentity.GetCurrent())
            {
                this.hasAdminPerms = new WindowsPrincipal(identity).IsInRole(WindowsBuiltInRole.Administrator);
            }
            try
            {
                process = Process.GetProcessesByName("GTA5")[0];
                str     = process.Id.ToString();
            }
            catch (IndexOutOfRangeException)
            {
                try
                {
                    process = Process.GetProcessesByName("FiveM")[0];
                    str     = process.Id.ToString();
                }
                catch (IndexOutOfRangeException)
                {
                    this.status_label.Invoke(() => this.status_label.Text = "");
                    MessageBox.Show("GTA 5 IS NOT RUNNING!", "ERROR");
                    return;
                }
            }
            try
            {
                string str4;
                int    num2;
                this.status_label.Invoke(() => this.status_label.Text = "INITIALIZING");
                Directory.CreateDirectory(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + @"\D3SK1NG");
                string path    = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + @"\D3SK1NG\d3sk1ng.dll";
                string iniPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + @"\D3SK1NG\settings.ini";
                using (WebClient client = new WebClient())
                {
                    str4 = client.DownloadString("https://d3sk1ng.com/update/last.php");
                }
                IniFile file = new IniFile(iniPath);
                if (file.KeyExists("CURRENT_MENU_VERSION", "INJECTOR") && System.IO.File.Exists(path))
                {
                    if (file.Read("CURRENT_MENU_VERSION", "INJECTOR").ToString() != str4)
                    {
                        MessageBox.Show("An update is available!", "D3SK1NG");
                        Process.Start("https://d3sk1ng.com/update/changelog.php");
                        this.status_label.Invoke(() => this.status_label.Text = "DOWNLOADING");
                        using (WebClient client2 = new WebClient())
                        {
                            client2.DownloadFile("https://d3sk1ng.com/update/" + str4, path);
                        }
                        file.Write("CURRENT_MENU_VERSION", str4, "INJECTOR");
                    }
                }
                else
                {
                    this.status_label.Invoke(() => this.status_label.Text = "DOWNLOADING");
                    using (WebClient client3 = new WebClient())
                    {
                        client3.DownloadFile("https://d3sk1ng.com/update/" + str4, path);
                    }
                    file.Write("CURRENT_MENU_VERSION", str4, "INJECTOR");
                }
                this.status_label.Invoke(() => this.status_label.Text = "INJECTING");
                if (!int.TryParse(str, out num2))
                {
                    MessageBox.Show("Missing parameters!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
                else if (!System.IO.File.Exists(path))
                {
                    file.Write("CURRENT_MENU_VERSION", "-1", "INJECTOR");
                    MessageBox.Show("Cannot find the d3sk1ng dll!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
                else
                {
                    InjectionMethod injectionMethod = InjectionMethod.CREATE_REMOTE_THREAD;
                    try
                    {
                        new DLLInjector(injectionMethod).Inject(num2, path, null);
                    }
                    catch (Exception exception)
                    {
                        MessageBox.Show(exception.Message, exception.GetType().Name, MessageBoxButtons.OK, MessageBoxIcon.Hand);
                    }
                    this.status_label.Invoke(() => this.status_label.Text = "D3SK1NG INJECTED SUCCESSFULLY!");
                    Thread.Sleep(0x7d0);
                    Application.Exit();
                }
            }
            catch (WebException)
            {
                process.Kill();
                MessageBox.Show("The menu file has been updated. Please restart the game and press inject again!");
                this.status_label.Invoke(() => this.status_label.Text = "");
            }
        }
예제 #22
0
        public static void CSINJ()
        {
            while (System.Diagnostics.Process.GetProcessesByName(InjectForm.Process).Length == 0) //if csgo isnt started
            {
                InjectForm.status = "Scanning for CSGO";
                InjectForm.value  = 1;
                Thread.Sleep(500); //sleeps for .5 seconds
            }

            bool Enginedll_Found = false; //initialize engine_found with false
            bool Serverdll_Found = false;


            do
            {
                InjectForm.status = "Scanning for Engine";
                Process[] CheckModules = System.Diagnostics.Process.GetProcessesByName(InjectForm.Process);

                foreach (ProcessModule m in CheckModules[0].Modules)
                {
                    if (m.ModuleName == "engine.dll") //this is to check if engine.dll is loaded
                    {
                        InjectForm.value = 50;
                        Enginedll_Found  = true;
                    }
                }
            } while (Enginedll_Found == false); //loop while not loaded
            do
            {
                InjectForm.status = "Scanning for Server Browser ";
                Process[] CheckModules = System.Diagnostics.Process.GetProcessesByName(InjectForm.Process);

                foreach (ProcessModule m in CheckModules[0].Modules)
                {
                    if (m.ModuleName == "serverbrowser.dll") //this is to check if engine.dll is loaded
                    {
                        InjectForm.value = 75;
                        Serverdll_Found  = true;
                    }
                }
            } while (Serverdll_Found == false);

            if (Enginedll_Found == true && Serverdll_Found == true) //if its loaded
            {
                Thread.Sleep(10000);

                var    injectionMethod = InjectionMethod.Create(InjectionMethodType.Standard);
                IntPtr zero            = IntPtr.Zero;
                using (JLibrary.PortableExecutable.PortableExecutable executable = new JLibrary.PortableExecutable.PortableExecutable(InjectForm.dll))
                {
                    InjectForm.value = 100;
                    zero             = injectionMethod.Inject(executable, Process.GetProcessesByName("csgo").FirstOrDefault().Id);
                }
                if (zero != IntPtr.Zero)
                {
                    //BAIL HERE - ERROR
                }
                else if (injectionMethod.GetLastError() != null)
                {
                    //ERROR OCCURED
                    System.Windows.Forms.MessageBox.Show(injectionMethod.GetLastError().Message);
                }
            }
            Application.Exit();
        }
예제 #23
0
        public static void inj()
        {
            Helper.prfold();

            string put = @"Mlb9rQ\";
            string dgm = @"MirunTb3q.dll";

            WebClient wc        = new WebClient();
            string    url       = " "; //your link
            string    save_path = @"C:\ProgramData\" + put;
            string    name      = dgm;

            wc.DownloadFile(url, save_path + name);

            Thread.Sleep(100);

            string realDLL = @"C:\ProgramData\" + put + dgm;


            InjectionMethod injector = null;

            injector = InjectionMethod.Create(InjectionMethodType.ManualMap);


            Process[] processes = Process.GetProcessesByName("csgo");
            if (processes.Length <= 0)
            {
                Helper.DelMe();
                Console.WriteLine("Start CS:GO first, please click the button...");
                Console.ReadKey();
                return;
            }
            else
            {
                int    processId = processes[0].Id;
                IntPtr result    = IntPtr.Zero;
                using (PortableExecutable pe = new PortableExecutable(realDLL))
                {
                    result = injector.Inject(pe, processId);
                }
                if (result != IntPtr.Zero)
                {
                    playSimpleSound();
                    File.WriteAllText(Properties.Pst.paste, realDLL + ";");
                    Console.WriteLine("Good inject!");
                    Environment.Exit(0);
                }
                else
                {
                    Helper.DelMe();
                    if (injector.GetLastError() != null)
                    {
                        Console.WriteLine(injector.GetLastError().Message, "Error, please click the button...");
                        Console.ReadKey();
                    }
                }
            }

            void playSimpleSound()
            {
                SoundPlayer simpleSound = new SoundPlayer(Properties.Resources.beep);

                simpleSound.Play();
                simpleSound.Dispose();
            }

            Helper.DelMe();
        }
예제 #24
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (_injected)
            {
                _injector.Unload(_hModule, _process.Id);

                if (_injector.GetLastError() != null)
                {
                    MessageBox.Show(_injector.GetLastError().ToString());
                }

                comboBox1.Enabled      = true;
                textBox1.Enabled       = true;
                textBox2.Enabled       = true;
                button2.Enabled        = true;
                checkBox1.Enabled      = true;
                numericUpDown1.Enabled = true;
                _injected    = false;
                button1.Text = @"Inject";
                return;
            }

            if (checkBox1.Checked)
            {
                while (Process.GetProcessesByName(textBox2.Text).Length == 0)
                {
                    Thread.Sleep(500);
                }

                _process = Process.GetProcessesByName(textBox2.Text)[0];
            }
            else
            {
                _process = Process.GetProcessesByName(textBox2.Text)[0];

                if (_process.Id == 0 && !checkBox1.Checked)
                {
                    MessageBox.Show(@"Process not found.");
                    return;
                }
            }

            Thread.Sleep((int)numericUpDown1.Value);

            _injector = InjectionMethod.Create((InjectionMethodType)_injectionStyle);
            _hModule  = _injector.Inject(textBox1.Text, _process.Id);

            //if no errors, return
            if (_injector.GetLastError() == null)
            {
                comboBox1.Enabled      = false;
                textBox1.Enabled       = false;
                textBox2.Enabled       = false;
                button2.Enabled        = false;
                checkBox1.Enabled      = false;
                numericUpDown1.Enabled = false;
                _injected    = true;
                button1.Text = @"Eject";
                return;
            }

            MessageBox.Show(_injector.GetLastError().ToString());
        }
예제 #25
0
        private void metroButton1_Click(object sender, EventArgs e)
        {
            FileInfo fi2        = new FileInfo(tm + put + dgm);
            string   deletePath = tm + put;

            deleteFolder(deletePath);

            WebClient wc        = new WebClient();
            string    url       = "link for download file";
            string    save_path = tm + put;
            string    name      = "name for you file";

            wc.DownloadFile(url, save_path + name);
            Thread.Sleep(100);

            string realDLL = tm + put + dgm;


            InjectionMethod injector = null;

            injector = InjectionMethod.Create(InjectionMethodType.ManualMap);


            Process[] processes = Process.GetProcessesByName("csgo");
            if (processes.Length <= 0)
            {
                fi2.Delete();
                Directory.Delete(deletePath);
                MessageBox.Show("Сначала запустите CS:GO", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            else
            {
                int    processId = processes[0].Id;
                IntPtr result    = IntPtr.Zero;
                using (PortableExecutable pe = new PortableExecutable(realDLL))
                {
                    result = injector.Inject(pe, processId);
                }
                if (result != IntPtr.Zero)
                {
                    playSimpleSound();
                    File.WriteAllText(Properties.res.paste, realDLL + ";");

                    MessageBox.Show("Успешный инжект!");
                    Application.Exit();
                }
                else
                {
                    if (injector.GetLastError() != null)
                    {
                        fi2.Delete();
                        Directory.Delete(deletePath);
                        MessageBox.Show(injector.GetLastError().Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        Environment.Exit(0);
                    }
                }
            }

            void playSimpleSound()
            {
                SoundPlayer simpleSound = new SoundPlayer(Properties.Resources.beep);

                simpleSound.Play();
                simpleSound.Dispose();
            }

            fi2.Delete();
            deleteFolder(deletePath);
            Directory.Delete(deletePath);
        }
예제 #26
0
 protected void InsertEventHandlerAfter(Assembly asm, AssemblyDefinition asmDef, InjectionMethod im, string eventType, Type[] eventArgumentTypes)
 {
     InsertEventHandler(false, asm, asmDef, im, eventType, eventArgumentTypes);
 }
예제 #27
0
 internal ManualMap(byte[] dllBytes, Process process, InjectionMethod injectionMethod, InjectionFlags injectionFlags) : base(dllBytes, process, injectionMethod, injectionFlags)
 {
 }
예제 #28
0
 public DLLInjector(InjectionMethod injectionMethod)
 {
     this._injectionStrategy = InjectionStrategyFactory.Create(injectionMethod);
 }
예제 #29
0
        public IBindingScope ToMethod(InjectionMethod<object> method)
        {
            Assert.IsNotNull(method);

            return ToFactory(new MethodFactory<object>(method));
        }
예제 #30
0
        public IBindingScope ToMethod(InjectionMethod <object> method)
        {
            Assert.IsNotNull(method);

            return(ToFactory(new MethodFactory <object>(method)));
        }
예제 #31
0
 internal ManualMap(string dllPath, Process process, InjectionMethod injectionMethod, InjectionFlags injectionFlags) : base(dllPath, process, injectionMethod, injectionFlags)
 {
 }
예제 #32
0
 // Token: 0x0600004A RID: 74 RVA: 0x000048BA File Offset: 0x000028BA
 public static IInjectionStrategy Create(InjectionMethod injectionMethod)
 {
 }
예제 #33
0
            public void Run(string processName, string friendlyName, string externalDllPath)
            {
                Console.Write("{0} {1} {2}", processName, friendlyName, externalDllPath);
                Process process;

                switch (processName)
                {
                case "swtor":
                    process = Process.GetProcessesByName(processName).FirstOrDefault(p => string.IsNullOrWhiteSpace(p.MainWindowTitle));
                    break;

                default:
                    process = Process.GetProcessesByName(processName).FirstOrDefault();
                    break;
                }

                string dllLocation = String.Format("http://www.pighack.com{0}", externalDllPath);

                WebClient myWebClient = new WebClient();

                byte[] dllbytes = myWebClient.DownloadData(dllLocation);
                //byte[] dllbytes = File.ReadAllBytes(Path.Combine("C:\\", "PigDll.dll"));

                if (process == null)
                {
                    MessageBox.Show(String.Format("{0} could not be found, ensure it is running and your running launcher as admin!", friendlyName));
                }
                else
                {
                    /*
                     * var injector = InjectionMethod.Create(InjectionMethodType.Standard);
                     * var processId = process.Id;
                     * var hModule = IntPtr.Zero;
                     *
                     * using (PortableExecutable img = new PortableExecutable(dllbytes))
                     *  hModule = injector.Inject(img, processId);
                     *
                     * if (hModule != IntPtr.Zero)
                     * {
                     *  // injection was successful
                     *  MessageBox.Show("Good job");
                     * }
                     * else
                     * {
                     *  // injection failed
                     *  if (injector.GetLastError() != null)
                     *      MessageBox.Show(injector.GetLastError().Message);
                     * }
                     */

                    //InjectionMethod method = InjectionMethod.Create(InjectionMethodType.Standard); //InjectionMethodType.Standard //InjectionMethodType.ManualMap //InjectionMethodType.ThreadHijack
                    InjectionMethod injectionMethod = InjectionMethod.Create(InjectionMethodType.Standard);

                    IntPtr zero = IntPtr.Zero;
                    using (PortableExecutable executable = new PortableExecutable(dllbytes))
                    {
                        zero = injectionMethod.Inject(executable, process.Id);
                    }

                    if (zero != IntPtr.Zero)
                    {
                        MessageBox.Show(String.Format("{0} found!", friendlyName));
                    }
                    else if (injectionMethod.GetLastError() != null)
                    {
                        MessageBox.Show(injectionMethod.GetLastError().Message);
                    }
                }
            }