home *** CD-ROM | disk | FTP | other *** search
/ Cracking 2 / Cracking II..iso / Texty / crackme / exec.asm < prev    next >
Encoding:
Assembly Source File  |  1999-06-26  |  10.1 KB  |  442 lines

  1. ; R!SC's dodgy win32asm keygen for deaths execution trial crackme..
  2. ; probably not possible without Duelist giving me a serial for his name..
  3. ; (deffinatly not possible, as i had given up.. heh..)
  4.  
  5. .386P
  6. Locals
  7. jumps
  8.  
  9. include tiny_win32.inc
  10.  
  11. .Model Flat, StdCall
  12.  
  13. .Data
  14.  
  15. caption   db "http://csir.cjb.net  http://beam.to/evc",0  ; about box
  16.  
  17. box_1_text   db "R!SC",0
  18.  
  19. blank2  db " enter more characters ",0
  20. buffer1 db  82h dup (0)
  21.  
  22. about   db '   Execution 1999 Trial Crackme ** kEYGEN #7 bY R!SC ** risc@notme.com **',10,13
  23.         db '      special greetings to the best cracker i know, Duelist, who could reverse',10,13
  24.         db '       a bubble car if he wanted. without him and his cryptic clues, this would',10,13
  25.         db ' have remained half a keygen, but when he showed me the "dash" i saw the light',0  ;)
  26.  
  27. msg     MSGSTRUCT   <?>
  28. wc      WNDCLASS    <?>
  29. hIce    dd 0
  30. _one    dd 100h dup (0)
  31. _two    dd 100h dup (0)
  32.  
  33. regcode     db 25 dup (0)
  34. regend      db 0
  35. tempreg     db 40h dup (0)
  36. tempregend  db 0
  37.  
  38. my_table    dd 80h dup (0)
  39. my_counter  dd  0
  40. signed_     db  0
  41.     
  42. ;----------------------------------------------------------------------------------------------
  43.  
  44. .Code
  45.  
  46. main:
  47.     jmp     boring  ; do all the windows stuff
  48.  
  49.     
  50. getit:          ; begin keygen code :) hahaha
  51.                 ; this bit is executed when
  52.                 ; cmp   word ptr [wparam],IDD_BOX1  ; box 1 iD
  53.                 ; is equal...(and when dialog is initialised)
  54.  
  55.     lea     ecx, buffer1    ; [ebp-84h]
  56.     push    080             ; size of buffer
  57.     push    ecx             ; offset buffer1  ; buffer
  58.     push    IDD_BOX1        ; what box to snatch the text from
  59.     push    hwnd            ; our dialog handle
  60.     call    GetDlgItemTextA ; do it
  61. setit:
  62.     cmp     eax, 02         ; eax=length of text
  63.     jl      blank_box2      ; less than 1 character, put a message in box 2
  64.     mov     ebx,eax
  65.     mov     edi,ebx
  66.     mov     dword ptr [my_counter],0
  67.  
  68. PUSH    00313373h
  69. LEA     EDX, _one  ; addr of lookup table #1
  70. PUSH    EDX
  71. CALL    magictable
  72.   ;  int 03
  73. TEST    EBX,EBX       ; ebx=name length
  74. ;JZ      00401209
  75. blagit:
  76.  
  77.  DEC     EBX
  78.  MOVSX   ECX,BYTE PTR [EBX+_one]    ; get magic number
  79.  IMUL    ECX,EBX
  80.  PUSH    ECX
  81.  LEA     EAX,_two ;[EBP-0204h]                 ; use it to create another kewl lookup table
  82.  PUSH    EAX
  83.  CALL    magictable
  84.  MOVSX   EDX,BYTE PTR [EBX+buffer1]    ; ebp-84 = name max length 80h
  85.  MOVSX   ECX,BYTE PTR [EDX+_two] ;EBP-0204h]    ; more magic numbers
  86.  IMUL    EDI,ECX                        ; multiply ascii value of name, with magic number
  87.  MOV     ECX,EBX
  88.  AND     ECX,03
  89.  INC     ECX
  90.  MOV     EAX,EDI
  91.  XOR     EDX,EDX
  92.  DIV     ECX
  93.  MOV     EDI,EAX
  94.  LEA     EAX, buffer1     ; name
  95.  PUSH    EAX
  96.  CALL    getlength           ; get length
  97.  POP     ECX
  98.  SUB     EAX,EBX
  99.  MOVSX   EDX,BYTE PTR [EAX+buffer1-1]
  100.  MOVSX   ECX,BYTE PTR [EDX+_two] ;EBP-0204h]
  101.  SUB     EDI,ECX
  102.  push esi
  103.  push eax
  104.  lea    esi, my_table
  105.  mov    eax, dword ptr [my_counter]
  106.  imul   eax,  4
  107.  add    esi,eax
  108.  mov    [esi],edi
  109.  inc    dword ptr [my_counter]
  110.  pop    eax
  111.  pop    esi
  112.  ;XOR     [EBP-04],EDI       ; our value
  113.  TEST    EBX,EBX
  114.  JNZ     blagit
  115.  
  116.  xor    ecx,ecx
  117.  dec    dword ptr [my_counter]
  118.  mov    ebx, dword ptr [my_counter]
  119.  dec    ebx
  120.  ;jz     fuckitsdone            ; REMOVED THIS TO FIX '2' CHARACTER SERIAL VALUES
  121. workbaby:
  122.  mov    eax,ebx
  123.  imul   eax, 4
  124.  lea    esi, my_table
  125.  add    esi,eax
  126.  mov    eax, dword ptr [esi]
  127.  xor    ecx,eax
  128.  dec    ebx
  129.  jns    workbaby
  130.  
  131.     mov eax,ecx
  132.     mov byte ptr [signed_],0    ; NEW 
  133.     test    eax,eax
  134.     jns  fuckitsdone            ; MODIFIED
  135.     neg  eax                    ; IF ITS NEGATIVE, REVERSE IT, AND SET A FLAG
  136.     inc byte ptr [signed_]      ; SO AFTER ASCII CONVERSION, I KNOW TO ADD A '-'
  137. fuckitsdone:
  138.  jmp    convertit
  139.     
  140. magictable:
  141. loc00AB112C:
  142. PUSH    EBP
  143. MOV     EBP,ESP
  144. PUSH    EBX
  145. PUSH    ESI
  146. PUSH    EDI
  147. MOV     ESI,[EBP+0Ch]
  148. MOV     EBX,[EBP+08]
  149. XOR     ECX,ECX
  150.  
  151. loc00AB113A:      
  152. MOV     EAX,ESI
  153. XOR     EAX,0BADC0DEh
  154. TEST    ECX,ECX
  155. JNZ     loc00AB114C
  156. MOV     EDX,00000100h
  157. JMP     loc00AB114E
  158.  
  159. loc00AB114C:
  160. MOV     EDX,ECX
  161.  
  162. loc00AB114E:
  163. MOV     EDI,EDX
  164. XOR     EDX,EDX
  165. DIV     EDI
  166. MOV     [ECX+EBX],DL
  167. MOV     AL,[ECX+EBX]
  168. ADD     EAX,EAX
  169. AND     AL,0FFh
  170. MOV     [ECX+EBX],AL
  171. MOVSX   EDX,BYTE PTR [ECX+EBX]
  172. IMUL    EDX,ECX
  173. XOR     ESI,EDX
  174. INC     ECX
  175. CMP     ECX,00000100h
  176. JB      loc00AB113A
  177. MOV     EAX,00000001
  178. POP     EDI
  179. POP     ESI
  180. POP     EBX
  181. POP     EBP
  182. RET     ;    0008
  183.  
  184. convertit:
  185.  
  186. convert_values:
  187.     lea     esi, tempregend-1   ; temp storing place, starting from the end
  188.     mov     edx, 4              ; 4 bytes to convert
  189. loopy_hex:
  190.     xor     ebx,ebx
  191.     mov     bl, al
  192.     movzx   ebx, bl
  193.     
  194.     and     bl, 0fh         ; clear high 4 bits..
  195.     add     bl, 030h        ; add 30h
  196.     cmp     bl, 39h         ; compare with ascii '9'
  197.     jle     oki1
  198.     add     bl, 7           ; if its > 9, add 7 to make it a ascii letter (A..F/41h..46h)
  199.     mov     byte ptr [esi], bl
  200.     dec     esi
  201.     jmp     hmmm
  202. oki1:
  203.     mov     byte ptr [esi], bl  ; save it
  204.     dec     esi                 ; ready esi for next one
  205. hmmm:
  206.     mov     bl, al
  207.     movzx   ebx, bl
  208.     shr     bl, 04      ; get high 4 bits..
  209.     add     bl, 030h
  210.     cmp     bl, 39h     ; is it > '9'
  211.     jle     oki2
  212.  
  213.     add     bl, 7       ; make it a letter
  214.     mov     byte ptr [esi], bl
  215.     dec     esi
  216.     jmp     hmmm2
  217. oki2:
  218.     mov     byte ptr [esi], bl  ; save it
  219.     dec     esi                 ; ready esi for next one
  220. hmmm2:
  221.     shr     eax, 08     ; ready al with next byte..
  222.     dec     edx
  223.     jnz     loopy_hex
  224.     cmp     byte ptr [signed_],0    ; CHECK IF ITS/WAS NEGATIVE
  225.     je      conversion_done
  226.     mov     byte ptr [esi],'-'      ; ADD DASH
  227.     dec     esi
  228.  
  229. conversion_done:        
  230.     inc esi                  ; point to first digit..(of ascii serial)
  231.     lea edi, regcode         ; where to copy it to
  232. copy_number:
  233.     movsb                    ; copy it, byte by byte
  234.     cmp    byte ptr [esi],0  ; see if we have finished
  235.     jnz copy_number          ; if not, loop
  236.     movsb
  237.  
  238.  
  239. print_code_into_box_2: 
  240.     push    offset regcode  ; ASCii serial
  241.     push    0
  242.     push    WM_SETTEXT      ; command
  243.     push    IDD_BOX2        ; what box?
  244.     push    hwnd            ; dialog handle
  245.     call    SendDlgItemMessageA
  246.     mov     eax, 1
  247.     jmp     main_finish     ; DONE!
  248.  
  249. getlength:
  250.     push esi
  251.     mov esi,eax
  252.     push    esi
  253.     cmp     byte ptr [esi],0
  254.     je      _null@
  255. length1:
  256.     inc     esi
  257.     cmp     byte ptr [esi],0
  258.     jnz     length1
  259. _null@:
  260.     lea     eax, dword ptr [esi]
  261.     pop     esi
  262.     sub     eax,esi
  263.     pop     esi
  264.     ret
  265.  
  266. convert_eax_to_ascii_dec:
  267.     pushad
  268.     xor     ebx,ebx
  269.     mov     cx,10
  270. dec_loop:
  271.     shl     ebx, 8
  272.     xor     dx,dx
  273.     div     cx
  274.     add     dl,030h
  275.     mov     bl,dl
  276.  
  277.     test    ax,ax
  278.     jne     dec_loop
  279.     
  280.     lea     esi, tempreg
  281.     call    getlength
  282.     add     esi,eax
  283.  
  284. fix_@1:
  285.     mov     byte ptr [esi],bl
  286.     inc     esi
  287.     ror     ebx,08
  288.     test    bl,bl
  289.     jne     fix_@1
  290.     mov     byte ptr [esi],0
  291.     popad
  292.     ret
  293.     
  294.     
  295. blank_box2:
  296.     push    offset blank2   ; oh, less than 1 character
  297.     push    0
  298.     push    WM_SETTEXT
  299.     push    IDD_BOX2
  300.     push    hwnd
  301.     call    SendDlgItemMessageA
  302.     mov     eax, 1
  303.     jmp     main_finish
  304.  
  305. ;----------------------------------------------------------------------------------------------
  306.  
  307. boring:             ; boring code, windows stuff
  308.     push    0
  309.     call    GetModuleHandleA
  310.     mov     [hIce], eax
  311.  
  312.     mov     [wc.clsStyle], CS_HREDRAW + CS_VREDRAW + CS_GLOBALCLASS
  313.     mov     [wc.clsLpfnWndProc], offset WndProc
  314.     mov     [wc.clsCbClsExtra], 0
  315.     mov     [wc.clsCbWndExtra], 0
  316.     
  317.     mov     eax, [hIce]
  318.     mov     [wc.clsHInstance], eax
  319.  
  320.     push    0              
  321.     push    offset Main_DlgProc    
  322.     push    0
  323.     push    IDD_DLG
  324.     push    [hIce]
  325.     call    DialogBoxParamA
  326.     jmp     finish
  327.  
  328.         
  329. Main_DlgProc proc hwnd:DWORD, wmsg:DWORD, wparam:DWORD, lparam:DWORD
  330.  
  331.     push    ebx
  332.     push    esi
  333.     push    edi
  334.  
  335.     cmp     [wmsg], WM_COMMAND      ; is the message a command?
  336.     jz      main_command
  337.     cmp     [wmsg], WM_INITDIALOG   ; has the box been initialised?
  338.     jz      main_init
  339.     cmp     [wmsg], WM_CLOSE        ; was close pressed?
  340.     jz      main_dlgdestroy
  341.     mov     eax, 0
  342.  
  343. main_finish:
  344.  
  345.     pop     edi
  346.     pop     esi
  347.     pop     ebx
  348.     ret
  349.  
  350.  
  351. msg_loop:
  352.  
  353.     push    0
  354.     push    0
  355.     push    0
  356.     push    offset msg
  357.     call    GetMessageA
  358.  
  359.     cmp     ax, 0
  360.     jz      end_loop
  361.  
  362.     push    offset msg
  363.     call    TranslateMessage
  364.  
  365.     push    offset msg
  366.     call    DispatchMessageA
  367.  
  368.     jmp     msg_loop
  369.  
  370. end_loop:
  371.  
  372.     push    [msg.msWPARAM]
  373.     call    ExitProcess
  374.  
  375. Main_DlgProc    endp
  376.  
  377.  
  378.  
  379. WndProc proc hwnd:DWORD, wmsg:DWORD, wparam:DWORD, lparam:DWORD
  380.     push    esi
  381.     push    edi
  382.     push    ebx
  383.  
  384. defwndproc:
  385.  
  386.     push    [lparam]
  387.     push    [wparam]
  388.     push    [wmsg]
  389.     push    [hwnd]
  390.     call    DefWindowProcA
  391.  
  392. finish:
  393.  
  394.     pop     ebx
  395.     pop     edi
  396.     pop     esi
  397.     ret
  398.  
  399. WndProc          endp
  400.  
  401.  
  402.  
  403. main_abt:           ; about messagebox...
  404.     
  405.     push    0
  406.     push    offset caption
  407.     push    offset about
  408.     push    0
  409.     call    MessageBoxA
  410.     mov     eax, 1
  411.     jmp     main_finish
  412.  
  413.     
  414. main_init:          ; initialise dialog text
  415.     
  416.     push    offset box_1_text
  417.     push    0
  418.     push    WM_SETTEXT
  419.     push    IDD_BOX1
  420.     push    hwnd
  421.     call    SendDlgItemMessageA
  422.  
  423.     jmp     getit   ; getit, get text in box 1, and creates serial from it
  424.  
  425.  
  426. main_command:
  427.  
  428.     cmp     [wparam], IDD_ABT           ; about button iD
  429.     jz      main_abt
  430.     cmp     word ptr [wparam],IDD_BOX1  ; box 1 iD
  431.     jz      getit
  432.     cmp     [wparam], IDD_EXIT          ; quit button iD
  433.     jz      main_dlgdestroy
  434.  
  435.     mov     eax, 0
  436.     jmp     main_finish
  437.     
  438. main_dlgdestroy:
  439.  
  440.     call    ExitProcess
  441.  
  442. End main