Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Region "Guidelines & Agreements"
- ' This Source is Developed & Maintained by Innovators World Wide
- ' It is intended for use my the members of MPGH
- ' however, this agreement must remain in the source, and credits
- ' to both Innovators World Wide & MPGH
- ' This is offered as open source to be edited & added to
- ' however again, this original statement must be left here.
- ' If you contribute anything to this source code, please
- ' add a comment with your name and what it is you added,
- ' then submit it to the thread on MPGH.net which this is originally posted.
- #End Region
- #Region "NameSpace_Imports"
- Imports System.Collections.Generic
- Imports System.Text
- Imports System.Runtime.InteropServices
- Imports System.Diagnostics
- Imports System.ComponentModel
- Imports System.Data
- Imports System.Drawing
- Imports System.Windows.Forms
- Imports System.Threading
- #End Region
- #Region "AIOSDK"
- Public Class AIOSDK
- #Region "<DllImports-Notes"
- ' Add any needed notes here.
- #End Region
- #Region "Injector_<DllImports_API_P/nvoke (API PACK)"
- <DllImport("User32.dll")> _
- Public Shared Function MessageBox(ByVal h As Integer, ByVal m As String, ByVal c As String, ByVal type As Integer) As Integer
- End Function
- <DllImport("kernel32.dll")> _
- Public Shared Function OpenProcess(ByVal dwDesiredAccess As Integer, ByVal bInheritHandle As Integer, ByVal dwProcessId As Integer) As Integer
- End Function
- <DllImport("kernel32.dll")> _
- Public Shared Function VirtualAllocEx(ByVal hProcess As Integer, ByVal lpAddress As Integer, ByVal dwSize As Integer, ByVal flAllocationType As Integer, ByVal flProtect As Integer) As Integer
- End Function
- <DllImport("kernel32.dll")> _
- Public Shared Function WriteProcessMemory(ByVal hProcess As Integer, ByVal lpBaseAddress As Integer, ByVal lpBuffer As Byte(), ByVal nSize As Integer, ByRef lpNumberOfBytesWritten As UInteger) As Boolean
- End Function
- <DllImport("kernel32.dll")> _
- Public Shared Function GetProcAddress(ByVal hModule As Integer, ByVal lpProcName As String) As Integer
- End Function
- <DllImport("kernel32.dll")> _
- Public Shared Function CreateRemoteThread(ByVal hProcess As Integer, ByVal lpThreadAttributes As Integer, ByVal dwStackSize As Integer, ByVal lpStartAddress As Integer, ByVal lpParameter As Integer, ByVal dwCreationFlags As Integer, _
- ByVal lpThreadId As Integer) As Integer
- End Function
- <DllImport("kernel32.dll")> _
- Public Shared Function WaitForSingleObject(ByVal hHandle As Integer, ByVal dwMilliseconds As Integer) As Integer
- End Function
- <DllImport("kernel32.dll")> _
- Public Shared Function CloseHandle(ByVal hObject As Integer) As Integer
- End Function
- <DllImport("User32.dll")> _
- Public Shared Function FindWindow(ByVal lpClassName As String, ByVal lpWindowName As String) As Integer
- End Function
- <DllImport("User32.dll")> _
- Public Shared Function GetWindowThreaProcessId(ByVal hWnd As Integer, ByRef lpdwProcessId As Integer) As Integer
- End Function
- <DllImport("kernel32")> _
- Public Shared Function CreateRemoteThread(ByVal hProcess As IntPtr, ByVal lpThreadAttributes As IntPtr, ByVal dwStackSize As UInteger, ByVal lpStartAddress As UIntPtr, ByVal lpParameter As IntPtr, ByVal dwCreationFlags As UInteger, _
- ByRef lpThreadId As IntPtr) As IntPtr
- End Function
- <DllImport("kernel32.dll")> _
- Public Shared Function OpenProcess(ByVal dwDesiredAccess As UInt32, ByVal bInheritHandle As Int32, ByVal dwProcessId As Int32) As IntPtr
- End Function
- <DllImport("kernel32.dll")> _
- Public Shared Function CloseHandle(ByVal hObject As IntPtr) As Int32
- End Function
- Private Declare Auto Function VirtualFreeEx Lib "kernel32.dll" (ByVal hProcess As IntPtr, ByVal lpAddress As IntPtr, ByVal dwSize As UIntPtr, ByVal dwFreeType As UInteger) As Boolean
- Private Declare Auto Function VirtualAllocEx Lib "kernel32.dll" (ByVal hProcess As IntPtr, ByVal lpAddress As IntPtr, ByVal dwSize As UInteger, ByVal flAllocationType As UInteger, ByVal flProtect As UInteger) As IntPtr
- <DllImport("kernel32.dll")> _
- Private Shared Function WriteProcessMemory(ByVal hProcess As IntPtr, ByVal lpBaseAddress As IntPtr, ByVal lpBuffer As String, ByVal nSize As UIntPtr, ByRef lpNumberOfBytesWritten As IntPtr) As Boolean
- End Function
- <DllImport("kernel32.dll", CharSet:=CharSet.Auto, SetLastError:=True)> _
- Public Shared Function GetModuleHandle(ByVal lpModuleName As String) As IntPtr
- End Function
- #End Region
- #Region "Injector Source"
- '''<remarks>Written By Jason Of Mpgh.net</remarks>
- Public Shared Function GetPID(ByVal procName As String) As Integer
- Dim output As Integer
- Dim p As Process() = Process.GetProcessesByName(procName.Replace(".exe", ""))
- If p.Length > 0 Then
- output = Integer.Parse(p(0).Id)
- Else
- output = -1
- End If
- Return output
- End Function
- '''<remarks>Ends Jasons Code </remarks>
- Public Shared Function Inject(ByVal ProcessID As Integer, ByVal DLLPath As String) As [Boolean]
- Dim Proc As Integer
- Dim Addr As Integer
- Dim i As Integer
- Proc = OpenProcess(&H1F0FFF, 1, ProcessID)
- Addr = VirtualAllocEx(Proc, 0, DLLPath.Length, &H1000, &H4)
- If Addr > 0 Then
- Dim ByteP As Byte() = New Byte(DLLPath.Length - 1) {}
- For i = 0 To DLLPath.Length - 1
- Dim tmp1 As String = DLLPath.Substring(i, 1)
- Dim tmp2 As Char = Convert.ToChar(tmp1)
- Dim tmp3 As Integer = Convert.ToInt32(tmp2)
- ByteP(i) = Convert.ToByte(tmp3)
- Next
- Dim Fwrite As UInteger
- WriteProcessMemory(Proc, Addr, ByteP, DLLPath.Length, Fwrite)
- Dim ALLtmp As Integer
- Dim GetMH As Integer
- ALLtmp = GetProcAddress(GetModuleHandle("kernel32.dll"), "LoadLibraryA")
- GetMH = CreateRemoteThread(Proc, 0, 0, ALLtmp, Addr, 0, _
- 0)
- If GetMH > 0 Then
- WaitForSingleObject(GetMH, 20000)
- CloseHandle(GetMH)
- Return True
- Else
- Return False
- End If
- Else
- Return False
- End If
- End Function
- #End Region
- End Class
- #End Region
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement