Ver Mensaje Individual
  #14 (permalink)  
Antiguo 29/03/2010, 01:38
Drinky94
 
Fecha de Ingreso: febrero-2010
Mensajes: 2
Antigüedad: 14 años, 10 meses
Puntos: 0
Respuesta: Inyectar exe en otro exe?

Cita:
Iniciado por culd Ver Mensaje
Para comenzar, vos no podes inyectar con VB en un proceso... Para eso tenes que usar otro lenguaje como C++

Ahora bien... Si vos tenes una ventana, SUPONGAMOS INTERNET EXPLORER.... Y vos queres que tu programa se vea dentro de la ventana del INTERNET EXPLORER... (pero eso no seria inyectar) ahi si podes... Es decir, podes poner el form de tu programa dentro de otro form externo... Eso si

Decime cual de las dos queres
Error si que puede inyectar... jajaja

o sino... que es esto?

Código:
'************************************************************************
'************************************************************************
'**                                                                    **
'**   Inyeccion Dll en VB a partir del codigo en C++ de MazarD         **
'**                                                                    **
'**                  Wrote on June 15, 2007 by Hendrix                 **
'**                                                                    **
'**                                                                    **
'**                         CopyLeft Licence                           **
'************************************************************************
'************************************************************************



Private Const PAGE_READWRITE As Long = &H4
Private Const MEM_RELEASE As Long = &H8000
Private Const MEM_COMMIT As Long = &H1000
Private Const STANDARD_RIGHTS_REQUIRED As Long = &HF0000
Private Const SYNCHRONIZE As Long = &H100000
Private Const PROCESS_ALL_ACCESS As Long = (STANDARD_RIGHTS_REQUIRED Or SYNCHRONIZE Or &HFFF)
Private Const INFINITE As Long = &HFFFFFF

Private Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long
Private Declare Function GetProcAddress Lib "kernel32" (ByVal hModule As Long, ByVal lpProcName As String) As Long
Private Declare Function GetModuleHandle Lib "kernel32" Alias "GetModuleHandleA" (ByVal lpModuleName As String) As Long
Private Declare Function VirtualAllocEx Lib "kernel32" (ByVal hProcess As Long, ByVal lpAddress As Long, ByVal dwSize As Long, ByVal flAllocationType As Long, ByVal flProtect As Long) As Long
Private Declare Function WriteProcessMemory Lib "kernel32" (ByVal hProcess As Long, lpBaseAddress As Any, lpBuffer As Any, ByVal nSize As Long, lpNumberOfBytesWritten As Long) As Long
Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long
Private Declare Function CreateRemoteThread Lib "kernel32" (ByVal hProcess As Long, lpThreadAttributes As Long, ByVal dwStackSize As Long, lpStartAddress As Long, lpParameter As Any, ByVal dwCreationFlags As Long, lpThreadId As Long) As Long
Private Declare Function WaitForSingleObject Lib "kernel32" (ByVal hHandle As Long, ByVal dwMilliseconds As Long) As Long


Public Function Inyecta(RutaDll As String, Pid As Long) As Integer
Dim proc As Long
Dim nload As Long
Dim rems As Long
Dim longi As Long
Dim RemThread As Long
Dim Tid As Long

On Error GoTo Error
proc = OpenProcess(PROCESS_ALL_ACCESS, False, Pid)
nload = GetProcAddress(GetModuleHandle("kernel32.dll"), "LoadLibraryA")
rems = VirtualAllocEx(proc, 0, Len(RutaDll), MEM_COMMIT, PAGE_READWRITE)
WriteProcessMemory proc, ByVal rems, ByVal RutaDll, Len(RutaDll), longi
CreateRemoteThread proc, ByVal 0, 0, ByVal nload, ByVal rems, 0, Tid
WaitForSingleObject rems, INFINITE
CloseHandle proc
CloseHandle rems
Inyecta = 0
Exit Function
Error:
Inyecta = 1
End Function
y para acerlo funcionar eso en un exe:

Código:
Private Sub Form_Load()
Dim ruta As Long
Dim resultado As Integer

ruta = Shell("notepad.exe")
resultado = Inyecta("C:\ladll.dll", ruta)

If resultado = 0 Then
MsgBox "Dll Inyectada con éxito!!!", , "Información"
Else
MsgBox "A ocurrido un error", vbCritical, "Información"
End If
End
End Sub

y aora que? e puede o no se puede

salu2!