Visual Basic DLL注入器

时间:2019-07-31 22:14:31

标签: vb.net visual-studio dll-injection

好,所以我为CSGO开发了一个Visual Basic DLL注入器,它运行良好,但是我想在当前运行.exe时使其变得更好,它只是打开一个文件对话框来选择一个DLL,然后它自动注入到CSGO中,但我的.exe与dll位于同一文件夹中的是“ Aimlast.dll”,但我希望它佩戴它,只是将Aimlast.dll自动注入CSGO中,而不必选择它。

主表单加载代码

Private Sub Main_Load(sender As Object, e As EventArgs) Handles MyBase.Load
    OpenFileDialog1.Filter = "DLL (*.dll) |*.dll"
    OpenFileDialog1.ShowDialog()

    If IO.File.Exists(OpenFileDialog1.FileName) Then
        Dim TargetProcess As Process() = Process.GetProcessesByName("csgo")
        If TargetProcess.Length = 0 Then

            MessageBox.Show("Please Start CSGO", "Aimlast Injector")
        Else
            Call Inject()
        End If
    End If
End Sub

呼叫插入代码

Private Sub Inject()
    On Error GoTo 1
    Dim TargetProcess As Process() = Process.GetProcessesByName("csgo")
    TargetProcessHandle = OpenProcess(PROCESS_CREATE_THREAD Or PROCESS_VM_OPERATION Or PROCESS_VM_WRITE, False, TargetProcess(0).Id)
    pszLibFileRemote = OpenFileDialog1.FileName
    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, 0)
    CloseHandle(TargetProcessHandle)
1:      Me.Close()
End Sub

0 个答案:

没有答案