[Discussion]Injection Code

Posts 1–13 of 13 · Page 1 of 1
[Discussion]Injection Code
Hmm.
I recently discovered this injector code which samueldo/ryan showed me, and its pretty awesome.

Its unlimited dll injection, uses a module and simply uses Inject(Process, DLLPath) when you want to inject.

Thats only for injection, you still gotta do your timer crap.

But pretty cool

Should i release this?
Or should i not?
I'm just worried about leechers spamming the sh** with new injectors with this code.
/discuss
You can build that Inject(process, dllpath) easily, with every injection code...

But go ahead, you shouldn't make a topic asking, release it.
Quote Originally Posted by Blubb1337 View Post
You can build that Inject(process, dllpath) easily, with every injection code...

But go ahead, you shouldn't make a topic about asking, just go ahead and release it.
Lol I was going to say that, add two (ByVal yadda yadda) to any injection code and you can call it with

Inject("Process", "Path) simple as .
Just because you nerds think its simple..
Those tryhards don't lol =P

Just because you nerds think its simple..
Those tryhards don't lol =P

Oh and i'll let you be the judge.

[php]Imports System.Runtime.InteropServices
Imports System.Text

Module ModInject

Private Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Integer, ByVal bInheritHandle As Integer, ByVal dwProcessId As Integer) As Integer
Private 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
Private Declare Function WriteProcessMemory Lib "kernel32" (ByVal hProcess As Integer, ByVal lpBaseAddress As Integer, ByVal lpBuffer() As Byte, ByVal nSize As Integer, ByVal lpNumberOfBytesWritten As UInteger) As Boolean
Private 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
Private 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, ByVal lpThreadId As Integer) As Integer
Private Declare Function WaitForSingleObject Lib "kernel32" (ByVal hHandle As Integer, ByVal dwMilliseconds As Integer) As Integer
Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Integer) As Integer
Public Function inject(ByVal ProcessID As Long, ByVal DLLPath As String) As Boolean
On Error GoTo exiterror
Dim DProc As Integer
Dim DAdd As Integer
Dim DWrote As UInteger
Dim DAll As Integer
Dim DThe As Integer
Dim DMHD As Integer
DProc = OpenProcess(&H1F0FFF, 1, ProcessID)
DAdd = VirtualAllocEx(DProc, 0, DLLPath.Length, &H1000, &H4)
If (DAdd > 0) Then
Dim DByte() As Byte
DByte = StrChar(DLLPath)
WriteProcessMemory(DProc, DAdd, DByte, DLLPath.Length, DWrote)
DMHD = GetModuleHandle("kernel32.dll")
DAll = GetProcAddress(DMHD, "LoadLibraryA")
DThe = CreateRemoteThread(DProc, 0, 0, DAll, DAdd, 0, 0)
If (DThe > 0) Then
WaitForSingleObject(DThe, &HFFFF)
CloseHandle(DThe)
Return True
Else
GoTo exiterror
End If
Else
GoTo exiterror
End If
inject = True
Exit Function
exiterror:
inject = False
End Function
Private Function StrChar(ByRef strString As String) As Byte()
Dim bytTemp() As Byte
Dim i As Short
ReDim bytTemp(0)
For i = 1 To Len(strString)
If bytTemp(UBound(bytTemp)) <> 0 Then ReDim Preserve bytTemp(UBound(bytTemp) + 1)
bytTemp(UBound(bytTemp)) = Asc(Mid(strString, i, 1))
Next i
ReDim Preserve bytTemp(UBound(bytTemp) + 1)
bytTemp(UBound(bytTemp)) = 0
StrChar = bytTemp
End Function
End Module
[/php]
Quote Originally Posted by Invidus View Post
Just because you nerds think its simple..
Those tryhards don't lol =P


Just because you nerds think its simple..
Those tryhards don't lol =P
Why do you always call us nerds whenever you wander back into this section? It's hardly rocket science. OMG I CAN HAZ PARAMETERS FOR MAI SUBZ? NO FUXIN WAY!

Lol because you're nerds =P
Nerds = Smart people
You = Nerd at VB = Good at VB
-facepalm-

And wander back?
Its not like i cave anywhere else?
Unlike you who entirely caves in this section xD
Quote Originally Posted by Invidus View Post
Lol because you're nerds =P
Nerds = Smart people
You = Nerd at VB = Good at VB
-facepalm-

And wander back?
Its not like i cave anywhere else?
Unlike you who entirely caves in this section xD
By wander back in I mean you disappear for weeks then randomly pop back in.

Nerd = Derogatory term for smart people = insult.

Also, I visit pretty much every section, but I contribute most here.
Alright, lets sort this out.
1. Me disappearing, just had to sort out my life, do some stuff, so i didn't have much time for MPGH.
2. Didn't mean it to be offensive, i'll call you smartass from now on ^^.
3. Meh, caver xD. You pretty much most on VB , so yeah ..

End of story. - back on topic-
Why processid, why not name? Go edit it and make it accept the name instead of the id :P
Err :P
Give me a bit =P
Blubb you're a lazy mofo.

I'll do the groundwork.

Whack this into the module.

[php]
Private Function GetPID(ByVal ProcName as String)
if ProcName.Contains(".exe") then
ProcName = ProcName.Replace(".exe", "")
End if

dim PID as integer = 0

For Each p As Process in Process.GetProcesses(My.Computer.Name)
If p.ProcessName = ProcName then
PID = p.ID
End If

Return PID

End Function
[/php]

Then modify your inject function like so:

[php]
Public Function inject(ByVal ProcName As Long, ByVal DLLPath As String) As Boolean

Dim ProcessID As Integer = GetPID(ProcName)

If ProcessID = 0 then
GoTo exiterror
End If

On Error GoTo exiterror
Dim DProc As Integer
Dim DAdd As Integer
Dim DWrote As UInteger
Dim DAll As Integer
Dim DThe As Integer
Dim DMHD As Integer
DProc = OpenProcess(&H1F0FFF, 1, ProcessID)
DAdd = VirtualAllocEx(DProc, 0, DLLPath.Length, &H1000, &H4)
If (DAdd > 0) Then
Dim DByte() As Byte
DByte = StrChar(DLLPath)
WriteProcessMemory(DProc, DAdd, DByte, DLLPath.Length, DWrote)
DMHD = GetModuleHandle("kernel32.dll")
DAll = GetProcAddress(DMHD, "LoadLibraryA")
DThe = CreateRemoteThread(DProc, 0, 0, DAll, DAdd, 0, 0)
If (DThe > 0) Then
WaitForSingleObject(DThe, &HFFFF)
CloseHandle(DThe)
Return True
Else
GoTo exiterror
End If
Else
GoTo exiterror
End If
inject = True
Exit Function
exiterror:
inject = False
[/php]

Why 2 functions, put both together
Quote Originally Posted by Blubb1337 View Post
Why 2 functions, put both together
Meh I like function, the inject one was already there and I like having a re-usable function for a later date, keeps things tidy.
Posts 1–13 of 13 · Page 1 of 1
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Talk with us