home *** CD-ROM | disk | FTP | other *** search
/ Reverse Code Engineering RCE CD +sandman 2000 / ReverseCodeEngineeringRceCdsandman2000.iso / RCE / Quantico / km / ucf_fmon.asm.txt < prev    next >
Encoding:
Text File  |  2000-05-25  |  12.8 KB  |  484 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 '        [■]   File Usage Monitor v1.3 - 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-20 digits, try again...',13,10,'$'
  35.  
  36. ShowCodeMsg     db 13,10,'Registration number    : '
  37.  
  38. CodeBuffer      db 10h dup(0),13,10,'$'
  39.  
  40. Code2Buffer     db 5h dup(0),00h
  41.  
  42. Code3Buffer     db 5h dup(0),00h
  43.  
  44. NameBuffer      db 18h, 50h dup(0)
  45.  
  46. CopyName        db 18h, 50h dup(0)
  47.  
  48. Convert_Digs     db '0123456789ABCDEF'
  49.  
  50. namelength      db 00,00,00
  51.  
  52. filename        db 'FILE_MON.EXE',00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
  53.  
  54. filename2       db 'FILE_MON.EXE'
  55.  
  56.  
  57. .code
  58.  
  59. .startup
  60.  
  61. main    proc    near
  62.         mov     ah, 09h                       ;
  63.         lea     edx, GroupLogo                ;
  64.         int     21h                           ; show group logo
  65.  
  66.         mov     ah, 09h                       ;
  67.         lea     edx, IntroMsgOne              ;
  68.         int     21h                           ; show intro and ask for input 
  69.  
  70.         mov     bx, 1405h                     ; limits for string input
  71.         lea     edi, NameBuffer               ;
  72.         mov     esi, offset namelength
  73.         call    getstr                        ; read user input
  74.         jc      @error                        ;
  75.         xor     eax, eax                      ; clear eax
  76.  
  77.  
  78.         call    keygen                        ; create serial number
  79.  
  80.         mov     ah, 09h                       ;
  81.         lea     dx, ShowCodeMsg               ;
  82.         int     21h                           ; print serial number
  83.         jmp     @exit                         ; finished, quit
  84. @error:
  85.         mov     ah, 09h
  86.         lea     dx, ErrorMsg
  87.         int     21h        
  88. @exit:
  89.         mov     al, 00h                       ;
  90.         mov     ah, 4Ch                       ;
  91.         int     21h                           ; terminate program
  92. main    endp
  93.  
  94. keygen  proc    near
  95.  
  96.         int     3 ; debugging
  97.  
  98.         mov     esi, offset NameBuffer+2
  99.         mov     edi, offset CopyName
  100.         movzx   ecx, byte ptr [namelength]
  101.         rep     movsb
  102.  
  103.  
  104.         mov     esi, offset CopyName
  105.         movzx   ecx, byte ptr [namelength]
  106.         call    upcase
  107.  
  108.  
  109.         mov     esi, offset filename
  110.         mov     ecx, 0Ch
  111.         mov     edi, offset CopyName
  112.         movzx   edx, byte ptr [namelength]
  113.         call    cncstr
  114.  
  115.         mov     cl, byte ptr [esi-1]
  116.         xor     ebx, ebx
  117.         xor     eax, eax
  118.         call    nextpart
  119.  
  120.         xor    edx, edx
  121.         mov     eax, ebx
  122.     mov    ecx, 00000010h        
  123.     lea    edi, Code2Buffer
  124.     call    convert_num
  125.         
  126.         mov     esi, offset copyname
  127.         movzx   ecx, byte ptr [namelength]
  128.         mov     edi, offset filename2
  129.         xor     edx, edx
  130.         mov     dl, 0Ch
  131.         call    cncstr
  132.  
  133.         mov     cl, byte ptr [esi-1]
  134.         xor     ebx, ebx
  135.         xor     eax, eax
  136.         call    nextpart
  137.  
  138.         xor    edx, edx
  139.         mov     eax, ebx
  140.     mov    ecx, 00000010h        
  141.     lea    edi, Code3Buffer
  142.     call    convert_num
  143.  
  144.         mov     esi, offset Code2Buffer
  145.         mov     al, 00
  146.         call    strlngth
  147.         dec     ecx
  148.  
  149.         mov     esi, offset Code2Buffer
  150.         mov     edi, offset CodeBuffer
  151.         rep     movsb
  152.  
  153.         mov     byte ptr [edi], 2Dh
  154.         inc     edi
  155.  
  156.         mov     esi, offset Code3Buffer
  157.         mov     al, 00
  158.         call    strlngth
  159.         dec     ecx
  160.  
  161.         mov     esi, offset Code3Buffer
  162.         rep     movsb
  163.  
  164.  
  165.  
  166.  
  167.  
  168.       
  169.  
  170.     ret
  171. keygen    endp
  172.  
  173.  
  174. nextpart proc near
  175.  
  176. loopit:
  177.         mov     al, byte ptr [esi+ecx-1]
  178.         add     ebx, eax
  179.         dec     cl
  180.         jnz     loopit
  181.  
  182.         cmp     ebx, 64h
  183.         jge     morethan64
  184.         add     ebx, 64h
  185. morethan64:
  186.         mov     eax, ebx
  187.         mov     ecx, 0Ah
  188.         xor     edx, edx
  189.         idiv    ecx
  190.         cmp     edx, 1
  191.         jne     move1
  192.         add     ebx, 7
  193.         jmp     moveon
  194. move1:
  195.         cmp     edx, 2
  196.         jne     move2
  197.         sub     ebx, 0Bh
  198.         jmp     moveon
  199. move2:
  200.         cmp     edx, 3
  201.         jne     move3
  202.         add     ebx, 13h
  203.         jmp     moveon
  204. move3:
  205.         cmp     edx, 4
  206.         jne     move4
  207.         sub     ebx, 1Ch
  208.         jmp     moveon
  209. move4: 
  210.         cmp     edx, 5
  211.         jne     move5
  212.         add     ebx, 18h
  213.         jmp     moveon
  214. move5: 
  215.         cmp     edx, 6
  216.         jne     move6
  217.         sub     ebx, 3
  218.         jmp     moveon
  219. move6:
  220.         cmp     edx, 7
  221.         jne     move7
  222.         add     ebx, 2Ch
  223.         jmp     moveon
  224. move7:
  225.         cmp     edx, 8
  226.         jne     move8
  227.         sub     ebx, 43h
  228.         jmp     moveon
  229. move8:
  230.         cmp     edx, 9
  231.         jne     move9
  232.         add     ebx, 15h
  233.         jmp     moveon
  234. move9:
  235.         add     ebx, 23h
  236. moveon:
  237.         add     bl, byte ptr [esi]
  238.         add     bl, byte ptr [esi+1]
  239.         mov     cl, byte ptr [esi-1]
  240.         add     bl, byte ptr [esi+ecx-1]
  241.         add     bl, byte ptr [esi+ecx-2]
  242.         sub     bl, byte ptr [esi+2]
  243.         sub     bl, byte ptr [esi+3]
  244.  
  245.         mov     eax, ebx
  246.         and     eax, 80000007h
  247.         jns     down
  248.         dec     eax
  249.         or      eax, -08
  250.         inc     eax
  251. down:
  252.         cmp     eax, 1
  253.         jne     not1
  254.         add     ebx, 2
  255.         jmp     moveon2
  256. not1:
  257.         cmp     eax, 2
  258.         jne     not2
  259.         add     ebx, 5
  260.         jmp     moveon2
  261. not2:
  262.         cmp     eax, 3
  263.         jne     not3
  264.         sub     ebx, 0Fh
  265.         jmp     moveon2
  266. not3:
  267.         cmp     eax, 4
  268.         jne     not4
  269.         inc     ebx
  270.         jmp     moveon2
  271. not4:
  272.         cmp     eax, 5
  273.         jne     not5
  274.         sub     ebx, 0Dh
  275.         jmp     moveon2
  276. not5:
  277.         cmp     eax, 6
  278.         jne     not6
  279.         add     ebx, 0Dh
  280.         jmp     moveon2
  281. not6:
  282.         cmp     eax, 7
  283.         jne     not7
  284.         add     ebx, 7
  285.         jmp     moveon2
  286. not7:
  287.         sub     ebx, 3
  288. moveon2:
  289.  
  290.  
  291.         
  292.  
  293.     ret
  294. nextpart    endp
  295.  
  296.  
  297.  
  298. ; get string from user
  299. ; input :
  300. ;       edi = pointer to buffer
  301. ;       bl  = min length
  302. ;       bh  = max length
  303. ; output :
  304. ;    CF error, cx number of bytes read
  305. getstr  proc    near
  306.         push    dx                            ; save dx
  307.         mov     dx, di                        ;
  308.         mov     ah, 0Ah                       ;
  309.         int     021h                          ; get user input
  310.  
  311.         movsx   ecx, byte ptr [edi + 1]       ; get number of digits
  312.  
  313.         mov     byte ptr [edi + ecx + 2], 00h
  314.  
  315.         cmp     cl, bh                        ; check maximum
  316.         jg      @@0
  317.         cmp     cl, bl                        ; check minimum
  318.         jl      @@0
  319.         mov     byte ptr [esi], cl            ; store length
  320.     xor    ch, ch
  321.         clc                                   ; clear CF
  322.         jmp     @@1
  323. @@0:
  324.         stc                                   ; set CF (carry flag)        
  325. @@1:
  326.         pop     dx                            ; restore dx
  327.     ret
  328. getstr  endp
  329.  
  330.  
  331.  
  332.  
  333.  
  334. ; concatenate 2 strings
  335. ; input :
  336. ;       esi = string one, ecx = length string one
  337. ;       edi = string two, edx = length string two
  338. ; output :
  339. ;       esi = string one + string two, edx = new length
  340. cncstr  proc    near
  341.         xor     eax, eax                     ;
  342.         xor     ebp, ebp                     ; clear register
  343.  
  344.         push    esi                          ; save esi
  345.  
  346.         add     esi, ecx                     ; set esi at end of string one
  347.         add     ecx, edx                     ; adjust new length
  348. @cnc:
  349.         mov     al, byte ptr [edi + ebp]     ; get digit of string two
  350.         mov     byte ptr [esi + ebp], al     ; place digit after string one 
  351.         inc     ebp                          ;
  352.         dec     edx                          ;
  353.         jnz @cnc                             ; loop for length of string two
  354.  
  355.         pop     esi                          ; restore esi
  356.         mov     byte ptr [esi - 1], cl       ; update new length
  357.         ret
  358. cncstr  endp
  359.  
  360. ; returns ECX= length of String in DS:ESI - terminated by CHAR in AL
  361. ; registers changed: ECX
  362. ; Assumes ES=DS
  363.  
  364. strlngth  PROC
  365.     pushf
  366.     push edi
  367.     push esi
  368.     push edx
  369.  
  370.     mov edi,esi
  371.     xor ecx,ecx
  372.     dec ecx
  373.     cld
  374.     repnz scasb
  375.     xor edx,edx
  376.     sub edx,ecx
  377.     dec edx
  378.     mov ecx,edx
  379.  
  380.     pop edx
  381.     pop esi
  382.     pop edi
  383.  
  384.     popf
  385.     Ret
  386.  
  387. strlngth endp
  388.  
  389. upcase  PROC
  390.     pushf
  391.     pushad
  392. nextletter:                   ; EBX = No. of letters
  393.     MOV     AL,[ESI]    ; EDX = INTEXT
  394.     CMP     AL,61h
  395.     JB      notlowcase
  396.     CMP     AL,7Ah
  397.     JA      notlowcase
  398.     SUB     AL,20h        ; Lowcase - make it upcase
  399.     MOV     [ESI],AL
  400. notlowcase:
  401.     INC     ESI
  402.     DEC     ECX
  403.     TEST    ECX,ECX
  404.     JNZ     nextletter
  405.     popad
  406.     popf
  407.     Ret
  408.  
  409. Upcase endp
  410.  
  411.  
  412. Convert_Num proc near
  413.         pushf
  414.     pushAD
  415.  
  416.         sub     esp, 4
  417.         mov     ebp,esp
  418.  
  419.         cld
  420.         mov     esi, edi
  421.         push    esi
  422.  
  423. ;--- loop for each digit
  424.  
  425.         sub     bh, bh
  426.         mov     dword ptr [ebp], eax               ;save low word
  427.         mov     dword ptr [ebp+4], edx             ;save high word
  428.         sub     esi, esi                          ;count digits
  429.  
  430. Connum1:
  431.         inc     esi
  432.         mov     eax, dword ptr [ebp+4]             ;high word of value
  433.         sub     edx, edx                          ;clear for divide
  434.         sub    ebx, ebx
  435.         div     ecx                              ;divide, DX gets remainder
  436.         mov     dword ptr [ebp+4],eax             ;save quotient (new high word)
  437.  
  438.         mov     eax, dword ptr [ebp]               ;low word of value
  439.         div     ecx                              ;divide, DX gets remainder
  440.                                                 ;  (the digit)
  441.         mov     dword ptr [ebp], eax               ;save quotient (new low word)
  442.  
  443.         mov     bl, dl
  444.         mov     al, byte ptr [Convert_Digs+ebx]  ;get the digit
  445.         stosb                                   ;store
  446.  
  447.         cmp     dword ptr [ebp], 0                ;check if low word zero
  448.         jne     Connum1                         ;jump if not
  449.         cmp     dword ptr [ebp+4], 0              ;check if high word zero
  450.         jne     Connum1                         ;jump if not
  451.  
  452.         sub     al, al
  453.         stosb                                   ;store the terminator
  454.  
  455. ;--- reverse digits
  456.  
  457.         pop     ecx                              ;restore start of string
  458.         xchg    ecx, esi
  459.         shr     ecx, 1                           ;number of reverses
  460.         jz      Connum3                         ;jump if none
  461.  
  462.         xchg    edi, esi
  463.         sub     esi, 2                           ;point to last digit
  464.  
  465. Connum2 :
  466.         mov     al, byte ptr [edi]               ;load front character
  467.         xchg    al, byte ptr [esi]               ;swap with end character
  468.         stosb                                   ;store new front character
  469.         dec     esi                              ;back up
  470.         loopd   Connum2                         ;loop back for each digit
  471.  
  472. ;--- finished
  473.  
  474. Connum3  :
  475.         add     esp, 4
  476.  
  477.     popad
  478.         popf
  479.         ret
  480.  endp           ;Convert_Num
  481.  
  482.  
  483. end    main
  484.