Título: EOFEXTRACT - Funcion para extraer el EOF
Publicado por: Krackwar ™ en 11 Marzo 2009, 16:36 pm
;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ;@ @ ;@ 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
Gracias a E0N ya que me apoye en un codigo de el en visual basic :P
Título: Re: EOFEXTRACT - Funcion para extraer el EOF
Publicado por: Krackwar ™ en 11 Marzo 2009, 19:26 pm
Modifique un poco este mismo source para que agregue todo lo que este en el EOF lo agregue a la ultima sección, la función esta ultima dse puede mejorar mucho pero mas rato lo paso en "limpio" devuelve el archivo modificado en eax , el tamaño en ebx y el handle en edx . proc KillEOF,ruta locals SizeOfRawDataAumentado dd ? DireccionPE dd ? bUsados dd ? TamañoEOF dd ? PE dd ? NumeroSecciones dd ? BeginLastSection dd ? hFile dd ? EOF dd ? tamAr dd ? PointerToRawData dd ? IB dd ? SizeOfRawData dd ? Virualsize dd ? VirualsizeAumentado 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,10h mov ebx,DWORD[eax] mov [SizeOfRawData],ebx xor eax,eax xor ebx,ebx xor edx,edx mov eax,[IB] mov edx,[BeginLastSection] add eax,edx add eax,14h 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] mov ebx,[tamAr] sub ebx,eax mov [TamañoEOF],ebx xor eax,eax mov eax,[SizeOfRawData] add eax,ebx mov [SizeOfRawDataAumentado],eax xor ebx,ebx mov ebx, [IB] add ebx,[BeginLastSection] add ebx,10h mov dword[ebx],eax xor eax,eax sub ebx,[BeginLastSection] sub ebx,10h add ebx ,[BeginLastSection] add ebx,0x8 mov eax,dword[ebx] add eax,[TamañoEOF] mov dword[ebx],eax sub ebx,0x8 sub ebx,[BeginLastSection] xor eax,eax ;Virualsize mov eax,ebx xor ebx,ebx mov ebx,[tamAr] xor edx,edx mov edx,[hFile] ret endp
Título: Re: EOFEXTRACT - Funcion para extraer el EOF
Publicado por: Micah Genji en 30 Abril 2009, 02:47 am
Hola estuve leyendo este code, normamelnte estoy empezando a usar C. Justamente andaba averiguando sobre el valor de EOF en el stdio.h, pero veo que este code es para asm si no me equivoco :-X
Cual es la idea de esta extraccion de EOF ?
haber si me sirve de alguna idea para un code que quiero realizar :)
Byt3s
Título: Re: EOFEXTRACT - Funcion para extraer el EOF
Publicado por: YST en 30 Abril 2009, 03:10 am
borrado por que me canse del foro .
Título: Re: EOFEXTRACT - Funcion para extraer el EOF
Publicado por: Micah Genji en 1 Mayo 2009, 02:41 am
Ok gracias por la aclaracion.
Creo que hay mucho por recorrer.
Byt3s
|