home *** CD-ROM | disk | FTP | other *** search
/ Cracking 2 / Cracking II..iso / Texty / crackme / firecm#6.asm < prev    next >
Encoding:
Assembly Source File  |  1999-06-16  |  5.0 KB  |  174 lines

  1. ; fireworx crackme #6 keygen by R!SC , 16/6/99
  2.  
  3. ; heya wizzkid!  :P
  4.  
  5. ; not a byte wasted, 406 bytes keygen for a 303kb crackme :O
  6.  
  7. .MODEL TINY
  8. .CODE
  9. .386
  10. ORG 100h
  11.  
  12. start:  jmp main
  13.  
  14.         db  'R!SC '
  15.  
  16. main:
  17.         
  18.         mov     ah, 9           ; print title
  19.         lea     dx, intro       ; dx with offset ov text
  20.         int     21h
  21.         lea     dx, input
  22.         mov     ah, 0ah
  23.         int     21h
  24.         
  25.         mov     al, byte ptr [input+1]     ; copy length into eax...
  26.         cmp     al, 1                      ; is it less than 1?
  27.         jge     go
  28.         
  29. badname:      
  30.         mov     ax, 4C00h   ; Exit 
  31.         int     21h
  32.  
  33. go:     ; start_conversion_of_name
  34.  
  35.         int 03  ; incase ya wanna bpint 3 in soft-ice and trace..
  36.  
  37.         lea     si, input2          ; name in si (instead of edi..)
  38.         xor     edx, edx
  39.         xor     ecx, ecx
  40.         mov     ebx, 49390305h      ; magic number #1
  41.         mov     edi, 48631220h      ; magic number #2
  42.         
  43. main_loop:
  44.         mov     cl, [si]
  45.         xor     ebx, ecx
  46.         xor     edi, ebx            ; do the maths that we borrowed
  47.         test    bl, 01
  48.         je      loc44173b
  49.         sar     ebx, 1
  50.         jns     loc441733
  51.         adc     ebx, 0
  52. loc441733:
  53.         xor     ebx,01200311h
  54.         jmp     done_1
  55. loc44173b:
  56.         sar     ebx, 1
  57.         jns     done_1
  58.         adc     ebx, 0              ; replicated byte for byte :) (almost..)
  59. done_1:
  60.         inc     si      ; point to next letter
  61.         dec     al      ; decrease counter
  62.         jne     main_loop
  63.  
  64.  
  65. ; sorted, keygen over, just gotta convert our serial into ascii :O
  66.  
  67.         
  68. ;:?ebx
  69. ;054F923B  0089100859  "OÆ;"
  70. ;:?esi
  71. ;3FC7F3B6  1070068662  "?╟≤╢"
  72.  
  73. ;my code, 923B-054F-F3B6-3FC7 
  74.  
  75. ;fix the numbers (copy words into proper locations..)
  76.  
  77.         mov [reg1], bx
  78.         sar ebx, 10h    ; shift ebx 16 bits right, 2 bytes..
  79.         mov [reg2], bx
  80.         mov [reg3], di
  81.         sar edi, 10h
  82.         mov [reg4], di
  83.         
  84.         
  85. convert_reg:    ; convert the hex words to ascii hex, and add the '-'
  86.  
  87.         lea     si, tempregend-1    ; temp storing place, starting from the end
  88.         mov     ax, [reg4]          ; start with reg4, and we calculate it backwards
  89.         call    loopy_hex
  90.         mov     ax, [reg3]
  91.         call    loopy_hex
  92.         mov     ax, [reg2]
  93.         call    loopy_hex
  94.         mov     ax, [reg1]
  95.         call    loopy_hex
  96.  
  97.  conversion_done:        
  98.         inc     si                 ; point to first digit..
  99.         inc     si
  100.         lea     di, regcode        ; where to copy it to
  101.  copy_number:
  102.         movsb                      ; copy it, byte by byte
  103.         cmp     byte ptr [si],0    ; see if we have finished
  104.         jne     copy_number        ; if not, loop
  105.  
  106.         mov     ah, 9           ; print code
  107.         lea     dx, code        ; dx with offset ov text
  108.         int     21h
  109.  
  110.         mov     ax, 4C00h       ; All Done And Exit 
  111.         int     21h
  112.  
  113.         
  114. loopy_hex:
  115.         mov     dl, 02
  116. hehheh:
  117.  
  118.         mov     bl, al          ; copy 1 byte into bl
  119.     
  120.         and     bl, 0fh         ; clear high nibble
  121.         add     bl, 030h        ; 30h is ascii '0'
  122.         cmp     bl, 39h         ; is it < ascii '9'
  123.         jle     oki1
  124.         add     bl, 7           ; if not, it was a letter, so add 7 to get ascii 41h='A'
  125.         mov     byte ptr [si], bl
  126.         dec     si
  127.         jmp     hmmm
  128. oki1:
  129.         mov     byte ptr [si], bl
  130.         dec     si
  131. hmmm:
  132.         mov     bl, al          ; copy same byte into bl
  133.  
  134.         shr     bl, 04          ; shift it right 4 bits, so we are left with the high nibble
  135.         add     bl, 030h
  136.         cmp     bl, 39h
  137.         jle     oki2
  138.  
  139.         add     bl, 7
  140.         mov     byte ptr [si], bl
  141.         dec     si
  142.         jmp     hmmm2
  143. oki2:
  144.         mov     byte ptr [si], bl
  145.         dec     si
  146. hmmm2:
  147.         shr     ax, 08         ; get to the next byte in ax...
  148.         dec     dl
  149.         jne     hehheh
  150.         mov     byte ptr [si], '-'   ; add the '-' manually
  151.         dec     si
  152.         ret
  153. ;_______________________________________________________________
  154.  
  155.     intro       db 10,13, 'FireWorx Crackme #6 ** kEYGEN bY R!SC ** risc@notme.com **',10
  156.                 db 10,13, 'eNTER yOUR nAME : ', '$'
  157.     
  158.     code        db 10,13, 'yOUR rEGCODE iS : '
  159.     regcode     db 20 dup(20h)
  160.     regend      db '$'
  161.     
  162.     tempreg     db 20 dup (?)   ; temp storing place for the code, as we convert it into ascii
  163.     tempregend  db 0
  164.     
  165.     reg1        dw  ?       ; yah, contains part 1 of the reg code
  166.     reg2        dw  ?       ; yah, contains part 2...
  167.     reg3        dw  ?
  168.     reg4        dw  ?       ; but they need converting to hexdecimal ASCii
  169.     
  170.     input       db 30, 0    ; first byte, size of buffer, second byte will become our length of input
  171.     input2      db 30 dup(?)    ; where the name will be input     
  172. ;_______________________________________________________________
  173.   end    start
  174.