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

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