elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Únete al Grupo Steam elhacker.NET


+  Foro de elhacker.net
|-+  Programación
| |-+  Programación General
| | |-+  ASM (Moderador: Eternal Idol)
| | | |-+  EOFEXTRACT - Funcion para extraer el EOF
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: [1] Ir Abajo Respuesta Imprimir
Autor Tema: EOFEXTRACT - Funcion para extraer el EOF  (Leído 4,080 veces)
Krackwar ™

Desconectado Desconectado

Mensajes: 100



Ver Perfil
EOFEXTRACT - Funcion para extraer el EOF
« en: 11 Marzo 2009, 16:36 pm »

Código
  1. ;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  2. ;@                                     @
  3. ;@   EOFEXTRACT by krackwar            @
  4. ;@   krackwar@hotmail.com              @
  5. ;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  6. include 'win32ax.inc'
  7. .code
  8. start:
  9. stdcall EOFEXTRACT,"C:\archivo.exe"
  10. xor ebx,ebx
  11. mov ebx,eax
  12. invoke GlobalAlloc,GPTR,4
  13. push eax
  14. invoke wsprintf,eax,"0x%x",ebx
  15. pop eax
  16. push eax
  17. invoke MessageBox,0,eax,"EOF data",0
  18. pop eax
  19.  
  20. invoke GlobalFree,eax
  21. invoke ExitProcess,0
  22. proc EOFEXTRACT,ruta
  23. locals
  24.    DireccionPE dd ?
  25.    bUsados dd ?
  26.    PE dd ?
  27.    NumeroSecciones dd ?
  28.    BeginLastSection   dd ?
  29.    hFile   dd ?
  30.    EOF dd ?
  31.    tamAr   dd ?
  32.    PointerToRawData dd ?
  33.    IB      dd ?
  34.    SizeOfRawData dd ?
  35. endl
  36. invoke  CreateFile, [ruta], GENERIC_READ, 0, 0, OPEN_EXISTING, 0, 0
  37. mov [hFile], eax
  38. invoke  GetFileSize, [hFile], 0
  39. mov [tamAr], eax
  40. invoke  GlobalAlloc, GPTR, eax
  41. mov [IB], eax
  42. invoke  ReadFile, [hFile], [IB], [tamAr], addr bUsados, 0
  43. mov ebx ,[IB]
  44. add ebx, 0x3c
  45. mov eax,dword[ebx]
  46. mov [DireccionPE] ,eax
  47. xor ebx,ebx
  48. mov ebx,[IB]
  49. add ebx,eax
  50. mov [PE],ebx
  51. add ebx,0x6
  52. xor edx,edx
  53. mov dx,word[ebx]
  54. mov [NumeroSecciones],edx
  55. mov eax,$28
  56. mov ebx,[NumeroSecciones]
  57. dec ebx
  58. mul ebx
  59. xor edx,edx
  60. mov edx,[DireccionPE]
  61. add edx,$F8
  62. add edx,eax
  63. mov [BeginLastSection],edx
  64. xor eax,eax
  65. xor ebx,ebx
  66. xor edx,edx
  67. mov eax,[IB]
  68. mov edx,[BeginLastSection]
  69. add eax,edx
  70. add eax,16
  71. mov ebx,DWORD[eax]
  72. mov [SizeOfRawData],ebx
  73. add eax,4
  74. xor ebx,ebx
  75. mov ebx,DWORD[eax]
  76. mov [PointerToRawData],ebx
  77. xor ebx,ebx
  78. xor eax,eax
  79. mov  edx, [PointerToRawData]
  80. mov ebx,[SizeOfRawData]
  81. add ebx,edx
  82. mov [EOF],ebx
  83. mov eax,[EOF]
  84. ret
  85. endp
  86.  
  87. .end start

Gracias a E0N ya que me apoye en un codigo de el en visual basic :P


En línea

WHK es mas u17r4m4573r31337 que yo



El error mas grande de el mundo es decir que el ser humano es inteligente.

Facismo , antifacismo , etc.. la misma mierda ..
Soy el-> http://tinyurl.com/fantasma-de-krackwar
Código
  1. mov ecx,1000
  2. Etiqueta:
  3. invoke printf,"No Copiare en clases"
  4. loop Etiq
Krackwar ™

Desconectado Desconectado

Mensajes: 100



Ver Perfil
Re: EOFEXTRACT - Funcion para extraer el EOF
« Respuesta #1 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 .

Código
  1. proc KillEOF,ruta
  2. locals
  3. SizeOfRawDataAumentado dd ?
  4.    DireccionPE dd ?
  5.    bUsados dd ?
  6.    TamañoEOF dd ?
  7.    PE dd ?
  8.    NumeroSecciones dd ?
  9.    BeginLastSection   dd ?
  10.    hFile   dd ?
  11.    EOF dd ?
  12.    tamAr   dd ?
  13.    PointerToRawData dd ?
  14.    IB      dd ?
  15.    SizeOfRawData dd ?
  16.    Virualsize dd ?
  17.    VirualsizeAumentado dd ?
  18. endl
  19. invoke  CreateFile, [ruta], GENERIC_READ, 0, 0, OPEN_EXISTING, 0, 0
  20. mov [hFile], eax
  21. invoke  GetFileSize, [hFile], 0
  22. mov [tamAr], eax
  23. invoke  GlobalAlloc, GPTR, eax
  24. mov [IB], eax
  25. invoke  ReadFile, [hFile], [IB], [tamAr], addr bUsados, 0
  26. mov ebx ,[IB]
  27. add ebx, 0x3c
  28. mov eax,dword[ebx]
  29. mov [DireccionPE] ,eax
  30. xor ebx,ebx
  31. mov ebx,[IB]
  32. add ebx,eax
  33. mov [PE],ebx
  34. add ebx,0x6
  35. xor edx,edx
  36. mov dx,word[ebx]
  37. mov [NumeroSecciones],edx
  38. mov eax,$28
  39. mov ebx,[NumeroSecciones]
  40. dec ebx
  41. mul ebx
  42. xor edx,edx
  43. mov edx,[DireccionPE]
  44. add edx,$F8
  45. add edx,eax
  46. mov [BeginLastSection],edx
  47. xor eax,eax
  48. xor ebx,ebx
  49. xor edx,edx
  50. mov eax,[IB]
  51. mov edx,[BeginLastSection]
  52. add eax,edx
  53. add eax,10h
  54. mov ebx,DWORD[eax]
  55. mov [SizeOfRawData],ebx
  56. xor eax,eax
  57. xor ebx,ebx
  58. xor edx,edx
  59. mov eax,[IB]
  60. mov edx,[BeginLastSection]
  61. add eax,edx
  62. add eax,14h
  63. mov ebx,DWORD[eax]
  64. mov [PointerToRawData],ebx
  65. xor ebx,ebx
  66. xor eax,eax
  67. mov  edx, [PointerToRawData]
  68. mov ebx,[SizeOfRawData]
  69. add ebx,edx
  70. mov [EOF],ebx
  71. mov eax,[EOF]
  72. mov ebx,[tamAr]
  73. sub ebx,eax
  74. mov [TamañoEOF],ebx
  75. xor eax,eax
  76. mov eax,[SizeOfRawData]
  77. add eax,ebx
  78. mov [SizeOfRawDataAumentado],eax
  79. xor ebx,ebx
  80. mov ebx, [IB]
  81. add ebx,[BeginLastSection]
  82. add ebx,10h
  83. mov dword[ebx],eax
  84. xor eax,eax
  85. sub  ebx,[BeginLastSection]
  86. sub ebx,10h
  87. add ebx ,[BeginLastSection]
  88. add ebx,0x8
  89. mov eax,dword[ebx]
  90. add eax,[TamañoEOF]
  91. mov dword[ebx],eax
  92. sub ebx,0x8
  93. sub ebx,[BeginLastSection]
  94. xor eax,eax
  95. ;Virualsize
  96. mov eax,ebx
  97. xor ebx,ebx
  98. mov ebx,[tamAr]
  99. xor edx,edx
  100. mov edx,[hFile]
  101. ret
  102. endp  


En línea

WHK es mas u17r4m4573r31337 que yo



El error mas grande de el mundo es decir que el ser humano es inteligente.

Facismo , antifacismo , etc.. la misma mierda ..
Soy el-> http://tinyurl.com/fantasma-de-krackwar
Código
  1. mov ecx,1000
  2. Etiqueta:
  3. invoke printf,"No Copiare en clases"
  4. loop Etiq
Micah Genji

Desconectado Desconectado

Mensajes: 52


learn more to life


Ver Perfil
Re: EOFEXTRACT - Funcion para extraer el EOF
« Respuesta #2 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
En línea

Only two things are infinite, the universe and human stupidity, and I'm not sure about the former : A.E
YST


Desconectado Desconectado

Mensajes: 965


I'm you


Ver Perfil WWW
Re: EOFEXTRACT - Funcion para extraer el EOF
« Respuesta #3 en: 30 Abril 2009, 03:10 am »

borrado por que me canse del foro .
« Última modificación: 29 Mayo 2009, 21:37 pm por YST » En línea



Yo le enseñe a Kayser a usar objetos en ASM
Micah Genji

Desconectado Desconectado

Mensajes: 52


learn more to life


Ver Perfil
Re: EOFEXTRACT - Funcion para extraer el EOF
« Respuesta #4 en: 1 Mayo 2009, 02:41 am »

Ok gracias por la aclaracion.

Creo que hay mucho por recorrer.

Byt3s
En línea

Only two things are infinite, the universe and human stupidity, and I'm not sure about the former : A.E
Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  

Mensajes similares
Asunto Iniciado por Respuestas Vistas Último mensaje
[RETO] + Funcion Extraer Numeros de Cadenas! [Cpp/C] « 1 2 3 4 »
Programación C/C++
x64core 39 34,454 Último mensaje 8 Enero 2012, 00:58 am
por Eternal Idol
[RETO] + Funcion Extraer Numeros de Cadenas! « 1 2 ... 5 6 »
Programación Visual Basic
x64core 55 27,287 Último mensaje 9 Enero 2012, 10:26 am
por Psyke1
[[RETO]] Funcion para ordenar, extraer e insertar en una pila « 1 2 »
Programación C/C++
BlackDhampir 10 9,080 Último mensaje 28 Octubre 2021, 16:22 pm
por Eternal Idol
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines