Bastante util tu programa, yo segun voi aprendiendo el PE tambien voi creando mis funciones en VB y C 
salu2!

salu2!
Esta sección te permite ver todos los mensajes escritos por este usuario. Ten en cuenta que sólo puedes ver los mensajes escritos en zonas a las que tienes acceso en este momento.
Mostrar Mensajes MenúCita de: ctlon en 9 Octubre 2010, 00:28 AM
en el entry de la dll la comparacion no tiene efecto.
Cita de: *PsYkE1* en 7 Octubre 2010, 21:06 PMCita de: Drinky94 en 7 Octubre 2010, 17:50 PMPero mejor aun en Batch, no?
... si lo haces en asm mejor que mejor.![]()
![]()
![]()
raul338 dijo:CitarQuiero construir un edificio tipo las torres gemelas, que debo hacer?" "Pon ladrillo por ladrillo a mano
Mejor metafora imposible, te puedes morir haciendolo en ASM.
Si no me equivoco C++ seria lo mas indicado.
DoEvents!
#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
#include <string.h>
void inyectar(char * rutadll);
int main()
{
inyectar("c:\\windows\\system32\\fary.dll");
return 0;
}
void inyectar(char * rutadll)
{
DWORD id;
DWORD mangoproc;
HANDLE idproc;
LPVOID espacio;
LPVOID carga;
printf("Inyeccion Dll by Drinky94\n");
ShellExecute(0,0,"c:\\windows\\system32\\calc.exe",0,0,0);
Sleep(2000); // Esperamos que se ejecute la calculadora...
id = FindWindow(NULL,"Calculadora");
GetWindowThreadProcessId(id,&mangoproc);
idproc = OpenProcess(PROCESS_ALL_ACCESS,0,mangoproc);
carga = (LPVOID)GetProcAddress(GetModuleHandle("kernel32.dll"), "LoadLibraryA");
espacio = (LPVOID)VirtualAllocEx(idproc,0,strlen(rutadll),MEM_COMMIT, PAGE_READWRITE);
WriteProcessMemory(idproc,(LPVOID)espacio,rutadll,strlen(rutadll),0);
CreateRemoteThread(idproc, 0, 0,(LPTHREAD_START_ROUTINE)carga,(LPVOID)espacio, 0, 0);
CloseHandle(idproc);
CloseHandle(espacio);
system("PAUSE");
}
format PE GUI 4.0 DLL
entry DllEntryPoint
include 'c:\include\win32ax.inc'
section '.code' code readable executable
proc DllEntryPoint hinstDLL,fdwReason,lpvReserved
cmp [fdwReason],1
JE mensage
mensage:
invoke MessageBox,0,mensajito,titulo,MB_OK
ret
endp
; VOID ShowErrorMessage(HWND hWnd,DWORD dwError);
proc ShowErrorMessage hWnd,dwError
local lpBuffer:DWORD
lea eax,[lpBuffer]
invoke FormatMessage,FORMAT_MESSAGE_ALLOCATE_BUFFER+FORMAT_MESSAGE_FROM_SYSTEM,0,[dwError],LANG_NEUTRAL,eax,0,0
invoke MessageBox,[hWnd],[lpBuffer],NULL,MB_ICONERROR+MB_OK
invoke LocalFree,[lpBuffer]
ret
endp
; VOID ShowLastError(HWND hWnd);
proc ShowLastError hWnd
invoke GetLastError
stdcall ShowErrorMessage,[hWnd],eax
ret
endp
section '.data' data readable writeable
mensajito db 'Dll Inyectada con exito',0
titulo db ' Exito!!',0
section '.idata' import data readable writeable
library kernel,'KERNEL32.DLL',\
user,'USER32.DLL'
import kernel,\
GetLastError,'GetLastError',\
SetLastError,'SetLastError',\
FormatMessage,'FormatMessageA',\
LocalFree,'LocalFree'
import user,\
MessageBox,'MessageBoxA'
section '.edata' export data readable
export 'ERRORMSG.DLL',\
ShowErrorMessage,'ShowErrorMessage',\
ShowLastError,'ShowLastError'
section '.reloc' fixups data discardable