Page 3 of 5 FirstFirst 12345 LastLast
Results 21 to 30 of 49

Thread: Unpacking Kazaa 2.6

  1. #21
    Originally posted by RileyF+11 December 2003 - 17:49--></div><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td>QUOTE (RileyF &#064; 11 December 2003 - 17:49)</td></tr><tr><td id='QUOTE'><!--QuoteBegin-Johnny_B@11 December 2003 - 19:26
    Didn&#39;t random nut unpack kazaa.exe?
    well yeah he unpacked it, how would you otherwise reverse engineer it... but that&#39;s not the point.. if some one can host the unpacked kazaa other devs that can&#39;t unpack it (cause it&#39;s protected) ,trough whatever problems, can work on programs for 2.6, resource sections can be changed --&#62; turn outlook in to a lite (icons)and maybe some one can work on KLR and imporve it.. so if some one can host it, that will be a &#39;investment&#39; in the developing of kazaa lite...[/b][/quote]
    Yeah I know all that.
    It&#39;s just that if random nut already did it, perhaps he could make it easier for us and put it up on his klr website for us to download (or perhaps maybe even email it to someone that can host it).
    Once some of us have it, he could then take take it off of his website (no need for him to get into trouble ).
    We will eventually spread it.

  2. File Sharing   -   #22
    Yes, I unpacked it, but I will not send it to anyone else or put it on a web site. I have provided the source code to klr.exe and use the source luke.

  3. File Sharing   -   #23
    Poster
    Join Date
    Jun 2003
    Location
    England
    Posts
    1,377
    c&#39;mon RN, just send it to me pls&#33;

  4. File Sharing   -   #24
    Originally posted by random nut@11 December 2003 - 19:08
    Yes, I unpacked it, but I will not send it to anyone else or put it on a web site. I have provided the source code to klr.exe and use the source luke.
    I think you like watching us trying to do in a month what you can do in 5 minutes.
    We can&#39;t handle the source like you do, Obi-wan.

    Please help us on this one, random nut.

  5. File Sharing   -   #25
    --Spam--
    Guest
    Does this help?

    This code unpacks ActiveMark wrapper thanks to the fact, that it uses upx to compress the original PE. Sometimes theres is an error if SoftICE is active in w98 due to a high INT1 address, because a protection checks a large amount of memory from this address and it may produce an access exception.




    .386

    .model flat, stdcall

    option casemap: none
    include masm32includewindows.inc
    include masm32includekernel32.inc
    include masm32includeuser32.inc
    include masm32includecomdlg32.inc

    includelib masm32libkernel32.lib
    includelib masm32libuser32.lib
    includelib masm32libcomdlg32.lib

    ImageBase&nbsp; &nbsp; &nbsp; equ 400000h
    sizeCabecera&nbsp; &nbsp; equ 600h
    FALSO&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; equ 0
    CIERTO&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; equ -1

    GetSection&nbsp; &nbsp; &nbsp; PROTO WORD
    RealignSections PROTO
    WriteITAddress&nbsp; PROTO WORD, WORD

    .data
    Save&nbsp; &nbsp; &nbsp; &nbsp; db &#39;Unpacked.exe&#39;,0
    Semaforo&nbsp; &nbsp; db &#39;LeeMe.txt&#39;,0
    msgNoes&nbsp; &nbsp; db &#39;La proteccion no es ActiveMark o es otra version, desea continuar de todas maneras?&#39;,0
    ofnTitle&nbsp; &nbsp; db &#39;Unpacker para el ActiveMARK v2.6 bY eSn-mIn&#39;,0
    ofnFilter&nbsp; db &#39;Executable Files (*.exe)&#39;,0
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; db &#39;*.exe&#39;,0,0
    Readme&nbsp; &nbsp; &nbsp; db &#39;Unpacker para el ActiveMARK v2.6 bY eSn-mIn&#39;,13,10
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; db &#39;Creado el 28 de Septiembre del 2002&#39;,13,10
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; db &#39;http://www.esnmin.get.to&#39;
    sizeReadme&nbsp; equ &#036; - OFFSET Readme
    Pregunta&nbsp; &nbsp; db FALSO

    .data?
    stnfo&nbsp; &nbsp; &nbsp; STARTUPINFO <>
    pinfo&nbsp; &nbsp; &nbsp; PROCESS_INFORMATION <>
    ofn&nbsp; &nbsp; &nbsp; &nbsp; OPENFILENAME <>
    ofnFile&nbsp; &nbsp; db 200h dup (?)
    Bytes&nbsp; &nbsp; &nbsp; dd ?
    sizeRsrc&nbsp; &nbsp; dd ?
    lpRsrc&nbsp; &nbsp; &nbsp; dd ?
    lpRsrc2&nbsp; &nbsp; dd ?
    rvaRsrc&nbsp; &nbsp; dd ?
    Cabecera&nbsp; &nbsp; db sizeCabecera dup (?)
    lpHook&nbsp; &nbsp; &nbsp; dd ?
    lpFile&nbsp; &nbsp; &nbsp; dd ?
    hSave&nbsp; &nbsp; &nbsp; dd ?
    hReadme&nbsp; &nbsp; dd ?

    .code
    Main proc
    LOCAL rvaITWORD, sizeITWORD, ImageSizeWORD

    invoke GetModuleHandle, NULL

    &nbsp; &nbsp; &nbsp; &nbsp; mov ofn.hWndOwner, eax
    &nbsp; &nbsp; &nbsp; &nbsp; mov ofn.lStructSize, SIZEOF ofn
    &nbsp; &nbsp; &nbsp; &nbsp; mov ofn.lpstrFilter, offset ofnFilter
    &nbsp; &nbsp; &nbsp; &nbsp; mov ofn.lpstrTitle, offset ofnTitle
    &nbsp; &nbsp; &nbsp; &nbsp; mov ofn.lpstrFile, offset ofnFile
    &nbsp; &nbsp; &nbsp; &nbsp; mov ofn.nMaxFile, 200h
    &nbsp; &nbsp; &nbsp; &nbsp; mov ofn.Flags, OFN_FILEMUSTEXIST or OFN_PATHMUSTEXIST or
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; OFN_LONGNAMES or OFN_EXPLORER or
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; OFN_HIDEREADONLY
    invoke GetOpenFileNameA, offset ofn
    or eax, eax
    jz error

    invoke GetStartupInfo, OFFSET stnfo
    invoke CreateProcess, OFFSET ofnFile, NULL, NULL, NULL, NULL,
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; CREATE_SUSPENDED, NULL, NULL, OFFSET stnfo, OFFSET pinfo

    ; Lee la cabecera
    &nbsp; &nbsp; &nbsp; &nbsp; invoke ReadProcessMemory, pinfo.hProcess, ImageBase, OFFSET Cabecera,
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sizeCabecera, OFFSET Bytes

    ; Obtiene el size y la RVA de la seccion RSRC
    &nbsp; &nbsp; &nbsp; &nbsp; invoke GetSection, 3
    &nbsp; &nbsp; &nbsp; &nbsp; mov rvaRsrc, eax
    &nbsp; &nbsp; &nbsp; &nbsp; mov sizeRsrc, edx

    ; Realinea las secciones
    &nbsp; &nbsp; &nbsp; &nbsp; invoke RealignSections
    &nbsp; &nbsp; &nbsp; &nbsp; cmp eax, -1
    &nbsp; &nbsp; &nbsp; &nbsp; jz error

    ; Lee la seccion de recursos donde esta la IAT (La segunda vez es un backup)
    &nbsp; &nbsp; &nbsp; &nbsp; invoke GlobalAlloc, NULL, sizeRsrc
    &nbsp; &nbsp; &nbsp; &nbsp; mov lpRsrc, eax
    &nbsp; &nbsp; &nbsp; &nbsp; invoke ReadProcessMemory, pinfo.hProcess, rvaRsrc, lpRsrc, sizeRsrc, OFFSET Bytes
    &nbsp; &nbsp; &nbsp; &nbsp;
    &nbsp; &nbsp; &nbsp; &nbsp; invoke GlobalAlloc, NULL, sizeRsrc
    &nbsp; &nbsp; &nbsp; &nbsp; mov lpRsrc2, eax
    &nbsp; &nbsp; &nbsp; &nbsp; invoke ReadProcessMemory, pinfo.hProcess, rvaRsrc, lpRsrc2, sizeRsrc, OFFSET Bytes


    mov edi, lpRsrc

    ; Escribe Funcion con la direccion de LoadLibraryA
    &nbsp; &nbsp; &nbsp; &nbsp; mov eax, LoadLibrary
    &nbsp; &nbsp; &nbsp; &nbsp; mov eax, [eax+2]
    &nbsp; &nbsp; &nbsp; &nbsp; mov eax, [eax]
    &nbsp; &nbsp; &nbsp; &nbsp; mov FuncionLoadLibrary, eax
    &nbsp; &nbsp; &nbsp; &nbsp; mov eax, CreateFile
    &nbsp; &nbsp; &nbsp; &nbsp; mov eax, [eax+2]
    &nbsp; &nbsp; &nbsp; &nbsp; mov eax, [eax]
    &nbsp; &nbsp; &nbsp; &nbsp; mov FuncionCreateFile, eax
    &nbsp; &nbsp; &nbsp; &nbsp; mov eax, CloseHandle
    &nbsp; &nbsp; &nbsp; &nbsp; mov eax, [eax+2]
    &nbsp; &nbsp; &nbsp; &nbsp; mov eax, [eax]
    &nbsp; &nbsp; &nbsp; &nbsp; mov FuncionCloseHandle, eax
    &nbsp; &nbsp; &nbsp; &nbsp;
    ; Busca la cadena LoadLibraryA
    &nbsp; &nbsp; &nbsp; &nbsp; mov eax, &#39;daoL&#39;
    &nbsp; &nbsp; &nbsp; &nbsp; xor ecx, ecx
    &nbsp; &nbsp; &nbsp; &nbsp; .WHILE [edi+ecx] &#33;= eax && ecx < sizeRsrc
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; inc ecx
    &nbsp; &nbsp; &nbsp; &nbsp;
    &nbsp; &nbsp; &nbsp; &nbsp; .ENDW
    &nbsp; &nbsp; &nbsp; &nbsp;
    &nbsp; &nbsp; &nbsp; &nbsp; .IF ecx == sizeRsrc && Pregunta == FALSO
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; mov Pregunta, CIERTO
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; invoke MessageBoxA, 0, OFFSET msgNoes, OFFSET ofnTitle, MB_OKCANCEL OR MB_ICONQUESTION
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cmp eax, IDCANCEL
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; jz error

    &nbsp; &nbsp; &nbsp; &nbsp; .ENDIF
    &nbsp; &nbsp; &nbsp; &nbsp;
    &nbsp; &nbsp; &nbsp; &nbsp; mov eax, ecx
    &nbsp; &nbsp; &nbsp; &nbsp; sub eax, 2
    &nbsp; &nbsp; &nbsp; &nbsp; push eax

    ; Busca algunos ceros seguidos
    &nbsp; &nbsp; &nbsp; &nbsp; xor eax, eax
    &nbsp; &nbsp; &nbsp; &nbsp; xor edx, edx
    &nbsp; &nbsp; &nbsp; &nbsp; .WHILE edx < sizeHook + 1&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ; Uno de los ceros marca el final de una cadena, de ahi el +1
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .IF BYTE PTR [edi+ecx] == 0
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; inc edx
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .ELSEIF
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; xor edx, edx
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .ENDIF
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; inc ecx
    &nbsp; &nbsp; &nbsp; &nbsp;
    &nbsp; &nbsp; &nbsp; &nbsp; .ENDW
    &nbsp; &nbsp; &nbsp; &nbsp;
    &nbsp; &nbsp; &nbsp; &nbsp; mov eax, ecx
    &nbsp; &nbsp; &nbsp; &nbsp; sub eax, sizeHook
    &nbsp; &nbsp; &nbsp; &nbsp; add eax, rvaRsrc
    &nbsp; &nbsp; &nbsp; &nbsp; mov lpHook, eax

    ; Busca la parte de la IAT que referencia a esa cadena y escribe la direccion del Hook
    &nbsp; &nbsp; &nbsp; &nbsp; pop eax
    &nbsp; &nbsp; &nbsp; &nbsp; add eax, rvaRsrc
    &nbsp; &nbsp; &nbsp; &nbsp; sub eax, ImageBase
    &nbsp; &nbsp; &nbsp; &nbsp; xor ecx, ecx
    &nbsp; &nbsp; &nbsp; &nbsp; .WHILE [edi+ecx] &#33;= eax
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; inc ecx
    &nbsp; &nbsp; &nbsp; &nbsp;
    &nbsp; &nbsp; &nbsp; &nbsp; .ENDW
    &nbsp; &nbsp; &nbsp; &nbsp; mov eax, lpHook
    &nbsp; &nbsp; &nbsp; &nbsp; mov [edi+ecx], eax

    ; Busca el FirstThunk del bloque del Kernel32.dll y suma 4
    &nbsp; &nbsp; &nbsp; &nbsp; mov eax, ecx
    &nbsp; &nbsp; &nbsp; &nbsp; add eax, rvaRsrc
    &nbsp; &nbsp; &nbsp; &nbsp; sub eax, ImageBase
    &nbsp; &nbsp; &nbsp; &nbsp; xor ecx, ecx
    &nbsp; &nbsp; &nbsp; &nbsp; .WHILE [edi+ecx] &#33;= eax
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; inc ecx
    &nbsp; &nbsp; &nbsp; &nbsp;
    &nbsp; &nbsp; &nbsp; &nbsp; .ENDW
    &nbsp; &nbsp; &nbsp; &nbsp; add DWORD PTR [edi+ecx], 4

    ; Busca el rva de la IT
    &nbsp; &nbsp; &nbsp; &nbsp; sub ecx, 10h
    &nbsp; &nbsp; &nbsp; &nbsp; mov eax, ecx
    &nbsp; &nbsp; &nbsp; &nbsp; add eax, rvaRsrc
    &nbsp; &nbsp; &nbsp; &nbsp; sub eax, ImageBase
    &nbsp; &nbsp; &nbsp; &nbsp; mov rvaIT, eax

    ; Busca el size de la IT
    &nbsp; &nbsp; &nbsp; &nbsp; mov bl, FALSO
    &nbsp; &nbsp; &nbsp; &nbsp; .WHILE bl == FALSO
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; mov bl, CIERTO
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; mov edx, 20
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .WHILE edx > 0
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .IF BYTE PTR [edi+ecx] &#33;= 0
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; mov bl, FALSO
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .ENDIF
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; inc ecx
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dec edx
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .ENDW
    &nbsp; &nbsp; &nbsp; &nbsp;
    &nbsp; &nbsp; &nbsp; &nbsp; .ENDW
    &nbsp; &nbsp; &nbsp; &nbsp;
    &nbsp; &nbsp; &nbsp; &nbsp; mov eax, ecx
    &nbsp; &nbsp; &nbsp; &nbsp; add eax, rvaRsrc
    &nbsp; &nbsp; &nbsp; &nbsp; sub eax, rvaIT
    &nbsp; &nbsp; &nbsp; &nbsp; mov sizeIT, eax

    ; Escribe la direccion y size de la IT en la cabecera
    &nbsp; &nbsp; &nbsp; &nbsp; invoke WriteITAddress, rvaIT, sizeIT

    ; Escribe el Hook en el hueco libre
    &nbsp; &nbsp; &nbsp; &nbsp; mov edi, lpHook
    &nbsp; &nbsp; &nbsp; &nbsp; sub edi, rvaRsrc
    &nbsp; &nbsp; &nbsp; &nbsp; add edi, lpRsrc
    &nbsp; &nbsp; &nbsp; &nbsp; mov esi, OFFSET Hook
    &nbsp; &nbsp; &nbsp; &nbsp; mov ecx, sizeHook
    &nbsp; &nbsp; &nbsp; &nbsp; rep movsb

    ; Obtiene la ImageSize de la Cabecera
    &nbsp; &nbsp; &nbsp; &nbsp; mov edi, DWORD PTR Cabecera + 3Ch
    &nbsp; &nbsp; &nbsp; &nbsp; add edi, OFFSET Cabecera
    &nbsp; &nbsp; &nbsp; &nbsp; mov eax, [edi+50h]
    &nbsp; &nbsp; &nbsp; &nbsp; mov ImageSize, eax

    invoke DeleteFile, OFFSET Readme
    invoke WriteProcessMemory, pinfo.hProcess, ImageBase, OFFSET Cabecera, sizeCabecera, OFFSET Bytes
    invoke WriteProcessMemory, pinfo.hProcess, rvaRsrc, lpRsrc, sizeRsrc, OFFSET Bytes
    invoke GlobalFree, lpRsrc
    invoke ResumeThread, pinfo.hThread

    ; Espera a que se desempaque..
    &nbsp; &nbsp; &nbsp; &nbsp; @@:
    &nbsp; &nbsp; &nbsp; &nbsp; invoke CreateFile, OFFSET Semaforo, GENERIC_WRITE, NULL, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL
    &nbsp; &nbsp; &nbsp; &nbsp; cmp eax, INVALID_HANDLE_VALUE
    &nbsp; &nbsp; &nbsp; &nbsp; jz @b
    &nbsp; &nbsp; &nbsp; &nbsp; mov hReadme, eax
    &nbsp; &nbsp; &nbsp; &nbsp; invoke WriteFile, hReadme, OFFSET Readme, sizeReadme, OFFSET Bytes, NULL
    &nbsp; &nbsp; &nbsp; &nbsp; invoke CloseHandle, hReadme

    invoke SuspendThread, pinfo.hThread
    invoke WriteProcessMemory, pinfo.hProcess, rvaRsrc, lpRsrc2, sizeRsrc, OFFSET Bytes
    invoke GlobalFree, lpRsrc2

    invoke GlobalAlloc, NULL, ImageSize
    mov lpFile, eax
    invoke ReadProcessMemory, pinfo.hProcess, ImageBase, lpFile, ImageSize, OFFSET Bytes

    invoke CreateFile, OFFSET Save, GENERIC_WRITE, NULL, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL
    mov hSave, eax
    invoke WriteFile, hSave, lpFile, ImageSize, OFFSET Bytes, NULL
    invoke GlobalFree, lpFile

    invoke TerminateProcess, pinfo.hProcess, NULL
    invoke CloseHandle, pinfo.hProcess
    invoke CloseHandle, hSave
    jmp fin

    error:
    invoke GlobalFree, lpRsrc
    invoke GlobalFree, lpRsrc2
    invoke TerminateProcess, pinfo.hProcess, NULL
    invoke CloseHandle, pinfo.hProcess

    fin:
    invoke ExitProcess, NULL
    ret
    Main endp

    ; -----------------------------------------------------------------------

    GetSection proc Number
    LOCAL rvaSectionWORD, sizeSectionWORD
    &nbsp; &nbsp; &nbsp; &nbsp; push ebx
    &nbsp; &nbsp; &nbsp; &nbsp; push edi
    &nbsp; &nbsp; &nbsp; &nbsp;
    &nbsp; &nbsp; &nbsp; &nbsp; mov edi, DWORD PTR Cabecera + 3Ch
    &nbsp; &nbsp; &nbsp; &nbsp; add edi, OFFSET Cabecera
    &nbsp; &nbsp; &nbsp; &nbsp; xor ebx, ebx
    &nbsp; &nbsp; &nbsp; &nbsp; mov bx, [edi+14h]&nbsp; &nbsp; &nbsp; ; Size of NT header
    &nbsp; &nbsp; &nbsp; &nbsp; add edi, ebx
    &nbsp; &nbsp; &nbsp; &nbsp; add edi, 18h+8&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ; Size of FileHeader + Size of the name of the section
    &nbsp; &nbsp; &nbsp; &nbsp; mov eax, 28h
    &nbsp; &nbsp; &nbsp; &nbsp; mov ebx, Number
    &nbsp; &nbsp; &nbsp; &nbsp; dec ebx
    &nbsp; &nbsp; &nbsp; &nbsp; mul ebx
    &nbsp; &nbsp; &nbsp; &nbsp; add edi, eax&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ; Size of a section * Number of section - 1
    &nbsp; &nbsp; &nbsp; &nbsp; mov eax, [edi]&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ; Size of RSRC section
    &nbsp; &nbsp; &nbsp; &nbsp; mov sizeSection, eax
    &nbsp; &nbsp; &nbsp; &nbsp; add edi, 4
    &nbsp; &nbsp; &nbsp; &nbsp; mov eax, [edi]
    &nbsp; &nbsp; &nbsp; &nbsp; add eax, ImageBase&nbsp; &nbsp; &nbsp; ; RVA of RSRC section
    &nbsp; &nbsp; &nbsp; &nbsp; mov rvaSection, eax
    &nbsp; &nbsp; &nbsp; &nbsp; mov eax, rvaSection
    &nbsp; &nbsp; &nbsp; &nbsp; mov edx, sizeSection
    &nbsp; &nbsp; &nbsp; &nbsp;
    &nbsp; &nbsp; &nbsp; &nbsp; pop edi
    &nbsp; &nbsp; &nbsp; &nbsp; pop ebx
    &nbsp; &nbsp; &nbsp; &nbsp; ret

    GetSection endp

    ; -----------------------------------------------------------------------

    RealignSections proc
    LOCAL NumberOfSections:WORD
    &nbsp; &nbsp; &nbsp; &nbsp; push eax
    &nbsp; &nbsp; &nbsp; &nbsp; push ebx
    &nbsp; &nbsp; &nbsp; &nbsp; push edi
    &nbsp; &nbsp; &nbsp; &nbsp;
    &nbsp; &nbsp; &nbsp; &nbsp; mov edi, DWORD PTR Cabecera + 3Ch
    &nbsp; &nbsp; &nbsp; &nbsp; add edi, OFFSET Cabecera
    &nbsp; &nbsp; &nbsp; &nbsp; mov ax, [edi+6]
    &nbsp; &nbsp; &nbsp; &nbsp; mov NumberOfSections, ax

    &nbsp; &nbsp; &nbsp; &nbsp; xor ebx, ebx
    &nbsp; &nbsp; &nbsp; &nbsp; mov bx, [edi+14h]&nbsp; &nbsp; &nbsp; ; Size of NT header
    &nbsp; &nbsp; &nbsp; &nbsp; add edi, ebx
    &nbsp; &nbsp; &nbsp; &nbsp; add edi, 18h&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ; Size of FileHeader
    &nbsp; &nbsp; &nbsp; &nbsp;
    &nbsp; &nbsp; &nbsp; &nbsp; mov bx, NumberOfSections
    &nbsp; &nbsp; &nbsp; &nbsp; .WHILE bx > 0
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .IF (DWORD PTR [edi] &#33;= &#39;????&#39; || DWORD PTR [edi+4] &#33;= &#39;????&#39 && Pregunta == FALSO
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; mov Pregunta, CIERTO
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; invoke MessageBoxA, 0, OFFSET msgNoes, OFFSET ofnTitle, MB_OKCANCEL OR MB_ICONQUESTION
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cmp eax, IDCANCEL
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; jz error
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .ENDIF
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; mov eax, [edi+8]
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; mov [edi+8+8], eax
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; mov eax, [edi+0Ch]
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; mov [edi+0Ch+8], eax
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; add edi, 28h
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dec bx
    &nbsp; &nbsp; &nbsp; &nbsp;
    &nbsp; &nbsp; &nbsp; &nbsp; .ENDW
    &nbsp; &nbsp; &nbsp; &nbsp;
    &nbsp; &nbsp; &nbsp; &nbsp; pop edi
    &nbsp; &nbsp; &nbsp; &nbsp; pop ebx
    &nbsp; &nbsp; &nbsp; &nbsp; pop eax
    &nbsp; &nbsp; &nbsp; &nbsp; jmp fin
    &nbsp; &nbsp; &nbsp; &nbsp;
    &nbsp; &nbsp; &nbsp; &nbsp; error:
    &nbsp; &nbsp; &nbsp; &nbsp; mov eax, -1
    &nbsp; &nbsp; &nbsp; &nbsp;
    &nbsp; &nbsp; &nbsp; &nbsp; fin:
    &nbsp; &nbsp; &nbsp; &nbsp; ret
    &nbsp; &nbsp; &nbsp; &nbsp;
    RealignSections endp

    ; -----------------------------------------------------------------------

    WriteITAddress proc rvaITWORD, sizeITWORD
    &nbsp; &nbsp; &nbsp; &nbsp; mov edi, DWORD PTR Cabecera + 3Ch
    &nbsp; &nbsp; &nbsp; &nbsp; add edi, OFFSET Cabecera
    &nbsp; &nbsp; &nbsp; &nbsp; mov eax, rvaIT
    &nbsp; &nbsp; &nbsp; &nbsp; mov [edi+80h], eax
    &nbsp; &nbsp; &nbsp; &nbsp; mov eax, sizeIT
    &nbsp; &nbsp; &nbsp; &nbsp; mov [edi+84h], eax
    &nbsp; &nbsp; &nbsp; &nbsp; ret

    WriteITAddress endp

    ; -----------------------------------------------------------------------

    Hook proc ModuloWORD
    LOCAL hReadWORD
    &nbsp; &nbsp; &nbsp; &nbsp; mov eax, [ebp+4]
    &nbsp; &nbsp; &nbsp; &nbsp; mov eax, [eax]
    &nbsp; &nbsp; &nbsp; &nbsp; .IF eax == 47078A95h&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ; xchg eax, ebp | mov al, [edi] | inc edi
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; mov edx, [ebp+4]
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .WHILE DWORD PTR [edx] &#33;= 0C009078Bh&nbsp; &nbsp; ; mov eax, [edi] | or eax, eax
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dec edx
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .ENDW
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sub edx, 6
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; mov eax, edx
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .WHILE DWORD PTR [eax] &#33;= 0FFCD8357h&nbsp; &nbsp; ; push edi | or ebp, -1
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dec eax
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .ENDW
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; inc eax
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; mov WORD PTR [eax], 685Eh&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ; pop esi | push
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; mov [eax+2], edx&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ; address
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; mov BYTE PTR [eax+6], 0C3h&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ; ret
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sub eax, 0Dh&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ; eax = OEP &#33;&#33;
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
    &nbsp; &nbsp; &nbsp; &nbsp; ; Escribe el OEP en la cabecera
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; mov edx, ImageBase
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; add edx, [edx+3Ch]
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sub eax, ImageBase
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; mov [edx+28h], eax

    &nbsp; &nbsp; &nbsp; &nbsp; ; Crea algo para avisar de que ya estamos
    &nbsp; &nbsp; &nbsp; &nbsp; call _CreateFile
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; FuncionCreateFile&nbsp; dd ?
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; db &#39;LeeMe.txt&#39;,0
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _CreateFile:
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; pop eax
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; push NULL
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; push FILE_ATTRIBUTE_NORMAL
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; push CREATE_ALWAYS
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; push NULL
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; push NULL
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; push NULL
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; add eax, 4
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; push eax
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; mov eax, [eax-4]
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; call eax
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; mov hRead, eax
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
    &nbsp; &nbsp; &nbsp; &nbsp; call _CloseHandle
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; FuncionCloseHandle&nbsp; dd ?
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _CloseHandle:
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; pop eax
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; mov eax, [eax]
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; push hRead
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; call eax
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; jmp &#036;
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
    &nbsp; &nbsp; &nbsp; &nbsp; .ENDIF
    &nbsp; &nbsp; &nbsp; &nbsp; call _LoadLibrary
    &nbsp; &nbsp; &nbsp; &nbsp; FuncionLoadLibrary dd ?
    &nbsp; &nbsp; &nbsp; &nbsp;
    &nbsp; &nbsp; &nbsp; &nbsp; _LoadLibrary:
    &nbsp; &nbsp; &nbsp; &nbsp; pop eax
    &nbsp; &nbsp; &nbsp; &nbsp; mov eax, [eax]
    &nbsp; &nbsp; &nbsp; &nbsp; push Modulo
    &nbsp; &nbsp; &nbsp; &nbsp; call eax
    &nbsp; &nbsp; &nbsp; &nbsp; ret

    Hook endp

    sizeHook&nbsp; &nbsp; equ &#036; - OFFSET Hook

    end Main


  6. File Sharing   -   #26
    --Spam--
    Guest
    Or this?

    A 10-30 minutes method to remove the activemark protection from a game is presented here:



    AM=Activemark

    tools required :
    PTRW/W9x, SoftIce, C/C++ compiler, basic debugging skills.

    Now this method is very cumbersome, my english is bad and if your not familiar with S-ice and such
    you can skip all this

    Background:

    AM&#39;s Softice detection is quite simple. It tries to open a file like "&#092;&#092;.&#092;SICE", "&#092;&#092;.&#092;NTICE", etc and exits if success. So simply use Yoda&#39;s HOKO and you can play with SoftIce as you like.
    I needed PTRW 2000 / WinMe because it makes a correct dump, which I wasn&#39;t able (I didnt&#39; try hard to make
    under NT/2k with Sice - addins.


    1). Method of finding our entrypoint:
    * under nt/2k, launch hoko (use CreateFileA hook and ret -1 if "&#092;&#092;.&#092;NTICE" on CreateFileA)
    * launch the AM protected game, wait 1-3 seconds, press ctrl-d, then search for the following pattern in memory :
    if you cant find it, g and wait another second, then ctrl-d again. It is there, believe me.

    L0 lea edi, [esi + ...]
    L1 mov eax, [edi]
    L2 or eax, eax
    L3 jnz XXX

    i.e. s 400000 L -1 8B, 07, 09, C0, 74

    OK. note the above instruction, is something like lea edi, [esi + ...]
    because this will be our new entry point.

    now boot in w9x, load the .exe in PTRW, bpx at L0, and go.
    we will receive a break due to our bpx @ L0

    (Here I should tell you that even you make the perfect dump at this point, it won&#39;t work because:
    a) - the .exe already loaded &LoadLibraryA and &GetProcAddress somewhere in memory, making our crack OS-dependant);
    B) - you need to skip 2 more checks (2 JMPs);
    c) - the game is reading itself, so because our dump is different than the original exe, another error will occur.

    you will learn to avoid all these problems in a sec.


    for the point c). we will be loading at L0 a little DLL, am.dll, which will overwrite LoadLibraryA and GetProcAddress (at loadtime) in the game (their locations are found very easy :
    scroll down the code, you will see a call to [esi + ...] just a few lines below, notice the address on a
    paper, I call them LLA. The GPA (GetProcAddress) is just after the LLA. Also note the values of the ESI and EDI registers, as when the EIP will be "L1". (i.e LEA EDI, ... is executed)
    (ESI is always 401000, EDI is 401000 + some_value)


    so, we will write a little stub. Search down the code, you will notice that we have plenty of space (0s) just
    after this kind of jump, at L6...
    L4 POPAD
    L5 JMP ep
    L6 db 0, 0, 0, 0,... (lots of them, cant miss&#39;em

    so, we&#39;ll jump at L6, make a call to loadlibrary, then jump back, then dump the exe.

    at L0: overwrite with :
    NOP 90
    JMP L6 ; (E9 XX XX XX XX)


    at L6:
    CALL &#036;+7 ; (E8 07 00 00 00)
    db &#39;am.dll&#39;, 0 ; (7 bytes)
    mov edx, @LLA ; address of LoadLibraryA you&#39;ve noted before
    call edx ; the stack is already with &#39;am.dll&#39; on it
    ; return to host
    pushad
    mov esi, 401000 ; (BE 00 10 40 00) (prev. noted value)
    mov edi, ... ; (BF xx xx xx xx) (prev. noted value)
    JMP L1


    ok, now is time to fix the point B). i.e. get rid of the subsequent AM checks.

    search in memory for the address of the following
    AS1 = "ActiveMark Client engine could not find a valid volume."
    AS2 = "Unable to start ActiveMark Client engine due to an internal error."

    ok, now search in memory for instructions : "PUSH AS1" and "PUSH AS2", (they appear only once)
    and look just before. Sometimes there is a simple JNZ or JZ instruction, sometimes it takes a
    little bit of effort but this is it : you just have to avoid (with a simple JMP) getting here.
    (shouldnt&#39; take you more than 5 minutes of debugging).


    ok, now everything is set, just "pedump dump.exe", and go
    the game should not crash, if we did it right.

    Now, boot again in nt/w2k, make a quick tool that will scan dump.exe for "KERNEL32.DLL" (case sensitive)
    where we find a PE import section. (a routine is presented below)

    and fix the imports just before it...

    ---------------------------------------------
    Now, all we need is our injected DLL, "am.dll"

    the scope of this DLL is to check if the game tries to open itself, and present him with the
    original exe if so .

    For this you could also use Yoda&#39;s HOKO. (great tool, too bad its for money)


    This am.dll presented here is configurable, meaning am_hooks.dll will have 4x2 bytes containing the
    addresses of LoadLibraryA and GetProcAddress in the game. Quick and DIRTY :

    With this, move the original game xxxx.exe into xxxx.ex_, copy the dumped.exe as xxxx.exe,
    compile & copy the am.dll into the game dir, fix the imports on the dumped.exe, edit am_hooks.bin
    and enter the addresses of LoadLibraryA and GetProcAddress, and there you go, launch the exe
    and it will go. No more AM.

    If something goes wrong, you will have to figure out for yourself


    ---------------------------------------------------------------

    // am.cpp : Defines the entry point for the DLL application.
    //

    #include


    typedef HANDLE WINAPI _LoadLibraryA_t
    (
    LPCTSTR lpLibraryName
    );


    typedef HANDLE WINAPI _GetProcAddress_t
    (
    HMODULE hModule,
    LPCTSTR lpFunctionName
    );


    typedef HANDLE WINAPI _CreateFile_t(
    LPSTR lpFileName,
    DWORD dwDesiredAccess,
    DWORD dwShareMode,
    LPSECURITY_ATTRIBUTES lpSecurityAttributes,
    DWORD dwCreationDisposition,
    DWORD dwFlagsAndAttributes,
    HANDLE hTemplateFile
    );

    static char g_szGame[MAX_PATH + 1];
    static long g_szGameLen = 0;
    static char* g_szHooksPointersFile = "am_hooks.bin";


    DWORD g_pfnCreateFile_ORIG = 0;
    DWORD g_pfnLoadLibraryA_ORIG = 0;
    DWORD g_pfnGetProcAddress_ORIG = 0;

    DWORD g_bLoadingKernel32 = FALSE;


    HANDLE WINAPI xCreateFile(LPSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, HANDLE hTemplateFile);
    HANDLE WINAPI xLLA(LPCTSTR lpLibraryName);
    HANDLE WINAPI xGPA(HMODULE hModule, LPCTSTR lpFunctionName);



    void FixPointers()
    {

    DWORD dwDummy;
    DWORD dwLLA = 0;
    DWORD dwGPA = 0;


    HANDLE hFile = CreateFile(g_szHooksPointersFile,
    GENERIC_READ,
    FILE_SHARE_READ,
    NULL,
    OPEN_EXISTING,
    FILE_ATTRIBUTE_NORMAL,
    NULL);

    if (INVALID_HANDLE_VALUE &#33;= hFile)
    {
    ReadFile(hFile, &dwLLA, 4, &dwDummy, NULL);
    ReadFile(hFile, &dwGPA, 4, &dwDummy, NULL);
    CloseHandle(hFile);

    *((DWORD*)dwLLA) = (DWORD)xLLA;
    *((DWORD*)dwGPA) = (DWORD)xGPA;

    }
    }


    BOOL APIENTRY DllMain( HANDLE hModule,
    DWORD ul_reason_for_call,
    LPVOID lpReserved
    )
    {

    switch (ul_reason_for_call)
    {
    case DLL_PROCESS_ATTACH:

    // initialize the pointers
    g_pfnCreateFile_ORIG = (DWORD)CreateFileA;
    g_pfnLoadLibraryA_ORIG = (DWORD)LoadLibraryA;
    g_pfnGetProcAddress_ORIG = (DWORD)GetProcAddress;
    g_szGame[0] = &#39;&#092;0&#39;;

    // Get self name
    g_szGameLen = GetModuleFileName(GetModuleHandle(NULL), g_szGame, MAX_PATH);

    // mark pointers in the game

    FixPointers();
    break;

    case DLL_PROCESS_DETACH:
    break;
    }

    return TRUE;
    }


    HANDLE WINAPI xLLA(LPCTSTR lpLibraryName)
    {
    long k, nLen;
    for (k = nLen = 0; &#33;IsBadReadPtr(&lpLibraryName[k], 1) && lpLibraryName[k] &#33;= &#39;&#092;0&#39;; k++)
    nLen++;

    if (nLen == 12)
    {
    if (lpLibraryName[0] | 0x20 == &#39;k&#39; &&
    lpLibraryName[1] | 0x20 == &#39;e&#39; &&
    lpLibraryName[2] | 0x20 == &#39;r&#39; &&
    lpLibraryName[3] | 0x20 == &#39;n&#39; &&
    lpLibraryName[4] | 0x20 == &#39;e&#39; &&
    lpLibraryName[5] | 0x20 == &#39;l&#39; &&
    lpLibraryName[6] | 0x20 == &#39;3&#39; &&
    lpLibraryName[7] | 0x20 == &#39;2&#39; &&
    lpLibraryName[8] | 0x20 == &#39;.&#39; &&
    lpLibraryName[9] | 0x20 == &#39;d&#39; &&
    lpLibraryName[10] | 0x20 == &#39;l&#39; &&
    lpLibraryName[11] | 0x20 == &#39;l&#39
    {
    g_bLoadingKernel32 = 1;
    }
    else
    {
    g_bLoadingKernel32 = 0;
    }
    }

    _LoadLibraryA_t* pfnMyLoadLibraryA = (_LoadLibraryA_t*)g_pfnLoadLibraryA_ORIG;
    return (*pfnMyLoadLibraryA)(lpLibraryName);

    }

    HANDLE WINAPI xGPA(HMODULE hModule, LPCTSTR lpFunctionName)
    {
    if (g_bLoadingKernel32)
    {
    long k, nLen;
    for (k = nLen = 0; &#33;IsBadReadPtr(&lpFunctionName[k], 1) && lpFunctionName[k] &#33;= &#39;&#092;0&#39;; k++)
    nLen++;

    if (11 == nLen)
    {
    if ((lpFunctionName[0] | 0x20) == &#39;c&#39; &&
    (lpFunctionName[1] | 0x20) == &#39;r&#39; &&
    (lpFunctionName[2] | 0x20) == &#39;e&#39; &&
    (lpFunctionName[3] | 0x20) == &#39;a&#39; &&
    (lpFunctionName[4] | 0x20) == &#39;t&#39; &&
    (lpFunctionName[5] | 0x20) == &#39;e&#39; &&
    (lpFunctionName[6] | 0x20) == &#39;f&#39; &&
    (lpFunctionName[7] | 0x20) == &#39;i&#39; &&
    (lpFunctionName[8] | 0x20) == &#39;l&#39; &&
    (lpFunctionName[9] | 0x20) == &#39;e&#39; &&
    (lpFunctionName[10] | 0x20) == &#39;a&#39
    {
    return xCreateFile;
    }
    }
    }

    _GetProcAddress_t* pfnMyGetProcAddress = (_GetProcAddress_t*)g_pfnGetProcAddress_ORIG;
    return (*pfnMyGetProcAddress)(hModule, lpFunctionName);
    }


    HANDLE WINAPI xCreateFile(LPSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, HANDLE hTemplateFile)
    {

    if (IsBadReadPtr(lpFileName, 1))
    return INVALID_HANDLE_VALUE;

    long k, nLen;
    for (k = nLen = 0; lpFileName[k] &#33;= &#39;&#092;0&#39;; k++)
    nLen++;

    if (g_szGameLen == nLen)
    {
    for (k = 0; k < nLen; k++)
    {
    if ((lpFileName[k] | 0x20) &#33;= (g_szGame[k] | 0x20))
    break;
    }

    if (k == nLen)
    {
    lpFileName[k -1] = &#39;_&#39;;
    }
    }

    _CreateFile_t* pfnMyCreateFile = (_CreateFile_t*)g_pfnCreateFile_ORIG;

    return (*pfnMyCreateFile)(lpFileName,
    dwDesiredAccess,
    dwShareMode,
    lpSecurityAttributes,
    dwCreationDisposition,
    dwFlagsAndAttributes,
    hTemplateFile);
    }
    ---------------------------------------------------------------


    and the "optimised", DIRTY too, routine for fixing imports :


    bool FixImports(char* pszFileName)
    {
    CString strOrigGame = CString(pszFileName);
    char* szFileName = (LPSTR)(LPCSTR)strOrigGame;

    HANDLE hFile = CreateFile(szFileName,
    GENERIC_READ,
    FILE_SHARE_READ,
    NULL,
    OPEN_EXISTING,
    FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN,
    NULL);

    if (INVALID_HANDLE_VALUE == hFile)
    {
    return false;
    }

    DWORD dwDummy;
    DWORD dwSize = GetFileSize(hFile, &dwDummy);


    HANDLE hMap = CreateFileMapping(hFile, NULL, PAGE_READONLY, 0, dwSize, "__KRNL32OFFS_SCAN2");
    if (&#33;hMap)
    {
    printf("CreateFileMapping failed&#092;n");
    }


    DWORD* pMapMem = (DWORD*)MapViewOfFile(hMap, FILE_MAP_READ, 0, 0, 0);
    ULONG _bFound = 0;
    ULONG _nOffset = 0;
    if (pMapMem)
    {
    __asm
    {
    cld

    mov _bFound, 0

    mov ecx, dwSize
    shr ecx, 2
    mov edi, pMapMem

    _loop:
    mov eax, 0x4e52454b // &#39;KERN&#39;
    repnz scasd
    cmp ecx, 0
    jnz _found1
    jmp _notfound

    _found1: cmp [edi], 0x32334c45 // &#39;EL32&#39;
    jz _found2
    jmp _notfound

    _found2: cmp [edi + 4], 0x4c4c442e // &#39;.DLL&#39;
    jnz _notfound

    inc ecx
    shl ecx, 2
    mov eax, dwSize
    and eax, 0xfffffffc
    sub eax, ecx
    mov _nOffset, eax
    jmp _done

    _notfound:
    cmp ecx, 8
    ja _loop

    _done:
    }

    }
    else
    {
    return false;
    }

    UnmapViewOfFile(pMapMem);


    DWORD dwAddressOffset = _nOffset - 0x70;
    CloseHandle(hMap);
    CloseHandle(hFile);




    char buff[512];
    char libbuff[1024];
    GetSystemDirectory(buff, 512);


    DWORD a[24];
    HINSTANCE h;
    memset(a, 0, 24 * sizeof(DWORD));

    a[0] = (DWORD)LoadLibrary;
    a[1] = (DWORD)GetProcAddress;
    a[2] = (DWORD)ExitProcess;

    a[4] = (DWORD)RegCloseKey;

    strcpy(libbuff, buff);
    strcat(libbuff, "&#092;&#092;comdlg32.dll");
    h = LoadLibrary(libbuff);
    if (h)
    {
    a[6] = (DWORD)GetProcAddress(h, "PrintDlgA");;
    FreeLibrary(h);
    }

    strcpy(libbuff, buff);
    strcat(libbuff, "&#092;&#092;crypt32.dll");
    h = LoadLibrary(libbuff);
    if (h)
    {
    a[8] = (DWORD)GetProcAddress(h, "CertOpenStore");;
    FreeLibrary(h);
    }

    a[10] = (DWORD):PtoLP;

    strcpy(libbuff, buff);
    strcat(libbuff, "&#092;&#092;netapi32.dll");
    h = LoadLibrary(libbuff);
    if (h)
    {
    a[12] = (DWORD)GetProcAddress(h, "Netbios");
    FreeLibrary(h);
    }
    a[14] = (DWORD)CoInitialize;
    a[16] = (DWORD)ExtractIconA;
    a[18] = (DWORD)::GetDC;

    strcpy(libbuff, buff);
    strcat(libbuff, "&#092;&#092;wininet.dll");
    h = LoadLibrary(libbuff);
    if (h)
    {
    a[20] = (DWORD)GetProcAddress(h, "InternetOpenA");;
    FreeLibrary(h);
    }

    strcpy(libbuff, buff);
    strcat(libbuff, "&#092;&#092;winmm.dll");
    h = LoadLibrary(libbuff);
    if (h)
    {
    a[22] = (DWORD)GetProcAddress(h, "joyGetPos");;
    FreeLibrary(h);
    }


    CFile f;
    if (f.Open(strOrigGame, CFile::modeReadWrite))
    {
    f.Seek(dwAddressOffset, CFile::begin);
    f.Write(a, 24 * sizeof(DWORD));
    f.Close();
    }
    else
    {
    return false;
    }


    return true;
    }

  7. File Sharing   -   #27
    if someone here successfully unpacked kazaa can please host it somewere. I really want to edit out some of shareman crap.

  8. File Sharing   -   #28
    FvKin GeniuS :D
    Join Date
    Mar 2003
    Age
    35
    Posts
    1,597
    Yes It does help
    Board rule: max 500x150 Pixels (w x h)

    https://filesharingtalk.com/sigs/albegaleeeee.jpg

  9. File Sharing   -   #29
    Poster
    Join Date
    Jun 2003
    Location
    England
    Posts
    1,377
    C&#39;mon someone just send me the god dam file .

    Ferasso/ RN, can you put it on some webpace for us please?

  10. File Sharing   -   #30
    Originally posted by Ferasso@28 November 2003 - 16:54
    Open kazaa.exe in hex editor, go to offset 12FACC, there you will find a byte BB, and change it to CC. Save and to into SICE and:
    bpint 03
    Run the file, Sice breaks.
    e eip bb
    bc*
    bpmb 576E71 x
    F5

    Wait... sice breaks
    a eip
    jmp eip
    nop
    enter
    F5

    Go into lord PE, fully dump kazaa, then kill task.
    Open it in PE editor, set the entry point to 176E71
    Save. Open it in hex editor, find EBFE90 and replace with 558BEC. Done.
    Unpacked succesfully with this trick, but I have fixed the import table with ImportREC. After that, the file didn&#39;t run successfully. But I&#39;m sure that ImportREC has fixed the hole import table, &#39;cos in the screen, there wasn&#39;t unresolved item in the import table list. Where did I make a mistake?

Page 3 of 5 FirstFirst 12345 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •