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

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