(İstek) Dll İnjektör Visual

Durum
Üzgünüz bu konu cevaplar için kapatılmıştır...
Üye
Katılım
8 Eki 2017
Mesajlar
20
Tepki puanı
2
Ödüller
6
Yaş
30
8 HİZMET YILI
Arkadaşlar DLL injektör yapmak istiyorum açık kaynak atabilecek varmı?
 
Uzman Üye
Katılım
6 Mar 2016
Mesajlar
187
Tepki puanı
24
Ödüller
7
10 HİZMET YILI
Kod:
using System;
using System.Diagnostics;
using System.IO;
using System.Runtime.InteropServices;
using System.Text;
 
namespace GijSoft.DllInjection
{
    public enum DllInjectionResult
    {
        DllNotFound,
        GameProcessNotFound,
        InjectionFailed,
        Success
    }
 
    public sealed class DllInjector
    {
        static readonly IntPtr INTPTR_ZERO = (IntPtr)0;
 
        [DllImport("kernel32.dll", SetLastError = true)]
        static extern IntPtr OpenProcess(uint dwDesiredAccess, int bInheritHandle, uint dwProcessId);
 
        [DllImport("kernel32.dll", SetLastError = true)]
        static extern int CloseHandle(IntPtr hObject);
 
        [DllImport("kernel32.dll", SetLastError = true)]
        static extern IntPtr GetProcAddress(IntPtr hModule, string lpProcName);
 
        [DllImport("kernel32.dll", SetLastError = true)]
        static extern IntPtr GetModuleHandle(string lpModuleName);
 
        [DllImport("kernel32.dll", SetLastError = true)]
        static extern IntPtr VirtualAllocEx(IntPtr hProcess, IntPtr lpAddress, IntPtr dwSize, uint flAllocationType, uint flProtect);
 
        [DllImport("kernel32.dll", SetLastError = true)]
        static extern int WriteProcessMemory(IntPtr hProcess, IntPtr lpBaseAddress, byte[] buffer, uint size, int lpNumberOfBytesWritten);
 
        [DllImport("kernel32.dll", SetLastError = true)]
        static extern IntPtr CreateRemoteThread(IntPtr hProcess, IntPtr lpThreadAttribute, IntPtr dwStackSize, IntPtr lpStartAddress,
            IntPtr lpParameter, uint dwCreationFlags, IntPtr lpThreadId);
 
        static DllInjector _instance;
 
        public static DllInjector GetInstance
        {
            get
            {
                if (_instance == null)
                {
                    _instance = new DllInjector();
                }
                return _instance;
            }
        }
 
        DllInjector() { }
 
        public DllInjectionResult Inject(string sProcName, string sDllPath)
        {
            if (!File.Exists(sDllPath))
            {
                return DllInjectionResult.DllNotFound;
            }
 
            uint _procId = 0;
 
            Process[] _procs = Process.GetProcesses();
            for (int i = 0; i < _procs.Length; i++)
            {
                if (_procs[i].ProcessName == sProcName)
                {
                    _procId = (uint)_procs[i].Id;
                    break;
                }
            }
 
            if (_procId == 0)
            {
                return DllInjectionResult.GameProcessNotFound;
            }
 
            if (!bInject(_procId, sDllPath))
            {
                return DllInjectionResult.InjectionFailed;
            }
 
            return DllInjectionResult.Success;
        }
 
        bool bInject(uint pToBeInjected, string sDllPath)
        {
            IntPtr hndProc = OpenProcess((0x2 | 0x8 | 0x10 | 0x20 | 0x400), 1, pToBeInjected);
 
            if (hndProc == INTPTR_ZERO)
            {
                return false;
            }
 
            IntPtr lpLLAddress = GetProcAddress(GetModuleHandle("kernel32.dll"), "LoadLibraryA");
 
            if (lpLLAddress == INTPTR_ZERO)
            {
                return false;
            }
 
            IntPtr lpAddress = VirtualAllocEx(hndProc, (IntPtr)null, (IntPtr)sDllPath.Length, (0x1000 | 0x2000), 0X40);
 
            if (lpAddress == INTPTR_ZERO)
            {
                return false;
            }
 
            byte[] bytes = Encoding.ASCII.GetBytes(sDllPath);
 
            if (WriteProcessMemory(hndProc, lpAddress, bytes, (uint)bytes.Length, 0) == 0)
            {
                return false;
            }
 
            if (CreateRemoteThread(hndProc, (IntPtr)null, INTPTR_ZERO, lpLLAddress, lpAddress, 0, (IntPtr)null) == INTPTR_ZERO)
            {
                return false;
            }
 
            CloseHandle(hndProc);
 
            return true;
        }
    }
}
 
Uzman Üye
Katılım
6 Eyl 2018
Mesajlar
244
Tepki puanı
30
Ödüller
7
7 HİZMET YILI
Kod:
using System;
using System.Diagnostics;
using System.IO;
using System.Runtime.InteropServices;
using System.Text;

namespace GijSoft.DllInjection
{
    public enum DllInjectionResult
    {
        DllNotFound,
        GameProcessNotFound,
        InjectionFailed,
        Success
    }

    public sealed class DllInjector
    {
        static readonly IntPtr INTPTR_ZERO = (IntPtr)0;

        [DllImport("kernel32.dll", SetLastError = true)]
        static extern IntPtr OpenProcess(uint dwDesiredAccess, int bInheritHandle, uint dwProcessId);

        [DllImport("kernel32.dll", SetLastError = true)]
        static extern int CloseHandle(IntPtr hObject);

        [DllImport("kernel32.dll", SetLastError = true)]
        static extern IntPtr GetProcAddress(IntPtr hModule, string lpProcName);

        [DllImport("kernel32.dll", SetLastError = true)]
        static extern IntPtr GetModuleHandle(string lpModuleName);

        [DllImport("kernel32.dll", SetLastError = true)]
        static extern IntPtr VirtualAllocEx(IntPtr hProcess, IntPtr lpAddress, IntPtr dwSize, uint flAllocationType, uint flProtect);

        [DllImport("kernel32.dll", SetLastError = true)]
        static extern int WriteProcessMemory(IntPtr hProcess, IntPtr lpBaseAddress, byte[] buffer, uint size, int lpNumberOfBytesWritten);

        [DllImport("kernel32.dll", SetLastError = true)]
        static extern IntPtr CreateRemoteThread(IntPtr hProcess, IntPtr lpThreadAttribute, IntPtr dwStackSize, IntPtr lpStartAddress,
            IntPtr lpParameter, uint dwCreationFlags, IntPtr lpThreadId);

        static DllInjector _instance;

        public static DllInjector GetInstance
        {
            get
            {
                if (_instance == null)
                {
                    _instance = new DllInjector();
                }
                return _instance;
            }
        }

        DllInjector() { }

        public DllInjectionResult Inject(string sProcName, string sDllPath)
        {
            if (!File.Exists(sDllPath))
            {
                return DllInjectionResult.DllNotFound;
            }

            uint _procId = 0;

            Process[] _procs = Process.GetProcesses();
            for (int i = 0; i < _procs.Length; i++)
            {
                if (_procs[i].ProcessName == sProcName)
                {
                    _procId = (uint)_procs[i].Id;
                    break;
                }
            }

            if (_procId == 0)
            {
                return DllInjectionResult.GameProcessNotFound;
            }

            if (!bInject(_procId, sDllPath))
            {
                return DllInjectionResult.InjectionFailed;
            }

            return DllInjectionResult.Success;
        }

        bool bInject(uint pToBeInjected, string sDllPath)
        {
            IntPtr hndProc = OpenProcess((0x2 | 0x8 | 0x10 | 0x20 | 0x400), 1, pToBeInjected);

            if (hndProc == INTPTR_ZERO)
            {
                return false;
            }

            IntPtr lpLLAddress = GetProcAddress(GetModuleHandle("kernel32.dll"), "LoadLibraryA");

            if (lpLLAddress == INTPTR_ZERO)
            {
                return false;
            }

            IntPtr lpAddress = VirtualAllocEx(hndProc, (IntPtr)null, (IntPtr)sDllPath.Length, (0x1000 | 0x2000), 0X40);

            if (lpAddress == INTPTR_ZERO)
            {
                return false;
            }

            byte[] bytes = Encoding.ASCII.GetBytes(sDllPath);

            if (WriteProcessMemory(hndProc, lpAddress, bytes, (uint)bytes.Length, 0) == 0)
            {
                return false;
            }

            if (CreateRemoteThread(hndProc, (IntPtr)null, INTPTR_ZERO, lpLLAddress, lpAddress, 0, (IntPtr)null) == INTPTR_ZERO)
            {
                return false;
            }

            CloseHandle(hndProc);

            return true;
        }
    }
}
bu ne yani
 
Onaylı Üye
Katılım
6 Ağu 2016
Mesajlar
107
Tepki puanı
12
Ödüller
9
Yaş
27
9 HİZMET YILI
Kod:
--------------------------------------------------
MEMORYHACKERS  DLL INJECT
------------------------------------------------
'''''Imports Bölümüne yazılacak kod
Imports System.Threading

''''Class Bölümüne yazılacak kod
Private TargetProcessHandle As Integer
    Private pfnStartAddr As Integer
    Private pszLibFileRemote As String
    Private TargetBufferSize As Integer
    Public Const PROCESS_VM_READ = &H10
    Public Const TH32CS_SNAPPROCESS = &H2
    Public Const MEM_COMMIT = 4096
    Public Const PAGE_READWRITE = 4
    Public Const PROCESS_CREATE_THREAD = (&H2)
    Public Const PROCESS_VM_OPERATION = (&H8)
    Public Const PROCESS_VM_WRITE = (&H20)
    Public Declare Function ReadProcessMemory Lib "kernel32" ( _
    ByVal hProcess As Integer, _
    ByVal lpBaseAddress As Integer, _
    ByVal lpBuffer As String, _
    ByVal nSize As Integer, _
    ByRef lpNumberOfBytesWritten As Integer) As Integer
    Public Declare Function LoadLibrary Lib "kernel32" Alias "LoadLibraryA" ( _
    ByVal lpLibFileName As String) As Integer
    Public Declare Function VirtualAllocEx Lib "kernel32" ( _
    ByVal hProcess As Integer, _
    ByVal lpAddress As Integer, _
    ByVal dwSize As Integer, _
    ByVal flAllocationType As Integer, _
    ByVal flProtect As Integer) As Integer
    Public Declare Function WriteProcessMemory Lib "kernel32" ( _
    ByVal hProcess As Integer, _
    ByVal lpBaseAddress As Integer, _
    ByVal lpBuffer As String, _
    ByVal nSize As Integer, _
    ByRef lpNumberOfBytesWritten As Integer) As Integer
    Public Declare Function GetProcAddress Lib "kernel32" ( _
    ByVal hModule As Integer, ByVal lpProcName As String) As Integer
    Private Declare Function GetModuleHandle Lib "Kernel32" Alias "GetModuleHandleA" ( _
    ByVal lpModuleName As String) As Integer
    Public Declare Function CreateRemoteThread Lib "kernel32" ( _
    ByVal hProcess As Integer, _
    ByVal lpThreadAttributes As Integer, _
    ByVal dwStackSize As Integer, _
    ByVal lpStartAddress As Integer, _
    ByVal lpParameter As Integer, _
    ByVal dwCreationFlags As Integer, _
    ByRef lpThreadId As IntPtr) As Integer
    Public Declare Function OpenProcess Lib "kernel32" ( _
    ByVal dwDesiredAccess As Integer, _
    ByVal bInheritHandle As Integer, _
    ByVal dwProcessId As Integer) As Integer
    Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" ( _
    ByVal lpClassName As String, _
    ByVal lpWindowName As String) As Integer
    Private Declare Function CloseHandle Lib "kernel32" Alias "CloseHandleA" ( _
    ByVal hObject As Integer) As Integer
    Dim ExeName As String = IO.Path.GetFileNameWithoutExtension(Application.ExecutablePath)
    Dim SCurrentDll As String
    Dim objMutex As Mutex

    Private Sub Inject()
        On Error GoTo 1
        InjectTimer.Stop()
        'Inject Dll
        Dim TargetProcess As Process() = Process.GetProcessesByName(ProcessTextBox.Text)
        Dim lpThreadId As IntPtr
        TargetProcessHandle = OpenProcess(&H1F0FFF, 0, TargetProcess(0).Id)
        Dim FileDll = SCurrentDll
        pszLibFileRemote = (FileDll)
        pfnStartAddr = GetProcAddress(GetModuleHandle("Kernel32"), "LoadLibraryA")
        TargetBufferSize = 1 + Len(pszLibFileRemote)
        Dim Rtn As Integer
        Dim LoadLibParamAdr As Integer
        LoadLibParamAdr = VirtualAllocEx(TargetProcessHandle, 0, TargetBufferSize, MEM_COMMIT, PAGE_READWRITE)
        Rtn = WriteProcessMemory(TargetProcessHandle, LoadLibParamAdr, pszLibFileRemote, TargetBufferSize, 0)
        CreateRemoteThread(TargetProcessHandle, 0, 0, pfnStartAddr, LoadLibParamAdr, 0, lpThreadId)
1:      Me.Show()
    End Sub

''''''''FormLoad Bölümüne yazılacak kod
        objMutex = New Mutex(False, "ST70R")
        If objMutex.WaitOne(0, False) = False Then
            objMutex.Close()
            objMutex = Nothing
            MessageBox.Show("Error !!")
            End
        End If


'''''''InjectTimer Bölümüne yazılacak kod
    If IO.File.Exists(OpenFileDialog1.FileName) Then
            Dim TargetProcess As Process() = Process.GetProcessesByName(ProcessTextBox.Text)
            If TargetProcess.Length = 0 Then
        StatusLabel.ForeColor = Color.Red
                StatusLabel.Text = ("Waiting for " + ProcessTextBox.Text + ".exe")
            Else
                InjectTimer.Stop()
                DelayTimer.Start()
            End If
        Else
        End If

''''''DelayTimer Bölümüne Yazılacak kod
    If DelayNumeric.Value = 0 Then
            DelayTimer.Enabled = False
        StatusLabel.ForeColor = Color.Lime
            StatusLabel.Text = "Successfully Injected!"
            For i = 0 To (DllListBox.Items.Count + -1)
                SCurrentDll = DllListBox.Items(i)
                Call Inject()
                If CloseCheckBox.Checked = True Then

                    End
                Else
                End If
            Next i
        Else
            DelayNumeric.Value = DelayNumeric.Value - 1
        End If

'''''''InjectButton Bölümüne Yazılacak kod
     If IO.File.Exists(OpenFileDialog1.FileName) Then
            Dim TargetProcess As Process() = Process.GetProcessesByName(ProcessTextBox.Text)
            If TargetProcess.Length = 0 Then
        StatusLabel.ForeColor = Color.Red
                StatusLabel.Text = ("Waiting for " + ProcessTextBox.Text + ".exe")
            Else
                InjectTimer.Stop()
                DelayTimer.Start()
            End If
        Else
        End If

''''''BrowseButton Bölümüne Yazılacak kod
     OpenFileDialog1.Filter = "DLL (*.dll) |*.dll"
        OpenFileDialog1.ShowDialog()

''''''RemoveButton Bölümüne Yazılacak kod
    For i As Integer = (DllListBox.SelectedItems.Count - 1) To 0 Step -1
            DllListBox.Items.Remove(DllListBox.SelectedItems(i))
    Next

''''''ClearAllButton Bölümüne Yazılacak kod
    DllListBox.Items.Clear()

''''''OpenFileDialog Bölümüne Yazılacak kod
    Dim FileName As String
        FileName = OpenFileDialog1.FileName.Substring(OpenFileDialog1.FileName.LastIndexOf("\"))
        Dim DllFileName As String = FileName.Replace("\", "")
        DllListBox.Items.Add(DllFileName)

''''''AutoRadioButton Bölümüne Yazılacak kod
    InjectButton.Enabled = False
        InjectTimer.Enabled = True

''''''ManualRadioButton Bölümüne Yazılacak kod
    InjectButton.Enabled = True
        InjectTimer.Enabled = False

Visual studio da yapabilirsin bu kodlarla :)
 
Uzman Üye
Katılım
6 Eyl 2018
Mesajlar
244
Tepki puanı
30
Ödüller
7
7 HİZMET YILI
Kod:
--------------------------------------------------
MEMORYHACKERS  DLL INJECT
------------------------------------------------
'''''Imports Bölümüne yazılacak kod
Imports System.Threading

''''Class Bölümüne yazılacak kod
Private TargetProcessHandle As Integer
    Private pfnStartAddr As Integer
    Private pszLibFileRemote As String
    Private TargetBufferSize As Integer
    Public Const PROCESS_VM_READ = &H10
    Public Const TH32CS_SNAPPROCESS = &H2
    Public Const MEM_COMMIT = 4096
    Public Const PAGE_READWRITE = 4
    Public Const PROCESS_CREATE_THREAD = (&H2)
    Public Const PROCESS_VM_OPERATION = (&H8)
    Public Const PROCESS_VM_WRITE = (&H20)
    Public Declare Function ReadProcessMemory Lib "kernel32" ( _
    ByVal hProcess As Integer, _
    ByVal lpBaseAddress As Integer, _
    ByVal lpBuffer As String, _
    ByVal nSize As Integer, _
    ByRef lpNumberOfBytesWritten As Integer) As Integer
    Public Declare Function LoadLibrary Lib "kernel32" Alias "LoadLibraryA" ( _
    ByVal lpLibFileName As String) As Integer
    Public Declare Function VirtualAllocEx Lib "kernel32" ( _
    ByVal hProcess As Integer, _
    ByVal lpAddress As Integer, _
    ByVal dwSize As Integer, _
    ByVal flAllocationType As Integer, _
    ByVal flProtect As Integer) As Integer
    Public Declare Function WriteProcessMemory Lib "kernel32" ( _
    ByVal hProcess As Integer, _
    ByVal lpBaseAddress As Integer, _
    ByVal lpBuffer As String, _
    ByVal nSize As Integer, _
    ByRef lpNumberOfBytesWritten As Integer) As Integer
    Public Declare Function GetProcAddress Lib "kernel32" ( _
    ByVal hModule As Integer, ByVal lpProcName As String) As Integer
    Private Declare Function GetModuleHandle Lib "Kernel32" Alias "GetModuleHandleA" ( _
    ByVal lpModuleName As String) As Integer
    Public Declare Function CreateRemoteThread Lib "kernel32" ( _
    ByVal hProcess As Integer, _
    ByVal lpThreadAttributes As Integer, _
    ByVal dwStackSize As Integer, _
    ByVal lpStartAddress As Integer, _
    ByVal lpParameter As Integer, _
    ByVal dwCreationFlags As Integer, _
    ByRef lpThreadId As IntPtr) As Integer
    Public Declare Function OpenProcess Lib "kernel32" ( _
    ByVal dwDesiredAccess As Integer, _
    ByVal bInheritHandle As Integer, _
    ByVal dwProcessId As Integer) As Integer
    Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" ( _
    ByVal lpClassName As String, _
    ByVal lpWindowName As String) As Integer
    Private Declare Function CloseHandle Lib "kernel32" Alias "CloseHandleA" ( _
    ByVal hObject As Integer) As Integer
    Dim ExeName As String = IO.Path.GetFileNameWithoutExtension(Application.ExecutablePath)
    Dim SCurrentDll As String
    Dim objMutex As Mutex

    Private Sub Inject()
        On Error GoTo 1
        InjectTimer.Stop()
        'Inject Dll
        Dim TargetProcess As Process() = Process.GetProcessesByName(ProcessTextBox.Text)
        Dim lpThreadId As IntPtr
        TargetProcessHandle = OpenProcess(&H1F0FFF, 0, TargetProcess(0).Id)
        Dim FileDll = SCurrentDll
        pszLibFileRemote = (FileDll)
        pfnStartAddr = GetProcAddress(GetModuleHandle("Kernel32"), "LoadLibraryA")
        TargetBufferSize = 1 + Len(pszLibFileRemote)
        Dim Rtn As Integer
        Dim LoadLibParamAdr As Integer
        LoadLibParamAdr = VirtualAllocEx(TargetProcessHandle, 0, TargetBufferSize, MEM_COMMIT, PAGE_READWRITE)
        Rtn = WriteProcessMemory(TargetProcessHandle, LoadLibParamAdr, pszLibFileRemote, TargetBufferSize, 0)
        CreateRemoteThread(TargetProcessHandle, 0, 0, pfnStartAddr, LoadLibParamAdr, 0, lpThreadId)
1:      Me.Show()
    End Sub

''''''''FormLoad Bölümüne yazılacak kod
        objMutex = New Mutex(False, "ST70R")
        If objMutex.WaitOne(0, False) = False Then
            objMutex.Close()
            objMutex = Nothing
            MessageBox.Show("Error !!")
            End
        End If


'''''''InjectTimer Bölümüne yazılacak kod
    If IO.File.Exists(OpenFileDialog1.FileName) Then
            Dim TargetProcess As Process() = Process.GetProcessesByName(ProcessTextBox.Text)
            If TargetProcess.Length = 0 Then
        StatusLabel.ForeColor = Color.Red
                StatusLabel.Text = ("Waiting for " + ProcessTextBox.Text + ".exe")
            Else
                InjectTimer.Stop()
                DelayTimer.Start()
            End If
        Else
        End If

''''''DelayTimer Bölümüne Yazılacak kod
    If DelayNumeric.Value = 0 Then
            DelayTimer.Enabled = False
        StatusLabel.ForeColor = Color.Lime
            StatusLabel.Text = "Successfully Injected!"
            For i = 0 To (DllListBox.Items.Count + -1)
                SCurrentDll = DllListBox.Items(i)
                Call Inject()
                If CloseCheckBox.Checked = True Then

                    End
                Else
                End If
            Next i
        Else
            DelayNumeric.Value = DelayNumeric.Value - 1
        End If

'''''''InjectButton Bölümüne Yazılacak kod
     If IO.File.Exists(OpenFileDialog1.FileName) Then
            Dim TargetProcess As Process() = Process.GetProcessesByName(ProcessTextBox.Text)
            If TargetProcess.Length = 0 Then
        StatusLabel.ForeColor = Color.Red
                StatusLabel.Text = ("Waiting for " + ProcessTextBox.Text + ".exe")
            Else
                InjectTimer.Stop()
                DelayTimer.Start()
            End If
        Else
        End If

''''''BrowseButton Bölümüne Yazılacak kod
     OpenFileDialog1.Filter = "DLL (*.dll) |*.dll"
        OpenFileDialog1.ShowDialog()

''''''RemoveButton Bölümüne Yazılacak kod
    For i As Integer = (DllListBox.SelectedItems.Count - 1) To 0 Step -1
            DllListBox.Items.Remove(DllListBox.SelectedItems(i))
    Next

''''''ClearAllButton Bölümüne Yazılacak kod
    DllListBox.Items.Clear()

''''''OpenFileDialog Bölümüne Yazılacak kod
    Dim FileName As String
        FileName = OpenFileDialog1.FileName.Substring(OpenFileDialog1.FileName.LastIndexOf("\"))
        Dim DllFileName As String = FileName.Replace("\", "")
        DllListBox.Items.Add(DllFileName)

''''''AutoRadioButton Bölümüne Yazılacak kod
    InjectButton.Enabled = False
        InjectTimer.Enabled = True

''''''ManualRadioButton Bölümüne Yazılacak kod
    InjectButton.Enabled = True
        InjectTimer.Enabled = False

Visual studio da yapabilirsin bu kodlarla :)
mesela wolfteamda dll li hile nasıl yapılır
 
Ultra Üye
Katılım
24 Ara 2017
Mesajlar
1,512
Çözümler
8
Tepki puanı
189
Ödüller
9
8 HİZMET YILI
Googleda Visual Studio kodlama yazılım dili diye aratırsan bulabilrisin
 
Onaylı Üye
Katılım
28 Ağu 2018
Mesajlar
83
Tepki puanı
13
Yaş
34
7 HİZMET YILI
Kod:
--------------------------------------------------
MEMORYHACKERS  DLL INJECT
------------------------------------------------
'''''Imports Bölümüne yazılacak kod
Imports System.Threading

''''Class Bölümüne yazılacak kod
Private TargetProcessHandle As Integer
    Private pfnStartAddr As Integer
    Private pszLibFileRemote As String
    Private TargetBufferSize As Integer
    Public Const PROCESS_VM_READ = &H10
    Public Const TH32CS_SNAPPROCESS = &H2
    Public Const MEM_COMMIT = 4096
    Public Const PAGE_READWRITE = 4
    Public Const PROCESS_CREATE_THREAD = (&H2)
    Public Const PROCESS_VM_OPERATION = (&H8)
    Public Const PROCESS_VM_WRITE = (&H20)
    Public Declare Function ReadProcessMemory Lib "kernel32" ( _
    ByVal hProcess As Integer, _
    ByVal lpBaseAddress As Integer, _
    ByVal lpBuffer As String, _
    ByVal nSize As Integer, _
    ByRef lpNumberOfBytesWritten As Integer) As Integer
    Public Declare Function LoadLibrary Lib "kernel32" Alias "LoadLibraryA" ( _
    ByVal lpLibFileName As String) As Integer
    Public Declare Function VirtualAllocEx Lib "kernel32" ( _
    ByVal hProcess As Integer, _
    ByVal lpAddress As Integer, _
    ByVal dwSize As Integer, _
    ByVal flAllocationType As Integer, _
    ByVal flProtect As Integer) As Integer
    Public Declare Function WriteProcessMemory Lib "kernel32" ( _
    ByVal hProcess As Integer, _
    ByVal lpBaseAddress As Integer, _
    ByVal lpBuffer As String, _
    ByVal nSize As Integer, _
    ByRef lpNumberOfBytesWritten As Integer) As Integer
    Public Declare Function GetProcAddress Lib "kernel32" ( _
    ByVal hModule As Integer, ByVal lpProcName As String) As Integer
    Private Declare Function GetModuleHandle Lib "Kernel32" Alias "GetModuleHandleA" ( _
    ByVal lpModuleName As String) As Integer
    Public Declare Function CreateRemoteThread Lib "kernel32" ( _
    ByVal hProcess As Integer, _
    ByVal lpThreadAttributes As Integer, _
    ByVal dwStackSize As Integer, _
    ByVal lpStartAddress As Integer, _
    ByVal lpParameter As Integer, _
    ByVal dwCreationFlags As Integer, _
    ByRef lpThreadId As IntPtr) As Integer
    Public Declare Function OpenProcess Lib "kernel32" ( _
    ByVal dwDesiredAccess As Integer, _
    ByVal bInheritHandle As Integer, _
    ByVal dwProcessId As Integer) As Integer
    Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" ( _
    ByVal lpClassName As String, _
    ByVal lpWindowName As String) As Integer
    Private Declare Function CloseHandle Lib "kernel32" Alias "CloseHandleA" ( _
    ByVal hObject As Integer) As Integer
    Dim ExeName As String = IO.Path.GetFileNameWithoutExtension(Application.ExecutablePath)
    Dim SCurrentDll As String
    Dim objMutex As Mutex

    Private Sub Inject()
        On Error GoTo 1
        InjectTimer.Stop()
        'Inject Dll
        Dim TargetProcess As Process() = Process.GetProcessesByName(ProcessTextBox.Text)
        Dim lpThreadId As IntPtr
        TargetProcessHandle = OpenProcess(&H1F0FFF, 0, TargetProcess(0).Id)
        Dim FileDll = SCurrentDll
        pszLibFileRemote = (FileDll)
        pfnStartAddr = GetProcAddress(GetModuleHandle("Kernel32"), "LoadLibraryA")
        TargetBufferSize = 1 + Len(pszLibFileRemote)
        Dim Rtn As Integer
        Dim LoadLibParamAdr As Integer
        LoadLibParamAdr = VirtualAllocEx(TargetProcessHandle, 0, TargetBufferSize, MEM_COMMIT, PAGE_READWRITE)
        Rtn = WriteProcessMemory(TargetProcessHandle, LoadLibParamAdr, pszLibFileRemote, TargetBufferSize, 0)
        CreateRemoteThread(TargetProcessHandle, 0, 0, pfnStartAddr, LoadLibParamAdr, 0, lpThreadId)
1:      Me.Show()
    End Sub

''''''''FormLoad Bölümüne yazılacak kod
        objMutex = New Mutex(False, "ST70R")
        If objMutex.WaitOne(0, False) = False Then
            objMutex.Close()
            objMutex = Nothing
            MessageBox.Show("Error !!")
            End
        End If


'''''''InjectTimer Bölümüne yazılacak kod
    If IO.File.Exists(OpenFileDialog1.FileName) Then
            Dim TargetProcess As Process() = Process.GetProcessesByName(ProcessTextBox.Text)
            If TargetProcess.Length = 0 Then
        StatusLabel.ForeColor = Color.Red
                StatusLabel.Text = ("Waiting for " + ProcessTextBox.Text + ".exe")
            Else
                InjectTimer.Stop()
                DelayTimer.Start()
            End If
        Else
        End If

''''''DelayTimer Bölümüne Yazılacak kod
    If DelayNumeric.Value = 0 Then
            DelayTimer.Enabled = False
        StatusLabel.ForeColor = Color.Lime
            StatusLabel.Text = "Successfully Injected!"
            For i = 0 To (DllListBox.Items.Count + -1)
                SCurrentDll = DllListBox.Items(i)
                Call Inject()
                If CloseCheckBox.Checked = True Then

                    End
                Else
                End If
            Next i
        Else
            DelayNumeric.Value = DelayNumeric.Value - 1
        End If

'''''''InjectButton Bölümüne Yazılacak kod
     If IO.File.Exists(OpenFileDialog1.FileName) Then
            Dim TargetProcess As Process() = Process.GetProcessesByName(ProcessTextBox.Text)
            If TargetProcess.Length = 0 Then
        StatusLabel.ForeColor = Color.Red
                StatusLabel.Text = ("Waiting for " + ProcessTextBox.Text + ".exe")
            Else
                InjectTimer.Stop()
                DelayTimer.Start()
            End If
        Else
        End If

''''''BrowseButton Bölümüne Yazılacak kod
     OpenFileDialog1.Filter = "DLL (*.dll) |*.dll"
        OpenFileDialog1.ShowDialog()

''''''RemoveButton Bölümüne Yazılacak kod
    For i As Integer = (DllListBox.SelectedItems.Count - 1) To 0 Step -1
            DllListBox.Items.Remove(DllListBox.SelectedItems(i))
    Next

''''''ClearAllButton Bölümüne Yazılacak kod
    DllListBox.Items.Clear()

''''''OpenFileDialog Bölümüne Yazılacak kod
    Dim FileName As String
        FileName = OpenFileDialog1.FileName.Substring(OpenFileDialog1.FileName.LastIndexOf("\"))
        Dim DllFileName As String = FileName.Replace("\", "")
        DllListBox.Items.Add(DllFileName)

''''''AutoRadioButton Bölümüne Yazılacak kod
    InjectButton.Enabled = False
        InjectTimer.Enabled = True

''''''ManualRadioButton Bölümüne Yazılacak kod
    InjectButton.Enabled = True
        InjectTimer.Enabled = False

Visual studio da yapabilirsin bu kodlarla :)
Teşekkürler İşime Yaradı Gibi
 
Onaylı Üye
Katılım
11 Ocak 2019
Mesajlar
73
Tepki puanı
11
Ödüller
6
7 HİZMET YILI
Paat diye ben injecktor yapıcam diyip hazır kodlamayı tavsiye etmiyorum , bence en baştan temel konular ile başlanmalı ve ileri sürecte bunları kendin öğreniceksin dir.
 
Ultra Üye
Katılım
23 Ağu 2018
Mesajlar
1,502
Çözümler
5
Tepki puanı
174
Ödüller
10
7 HİZMET YILI
Arkadaşlar Adam : VB.NET Demiş C# Kodları göndermeyi bırakın!
 
Durum
Üzgünüz bu konu cevaplar için kapatılmıştır...
Üst