home *** CD-ROM | disk | FTP | other *** search
/ Reverse Code Engineering RCE CD +sandman 2000 / ReverseCodeEngineeringRceCdsandman2000.iso / RCE / Quantico / km / ucf_ew1.asm.txt < prev    next >
Encoding:
Text File  |  2000-05-25  |  9.3 KB  |  326 lines

  1. .model  tiny
  2.  
  3. .386
  4.  
  5.         org 100h
  6.  
  7. .data
  8.  
  9. GroupLogo       DB '       EmailWolf Pro v1.00 *keygen*      ',10,13
  10.                 DB '──────────────| QUANTICO! |──────────────',10,13
  11.                 DB '  ▄▄▄   ▄▄▄    ▄▄▄▄▄▄▄▄▄    ▄▄▄▄▄▄▄▄▄    ',10,13         
  12.                 DB '  ███   ███    ███          ███▄▄▄       ',10,13         
  13.                 DB '  ███▄  ███    ███▄         ███          ',10,13         
  14.                 DB '  ▀▀▀▀▀▀▀▀▀    ▀▀▀▀▀▀▀▀▀    ▀▀▀          ',10,13         
  15.                 DB '─────────────────────────────────────────',10,13         
  16.                 DB 'u N I T E D  c R A C K I N G  f O R C E  ',10,13         
  17.                 DB '[wIN95/NT]─────────────────────[Sep 1998]',10,13
  18.                 db '                                 ',13,10,'$'
  19.  
  20.  
  21.  
  22. IntroMsgOne     db 13,10,'   [■]   EmailWolf Pro v1.00 - Key Generator by Quantico  [■]',13,10
  23.                 db '',13,10
  24.                 db 13,10,'   Enter a name        : ','$'
  25.            
  26. IntroMsgTwo     db 13,10,'   Enter a company     : ','$'
  27.  
  28.  
  29. ErrorMsg        db 13,10,'                     Need 5-20 digits, try again...',13,10,'$'
  30.  
  31. ShowCodeMsg     db 13,10,'                     Registration number : EP-'
  32.  
  33. CodeBuffer      db 10h dup(0),13,10,'$'
  34.  
  35. NameBuffer      db 18h, 50h dup(0)
  36.  
  37. Name4           db  4 dup(0),0h
  38.  
  39. Convert_Digs     db '0123456789ABCDEF'
  40.  
  41. EP              db 'EP',00h
  42.  
  43. namelength      db 0
  44.  
  45.  
  46.  
  47. .code
  48.  
  49. .startup
  50.  
  51. main    proc    near
  52.         mov     ah, 09h                       ;
  53.         lea     edx, GroupLogo                ;
  54.         int     21h                           ; show group logo
  55.  
  56.         mov     ah, 09h                       ;
  57.         lea     edx, IntroMsgOne              ;
  58.         int     21h                           ; show intro and ask for input 
  59.  
  60.         mov     bx, 1405h                     ; limits for string input
  61.         lea     edi, NameBuffer               ;
  62.         mov     esi, offset namelength
  63.         call    getstr                        ; read user input
  64.         jc      @error                        ;
  65.         xor     eax, eax                      ; clear eax
  66.  
  67.         call    keygen                        ; create serial number
  68.  
  69.         mov     ah, 09h                       ;
  70.         lea     dx, ShowCodeMsg               ;
  71.         int     21h                           ; print serial number
  72.         jmp     @exit                         ; finished, quit
  73. @error:
  74.         mov     ah, 09h
  75.         lea     dx, ErrorMsg
  76.         int     21h        
  77. @exit:
  78.         mov     al, 00h                       ;
  79.         mov     ah, 4Ch                       ;
  80.         int     21h                           ; terminate program
  81. main    endp
  82.  
  83. keygen  proc    near
  84.  
  85.         mov     esi, offset [NameBuffer+2]
  86.         mov     edi, offset [Name4]
  87.         mov     ecx, 04
  88.         rep     movsb
  89.  
  90.         mov     esi, offset EP
  91. @00410DB1:
  92.         xor     ecx, ecx
  93.         mov     dl, byte ptr [esi]
  94.         add     dl, 0Bh
  95. back5lines:
  96.         mov     al, byte ptr [Name4+ecx]
  97.         imul    dl
  98.         mov     byte ptr [Name4+ecx], al
  99.         inc     ecx
  100.         cmp     ecx, 04
  101.         jl      back5lines
  102.         mov     dl, byte ptr [esi+1]
  103.         inc     esi
  104.         test    dl, dl
  105.         jne     @00410DB1
  106.         
  107.         mov     edi, offset NameBuffer+2
  108.         mov     cl, byte ptr [edi]
  109.         test    cl, cl
  110.         je      @00410DED
  111.         mov     edx, edi
  112. @00410DD6:
  113.         xor     eax, eax
  114.         add     cl, 0Bh
  115. @00410DDB:
  116.         xor     byte ptr [Name4+eax], cl
  117.         inc     eax
  118.         cmp     eax, 04
  119.         jl      @00410DDB
  120.         mov     cl, byte ptr [edx+1]
  121.         inc     edx
  122.         test    cl, cl
  123.         jne     @00410DD6
  124. @00410DED:
  125.         mov     edx, dword ptr [Name4]
  126.         test    edx, edx
  127.         jge     @00410DF9
  128.         neg     edx
  129.         test    edx, edx
  130. @00410DF9:
  131.         jne     @00410E00
  132.         mov     edx, 01
  133. @00410E00:
  134.         cmp     edx, 270Fh
  135.         jge     @00410E15
  136. @00410E08:
  137.         lea     edx, dword ptr [edx+4*edx]
  138.         shl     edx, 1
  139.         cmp     edx, 270Fh
  140.         jl      @00410E08  
  141. @00410E15:
  142.         cmp     edx, 0F423Fh
  143.         jle     correct
  144. @00410E1D:       
  145.         mov     eax, 66666667h
  146.         imul    edx
  147.         sar     edx, 02
  148.         mov     eax, edx
  149.         shr     eax, 1Fh
  150.         add     edx, eax
  151.         cmp     edx, 0F423Fh
  152.         jg      @00410E1D
  153. correct:
  154.  
  155.         mov     eax, edx
  156.         mov     edi, offset CodeBuffer
  157.         mov     ecx, 0Ah
  158.         xor     edx, edx
  159.         call    Convert_Num
  160.  
  161.     ret
  162. keygen    endp
  163.  
  164.  
  165. ; get string from user
  166. ; input :
  167. ;       edi = pointer to buffer
  168. ;       bl  = min length
  169. ;       bh  = max length
  170. ; output :
  171. ;    CF error, cx number of bytes read
  172. getstr  proc    near
  173.         push    dx                            ; save dx
  174.         mov     dx, di                        ;
  175.         mov     ah, 0Ah                       ;
  176.         int     021h                          ; get user input
  177.  
  178.         movsx   ecx, byte ptr [edi + 1]       ; get number of digits
  179.  
  180.         mov     byte ptr [edi + ecx + 2], 00h
  181.  
  182.         cmp     cl, bh                        ; check maximum
  183.         jg      @@0
  184.         cmp     cl, bl                        ; check minimum
  185.         jl      @@0
  186.         mov     byte ptr [esi], cl            ; store length
  187.     xor    ch, ch
  188.         clc                                   ; clear CF
  189.         jmp     @@1
  190. @@0:
  191.         stc                                   ; set CF (carry flag)        
  192. @@1:
  193.         pop     dx                            ; restore dx
  194.     ret
  195. getstr  endp
  196.  
  197.  
  198.  
  199. Convert_Num proc near
  200.         pushf
  201.     pushAD
  202.  
  203.         sub     esp, 4
  204.         mov     ebp,esp
  205.  
  206.         cld
  207.         mov     esi, edi
  208.         push    esi
  209.  
  210. ;--- loop for each digit
  211.  
  212.         sub     bh, bh
  213.         mov     dword ptr [ebp], eax               ;save low word
  214.         mov     dword ptr [ebp+4], edx             ;save high word
  215.         sub     esi, esi                          ;count digits
  216.  
  217. Connum1:
  218.         inc     esi
  219.         mov     eax, dword ptr [ebp+4]             ;high word of value
  220.         sub     edx, edx                          ;clear for divide
  221.         sub    ebx, ebx
  222.         div     ecx                              ;divide, DX gets remainder
  223.         mov     dword ptr [ebp+4],eax             ;save quotient (new high word)
  224.  
  225.         mov     eax, dword ptr [ebp]               ;low word of value
  226.         div     ecx                              ;divide, DX gets remainder
  227.                                                 ;  (the digit)
  228.         mov     dword ptr [ebp], eax               ;save quotient (new low word)
  229.  
  230.         mov     bl, dl
  231.         mov     al, byte ptr [Convert_Digs+ebx]  ;get the digit
  232.         stosb                                   ;store
  233.  
  234.         cmp     dword ptr [ebp], 0                ;check if low word zero
  235.         jne     Connum1                         ;jump if not
  236.         cmp     dword ptr [ebp+4], 0              ;check if high word zero
  237.         jne     Connum1                         ;jump if not
  238.  
  239.         sub     al, al
  240.         stosb                                   ;store the terminator
  241.  
  242. ;--- reverse digits
  243.  
  244.         pop     ecx                              ;restore start of string
  245.         xchg    ecx, esi
  246.         shr     ecx, 1                           ;number of reverses
  247.         jz      Connum3                         ;jump if none
  248.  
  249.         xchg    edi, esi
  250.         sub     esi, 2                           ;point to last digit
  251.  
  252. Connum2 :
  253.         mov     al, byte ptr [edi]               ;load front character
  254.         xchg    al, byte ptr [esi]               ;swap with end character
  255.         stosb                                   ;store new front character
  256.         dec     esi                              ;back up
  257.         loopd   Connum2                         ;loop back for each digit
  258.  
  259. ;--- finished
  260.  
  261. Connum3  :
  262.         add     esp, 4
  263.  
  264.     popad
  265.         popf
  266.         ret
  267.  endp           ;Convert_Num
  268.  
  269. ; concatenate 2 strings
  270. ; input :
  271. ;       esi = string one, ecx = length string one
  272. ;       edi = string two, edx = length string two
  273. ; output :
  274. ;       esi = string one + string two, edx = new length
  275. cncstr  proc    near
  276.         xor     eax, eax                     ;
  277.         xor     ebp, ebp                     ; clear register
  278.  
  279.         push    esi                          ; save esi
  280.  
  281.         add     esi, ecx                     ; set esi at end of string one
  282.         add     ecx, edx                     ; adjust new length
  283. @cnc:
  284.         mov     al, byte ptr [edi + ebp]     ; get digit of string two
  285.         mov     byte ptr [esi + ebp], al     ; place digit after string one 
  286.         inc     ebp                          ;
  287.         dec     edx                          ;
  288.         jnz @cnc                             ; loop for length of string two
  289.  
  290.         pop     esi                          ; restore esi
  291.         mov     byte ptr [esi - 1], cl       ; update new length
  292.         ret
  293. cncstr  endp
  294.  
  295. ; returns ECX= length of String in DS:ESI - terminated by CHAR in AL
  296. ; registers changed: ECX
  297. ; Assumes ES=DS
  298.  
  299. strlngth  PROC
  300.     pushf
  301.     push edi
  302.     push esi
  303.     push edx
  304.  
  305.     mov edi,esi
  306.     xor ecx,ecx
  307.     dec ecx
  308.     cld
  309.     repnz scasb
  310.     xor edx,edx
  311.     sub edx,ecx
  312.     dec edx
  313.     mov ecx,edx
  314.  
  315.     pop edx
  316.     pop esi
  317.     pop edi
  318.  
  319.     popf
  320.     Ret
  321.  
  322. strlngth endp
  323.  
  324.  
  325. end    main
  326.