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

  1. .model  tiny
  2.  
  3. .386
  4.  
  5.         org 100h
  6.  
  7. .data
  8.  
  9. GroupLogo       db 13,10
  10.                 db '                     . a . n . e . w . b . r . e . e . d .',13,10
  11.                 db '                                                                ',13,10
  12.                 db '                                                         ▓',13,10
  13.                 db '                                                    ▄▀ ▀▒█▀ ▀▄▄',13,10
  14.                 db '    ░      ▄▄   ▄▄                                ▄▀▄█▄        █             ░',13,10
  15.                 db '         ▄▀▄ █▀▀▄ █ ▄▄    ▄▄▄▄▄▄     ▄▄    ▄▄▄▄ ▄▄▀▄▀ █ ▄█   ▄█ ▀▄  ▄▄▄▄',13,10
  16.                 db '    ░   █ ██ ▄███ █▀▄ █▄▀▀▄▄▄ ▄▄▀▀▀▀▀▄▄▀█▀▀▄▄▄ █▌ █▀  █ ██▄█████▀ ▀▀ ▄▄▄▀▄   ░',13,10
  17.                 db ' ░▒▒▒▓▓█ █▓███▓██ ▄██ ▀▄██████ ▀█▄▄▄█▀  ▄██████  ██ ▄█▀ ██  ██▌   ▄██████ █▓▒░░',13,10
  18.                 db '      █ █▓█▀ █▒██▀█▓█ ▄██▀ ██    ███   ▄██▀ ██  ███▄▀  ███ ███   ▄██▀ ██  █  ░',13,10
  19.                 db '    ▒ █ █▒█  ██▀ S█▓█ ██▄▄█▀   ▄█████  ██▄▄█▀   ███  ▄ ███ ████  ██▄▄█▀  ▐▌  ▒',13,10
  20.                 db '    ▓ ▀▄ ▀   ▀   a█▒█ ▀██▓▓▒░ ▀█▀  ▀██ ▀███▓▓▒░ ■▀██▀  █▀RV▀██▀▀ ▀███▓▓▒ █   ▓',13,10
  21.                 db '        ▀■--─────C▀██ ──────────────────────────────────────────────---■▀',13,10
  22.                 db '                                 ',13,10,'$'
  23.  
  24.  
  25.  
  26. IntroMsgOne     db 13,10,'   [■]   Tray Icon v3.0c - Key Generator by Quantico  [■]',13,10
  27.                 db '',13,10
  28.                 db 13,10,'   Enter a name        : ','$'
  29.            
  30.  
  31. ErrorMsg        db 13,10,'                     Need 5-20 digits, try again...',13,10,'$'
  32.  
  33. ShowCodeMsg     db 13,10,'                     Registration number : '
  34.  
  35. CodeBuffer      db 10 dup(0),13,10,'$'
  36.  
  37. NameBuffer      db 18h, 19h dup(0)
  38.  
  39. Convert_Digs     db '0123456789ABCDEF'
  40.  
  41. namelength      db 0
  42.  
  43. .code
  44.  
  45. .startup
  46.  
  47. main    proc    near
  48.         mov     ah, 09h                       ;
  49.         lea     edx, GroupLogo                ;
  50.         int     21h                           ; show group logo
  51.  
  52.         mov     ah, 09h                       ;
  53.         lea     edx, IntroMsgOne              ;
  54.         int     21h                           ; show intro and ask for input 
  55.  
  56.         mov     bx, 1405h                     ; limits for string input
  57.         lea     edi, NameBuffer               ;
  58.         call    getstr                        ; read user input
  59.         jc      @error                        ;
  60.         xor     eax, eax                      ; clear eax
  61.         call    keygen                        ; create serial number
  62.  
  63.         mov     ah, 09h                       ;
  64.         lea     dx, ShowCodeMsg               ;
  65.         int     21h                           ; print serial number
  66.         jmp     @exit                         ; finished, quit
  67. @error:
  68.         mov     ah, 09h
  69.         lea     dx, ErrorMsg
  70.         int     21h        
  71. @exit:
  72.         mov     al, 00h                       ;
  73.         mov     ah, 4Ch                       ;
  74.         int     21h                           ; terminate program
  75. main    endp
  76.  
  77. keygen  proc    near
  78.         mov     esi, offset NameBuffer+2
  79.         movzx   ecx, byte ptr [esi-1]
  80.         call    upcase
  81.         xor     eax, eax
  82.         xor     ebx, ebx
  83.         xor     edx, edx
  84.         xor     ecx, ecx
  85.         mov     al, byte ptr [esi-1]
  86. backformore:        
  87.         mov     dl, byte ptr [esi+ecx]
  88.         add     ebx, edx
  89.         inc     ecx
  90.         cmp     ecx, eax
  91.         jnz     backformore
  92.        
  93.         xor     edx, edx
  94.         mov     eax, ebx
  95.         mov     esi, eax
  96.         xor     ebx, ebx
  97. resultnotalladded:
  98.         xor     edx, edx
  99.         mov     ecx, 0Ah
  100.         idiv    ecx
  101.         add     ebx, edx
  102.         cmp     eax, 00000000
  103.         jnz     resultnotalladded
  104.  
  105.         mov     eax, ebx
  106.         mov     ecx, 0Ah
  107.         xor     edx, edx
  108.         idiv    ecx
  109.         cmp     eax, 00000000
  110.         jnz     oncemore
  111.         jmp     onward
  112. oncemore:
  113.         mov     eax, ebx
  114.         xor     ebx, ebx
  115.         jmp     resultnotalladded
  116. onward:
  117.         mov     eax, esi
  118.         imul    eax, ebx
  119.         inc     eax
  120.         imul    eax, ebx
  121.         add     eax, esi
  122.  
  123.  
  124.         xor    edx, edx
  125.     mov    ecx, 0000000Ah        
  126.     lea    edi, CodeBuffer
  127.     call    convert_num
  128.     ret
  129. keygen    endp
  130.  
  131.  
  132.  
  133. ; get string from user
  134. ; input :
  135. ;       edi = pointer to buffer
  136. ;       bl  = min length
  137. ;       bh  = max length
  138. ; output :
  139. ;    CF error, cx number of bytes read
  140. getstr  proc    near
  141.         push    dx                            ; save dx
  142.         mov     dx, di                        ;
  143.         mov     ah, 0Ah                       ;
  144.         int     021h                          ; get user input
  145.  
  146.         movsx   ecx, byte ptr [edi + 1]       ; get number of digits
  147.  
  148.         mov     byte ptr [edi + ecx + 2], 00h
  149.  
  150.         cmp     cl, bh                        ; check maximum
  151.         jg      @@0
  152.         cmp     cl, bl                        ; check minimum
  153.         jl      @@0
  154.         mov     [namelength], cl              ; store length
  155.     xor    ch, ch
  156.         clc                                   ; clear CF
  157.         jmp     @@1
  158. @@0:
  159.         stc                                   ; set CF (carry flag)        
  160. @@1:
  161.         pop     dx                            ; restore dx
  162.     ret
  163. getstr  endp
  164.  
  165. upcase  PROC
  166.     pushf
  167.     pushad
  168. nextletter:                   ; EBX = No. of letters
  169.     MOV     AL,[ESI]    ; EDX = INTEXT
  170.     CMP     AL,61h
  171.     JB      notlowcase
  172.     CMP     AL,7Ah
  173.     JA      notlowcase
  174.     SUB     AL,20h        ; Lowcase - make it upcase
  175.     MOV     [ESI],AL
  176. notlowcase:
  177.     INC     ESI
  178.     DEC     ECX
  179.     TEST    ECX,ECX
  180.     JNZ     nextletter
  181.     popad
  182.     popf
  183.     Ret
  184.  
  185. Upcase endp
  186.  
  187.  
  188. Convert_Num proc near
  189.         pushf
  190.     pushAD
  191.  
  192.         sub     esp, 4
  193.         mov     ebp,esp
  194.  
  195.         cld
  196.         mov     esi, edi
  197.         push    esi
  198.  
  199. ;--- loop for each digit
  200.  
  201.         sub     bh, bh
  202.         mov     dword ptr [ebp], eax               ;save low word
  203.         mov     dword ptr [ebp+4], edx             ;save high word
  204.         sub     esi, esi                          ;count digits
  205.  
  206. Connum1:
  207.         inc     esi
  208.         mov     eax, dword ptr [ebp+4]             ;high word of value
  209.         sub     edx, edx                          ;clear for divide
  210.         sub    ebx, ebx
  211.         div     ecx                              ;divide, DX gets remainder
  212.         mov     dword ptr [ebp+4],eax             ;save quotient (new high word)
  213.  
  214.         mov     eax, dword ptr [ebp]               ;low word of value
  215.         div     ecx                              ;divide, DX gets remainder
  216.                                                 ;  (the digit)
  217.         mov     dword ptr [ebp], eax               ;save quotient (new low word)
  218.  
  219.         mov     bl, dl
  220.         mov     al, byte ptr [Convert_Digs+ebx]  ;get the digit
  221.         stosb                                   ;store
  222.  
  223.         cmp     dword ptr [ebp], 0                ;check if low word zero
  224.         jne     Connum1                         ;jump if not
  225.         cmp     dword ptr [ebp+4], 0              ;check if high word zero
  226.         jne     Connum1                         ;jump if not
  227.  
  228.         sub     al, al
  229.         stosb                                   ;store the terminator
  230.  
  231. ;--- reverse digits
  232.  
  233.         pop     ecx                              ;restore start of string
  234.         xchg    ecx, esi
  235.         shr     ecx, 1                           ;number of reverses
  236.         jz      Connum3                         ;jump if none
  237.  
  238.         xchg    edi, esi
  239.         sub     esi, 2                           ;point to last digit
  240.  
  241. Connum2 :
  242.         mov     al, byte ptr [edi]               ;load front character
  243.         xchg    al, byte ptr [esi]               ;swap with end character
  244.         stosb                                   ;store new front character
  245.         dec     esi                              ;back up
  246.         loopd   Connum2                         ;loop back for each digit
  247.  
  248. ;--- finished
  249.  
  250. Connum3  :
  251.         add     esp, 4
  252.  
  253.     popad
  254.         popf
  255.         ret
  256.  endp           ;Convert_Num
  257.  
  258. end    main
  259.