martes, 24 de marzo de 2009

EOFEXTRACT - Funcion para extraer el EOF

;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
;@ @
;@ EOFEXTRACT by krackwar @
;@ krackwar@hotmail.com @
;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
include 'win32ax.inc'
.code
start:
stdcall EOFEXTRACT,"C:\archivo.exe"
xor ebx,ebx
mov ebx,eax
invoke GlobalAlloc,GPTR,4
push eax
invoke wsprintf,eax,"0x%x",ebx
pop eax
push eax
invoke MessageBox,0,eax,"EOF data",0
pop eax

invoke GlobalFree,eax
invoke ExitProcess,0
proc EOFEXTRACT,ruta
locals
DireccionPE dd ?
bUsados dd ?
PE dd ?
NumeroSecciones dd ?
BeginLastSection dd ?
hFile dd ?
EOF dd ?
tamAr dd ?
PointerToRawData dd ?
IB dd ?
SizeOfRawData dd ?
endl
invoke CreateFile, [ruta], GENERIC_READ, 0, 0, OPEN_EXISTING, 0, 0
mov [hFile], eax
invoke GetFileSize, [hFile], 0
mov [tamAr], eax
invoke GlobalAlloc, GPTR, eax
mov [IB], eax
invoke ReadFile, [hFile], [IB], [tamAr], addr bUsados, 0
mov ebx ,[IB]
add ebx, 0x3c
mov eax,dword[ebx]
mov [DireccionPE] ,eax
xor ebx,ebx
mov ebx,[IB]
add ebx,eax
mov [PE],ebx
add ebx,0x6
xor edx,edx
mov dx,word[ebx]
mov [NumeroSecciones],edx
mov eax,$28
mov ebx,[NumeroSecciones]
dec ebx
mul ebx
xor edx,edx
mov edx,[DireccionPE]
add edx,$F8
add edx,eax
mov [BeginLastSection],edx
xor eax,eax
xor ebx,ebx
xor edx,edx
mov eax,[IB]
mov edx,[BeginLastSection]
add eax,edx
add eax,16
mov ebx,DWORD[eax]
mov [SizeOfRawData],ebx
add eax,4
xor ebx,ebx
mov ebx,DWORD[eax]
mov [PointerToRawData],ebx
xor ebx,ebx
xor eax,eax
mov edx, [PointerToRawData]
mov ebx,[SizeOfRawData]
add ebx,edx
mov [EOF],ebx
mov eax,[EOF]
ret
endp

.end start

0 comentarios:

Publicar un comentario