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

  1. ; Author can be email at: stone@one.se ;>
  2. ; Formatted with Darkstalkers ASMFMT ;).. thnx ds :)
  3. .model SMALL
  4. .stack 100h
  5. .386
  6.  
  7. .DATA         
  8. input    DB 39,0
  9. uname    DB 39 dup (0h) 
  10.  
  11. d47503c  DD 0123e1h            ; This is used as initial value for IMUL
  12.  
  13. valid    DB 10,13,'A valid key is: '
  14. realkey  DB 12 dup (30h)        ; Serial number is 12 digits long
  15. enstr    DB 10,13,'$'                ; Write termination
  16.  
  17. flaffer  DB 39 dup (0)            ; Used for the high/low bit cleaned string
  18.  
  19. introtxt DB '          What Is This? 1.6  *Keymaker*  ',10,13
  20.          DB '──────────────|   STONE   |──────────────',10,13
  21.          DB '  ▄▄▄   ▄▄▄    ▄▄▄▄▄▄▄▄▄    ▄▄▄▄▄▄▄▄▄    ',10,13
  22.          DB '  ███   ███    ███          ███▄▄▄       ',10,13
  23.          DB '  ███▄  ███    ███▄         ███          ',10,13
  24.          DB '  ▀▀▀▀▀▀▀▀▀    ▀▀▀▀▀▀▀▀▀    ▀▀▀          ',10,13
  25.          DB '─────────────────────────────────────────',10,13
  26.          DB 'u N I T E D  c R Æ C K I N G  f O R C E  ',10,13
  27.          DB '[wIN95/NT]─────────────────────[oCT 1997]',10,13
  28.          DB 'Enter your username: ','$'
  29.  
  30.          DB '2nd&mi' ; Personal tag - not used
  31.  
  32. ;---------------------------------------------
  33. .CODE
  34.     MOV AX, @DATA            ; Make DS&ES point to the DATA
  35.     MOV DS, AX
  36.     MOV ES, AX
  37.  
  38.     LEA EDX, [introtxt]        ; Write intro text 
  39.     MOV AH, 9h
  40.     INT 21h
  41.  
  42.     MOV AX, 0A00h                  
  43.     LEA EDX, [input]
  44.     INT 21h                ; Get buffered input
  45.  
  46.     MOVZX EBX, [input+1]        ; Fetch length
  47.     CMP EBX,0            ; if zero - exit
  48.     JZ EXIT
  49.  
  50.     CALL upcase            ; Uppercase input string
  51.     CALL cleanit            ; Clean it for high/lowbit chars
  52.  
  53.     XOR ESI,ESI            ; Zero Counter
  54. NextByte:
  55.     MOVZX EAX, BYTE PTR [input+1]    ; Get length
  56.     CALL genkey            ; Deciede on a letter to use for num-gen
  57.     MOVZX EBX,[flaffer+EDX]
  58.  
  59. nextitera:                ; Generate a digit of the serial
  60.     MOV     EAX,0Ah        
  61.     CALL    GENKEY
  62.     DEC     BL
  63.     JNZ     nextitera
  64.  
  65.     ADD BYTE PTR [realkey+ESI],DL    ; Make it a digit
  66.     INC ESI                ; next byte
  67.     CMP ESI,12d
  68.         JNZ nextbyte    
  69.  
  70.     MOV AH,09h            ; Write the key
  71.     LEA EDX,[valid]    
  72.     INT 21h
  73.  
  74. EXIT:
  75.     MOV AX,4C00h            ; Exit, error code = 0
  76.     INT 21h
  77.  
  78.  
  79. genkey  PROC                ; Work horse of the keymaker
  80.     IMUL    EDX,[d47503C],08088405h
  81.     INC     EDX
  82.     MOV     [d47503C],EDX
  83.     MUL     EDX
  84.     MOV     EAX,EDX
  85.     RET
  86. genkey ENDP
  87.  
  88. upcase  PROC
  89.     LEA EDX, [uname]
  90.     MOV ESI,EDX
  91. nextletter:                   ; EBX = No. of letters
  92.     MOV     AL,[EDX]    ; EDX = INTEXT
  93.     CMP     AL,61h
  94.     JB      notlowcase
  95.     CMP     AL,7Ah
  96.     JA      notlowcase
  97.     SUB     AL,20h        ; Lowcase - make it upcase
  98.     MOV     [ESI],AL
  99. notlowcase:
  100.     INC     EDX
  101.     INC     ESI
  102.     DEC     EBX
  103.     TEST    EBX,EBX
  104.     JNZ     nextletter
  105.     RET
  106. Upcase ENDP
  107.  
  108. cleanit PROC
  109.     LEA EDI, [flaffer]        ; Store output here
  110.     LEA ESI, [uname]        ; Get input from here
  111.     MOVZX ECX,[input+1]        ; Fetch the length
  112. nextb:
  113.     MOVZX EAX,BYTE PTR [ESI]    ; Fetch a letter
  114.     CMP EAX,48            ; Is it low bit?
  115.     JB skip
  116.     CMP EAX,91            ; is it high bit?
  117.     JG skip
  118.     MOVSB                ; no - copy it as it is
  119.     DEC ECX                ; move on to next letter
  120.     JNZ nextb
  121.     RET
  122. skip:
  123.     INC ESI                ; skip it
  124.     DEC BYTE PTR [input+1]        ; decrease length of string
  125.     DEC ECX                ; next letter
  126.     JNZ nextb
  127.     RET
  128. cleanit ENDP
  129.  
  130. END