Código
; Programado por mDrinky o Juan fary. ; drinky.94@hotmail.com include 'win32ax.inc' ; Instrucciones a las que es capaz de sacar la longitud. ; mov esp,ebp = 0x8B 2 bytes ; push ebp = 0x55 1 byte ; mov Reg,DWORD = 0xB8 + Registro 5 bytes ; ret = 0xC3 1 byte ; ret Numero = 0xC2 2 bytes ; mov dword[Direccion],Numero = 0x83 7 bytes .data DLL db 'USER32.DLL',0 API db 'MessageBoxA',0 MsgHook db 'Api Hookeada',0 ApiBuena dd ? CanSalto dd ? oPer dd ? Salto dd ? .code start: invoke LoadLibraryA,DLL invoke GetProcAddress,eax,API mov [ApiBuena],eax push MiFuncion Call Hookear push 0 push 0 push 0 push 0 call [MessageBoxA] push 0 call [ExitProcess] MiFuncion: pop ecx add esp,0xC push 0 push 0 push MsgHook push 0 push ecx ApiVerdadera: db 0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90 push eax mov eax,[ApiBuena] add eax,[CanSalto] mov [Salto],eax pop eax jmp [Salto] proc Hookear,FunHook mov ecx,0 NumOpcode: cmp byte[eax],0x8B jne NoOp1 add ecx,2 add eax,2 NoOp1: cmp byte[eax],0x55 jne NoOp2 add ecx,1 add eax,1 NoOp2: cmp byte[eax],0xB8 jb NoOp3 cmp byte[eax],0xBD ja NoOp3 add ecx,5 add eax,5 NoOp3: cmp byte[eax],0xC3 jne NoOp4 add ecx,1 add eax,1 NoOp4: cmp byte[eax],0xC2 jne NoOp5 add ecx,2 add eax,2 NoOp5: cmp byte[eax],0x83 jne NoOp6 add ecx,7 add eax,7 NoOp6: cmp ecx,5 jb NumOpcode mov [CanSalto],ecx invoke VirtualProtect,[ApiBuena],20,PAGE_EXECUTE_READWRITE,addr oPer invoke VirtualProtect,ApiVerdadera,20,PAGE_EXECUTE_READWRITE,addr oPer mov eax,[ApiBuena] mov edx,ApiVerdadera mov ecx,0 GuardarBytes: mov bl,byte[eax+ecx] mov byte[edx+ecx],bl inc ecx cmp ecx,[CanSalto] jne GuardarBytes mov eax,[ApiBuena] mov byte[eax],0x68 inc eax mov ebx,dword[FunHook] mov dword[eax],ebx add eax,4 mov byte[eax],0xC3 ret endp .end start
No recalcula todas las API pero si la gran mayoría.
saludos.