home *** CD-ROM | disk | FTP | other *** search
/ Reverse Code Engineering RCE CD +sandman 2000 / ReverseCodeEngineeringRceCdsandman2000.iso / RCE / Quantico / km / teleport.asm.txt < prev    next >
Encoding:
Text File  |  2000-05-25  |  7.0 KB  |  204 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,'   [■]   Teleport Pro v1.29 - 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.         xor     ebx, ebx
  79.         mov     esi, 5DFEE4A4h
  80.         lea     edi, NameBuffer+2
  81.         lea     eax, namelength
  82.         movsx   eax, byte ptr [namelength]
  83.         add     eax, -04h
  84. @back:  cmp     ebx, eax
  85.         jae     @gogo
  86.         xor     esi, [edi+ebx]
  87.         test    bl, 40h
  88.         jz      @below
  89.         inc     ebx
  90. @below: inc     ebx
  91.         jmp     @back
  92. @gogo:  mov     eax, esi
  93.         xor    edx, edx
  94.     mov    ecx, 0000000Ah        
  95.     lea    edi, CodeBuffer
  96.     call    convert_num
  97.     ret
  98. keygen    endp
  99.  
  100.  
  101.  
  102. ; get string from user
  103. ; input :
  104. ;       edi = pointer to buffer
  105. ;       bl  = min length
  106. ;       bh  = max length
  107. ; output :
  108. ;    CF error, cx number of bytes read
  109. getstr  proc    near
  110.         push    dx                            ; save dx
  111.         mov     dx, di                        ;
  112.         mov     ah, 0Ah                       ;
  113.         int     021h                          ; get user input
  114.  
  115.         movsx   ecx, byte ptr [edi + 1]       ; get number of digits
  116.  
  117.         mov     byte ptr [edi + ecx + 2], 00h
  118.  
  119.         cmp     cl, bh                        ; check maximum
  120.         jg      @@0
  121.         cmp     cl, bl                        ; check minimum
  122.         jl      @@0
  123.         mov     [namelength], cl              ; store length
  124.     xor    ch, ch
  125.         clc                                   ; clear CF
  126.         jmp     @@1
  127. @@0:
  128.         stc                                   ; set CF (carry flag)        
  129. @@1:
  130.         pop     dx                            ; restore dx
  131.     ret
  132. getstr  endp
  133.  
  134. Convert_Num proc near
  135.         pushf
  136.     pushAD
  137.  
  138.         sub     esp, 4
  139.         mov     ebp,esp
  140.  
  141.         cld
  142.         mov     esi, edi
  143.         push    esi
  144.  
  145. ;--- loop for each digit
  146.  
  147.         sub     bh, bh
  148.         mov     dword ptr [ebp], eax               ;save low word
  149.         mov     dword ptr [ebp+4], edx             ;save high word
  150.         sub     esi, esi                          ;count digits
  151.  
  152. Connum1:
  153.         inc     esi
  154.         mov     eax, dword ptr [ebp+4]             ;high word of value
  155.         sub     edx, edx                          ;clear for divide
  156.         sub    ebx, ebx
  157.         div     ecx                              ;divide, DX gets remainder
  158.         mov     dword ptr [ebp+4],eax             ;save quotient (new high word)
  159.  
  160.         mov     eax, dword ptr [ebp]               ;low word of value
  161.         div     ecx                              ;divide, DX gets remainder
  162.                                                 ;  (the digit)
  163.         mov     dword ptr [ebp], eax               ;save quotient (new low word)
  164.  
  165.         mov     bl, dl
  166.         mov     al, byte ptr [Convert_Digs+ebx]  ;get the digit
  167.         stosb                                   ;store
  168.  
  169.         cmp     dword ptr [ebp], 0                ;check if low word zero
  170.         jne     Connum1                         ;jump if not
  171.         cmp     dword ptr [ebp+4], 0              ;check if high word zero
  172.         jne     Connum1                         ;jump if not
  173.  
  174.         sub     al, al
  175.         stosb                                   ;store the terminator
  176.  
  177. ;--- reverse digits
  178.  
  179.         pop     ecx                              ;restore start of string
  180.         xchg    ecx, esi
  181.         shr     ecx, 1                           ;number of reverses
  182.         jz      Connum3                         ;jump if none
  183.  
  184.         xchg    edi, esi
  185.         sub     esi, 2                           ;point to last digit
  186.  
  187. Connum2 :
  188.         mov     al, byte ptr [edi]               ;load front character
  189.         xchg    al, byte ptr [esi]               ;swap with end character
  190.         stosb                                   ;store new front character
  191.         dec     esi                              ;back up
  192.         loopd   Connum2                         ;loop back for each digit
  193.  
  194. ;--- finished
  195.  
  196. Connum3  :
  197.         add     esp, 4
  198.  
  199.     popad
  200.         popf
  201.         ret
  202.  endp           ;Convert_Num
  203.  
  204. end    main