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

  1.  
  2. .model small
  3. .stack 100h
  4. .data
  5.  
  6. ;******************************************************************************
  7. ;   variables for code gen
  8. ;
  9. ;******************************************************************************
  10.  
  11.  
  12.  
  13. header          DB ' Hypersnap-DX 3.02 license generator by +SNiKkEL',0ah,0dh,0ah,0dh,'$'
  14. info            DB 0ah,0dh,' for some reason they decided to insert a ',027h,'-',027h,' into the code',0ah,0dh
  15.                 DB ' invalid names are:',0ah,0dh
  16.                 DB ' xygorf, Saltine, super user, tHATDUDE, ED!SON and hacker... sigh',0ah,0dh
  17.                 db 0ah,0dh,'enter any name:',0ah,0dh,' $'
  18. notright        db 0ah,0dh,' your name must contain at least one letter',0ah,0dh,'$'
  19. should_be       DB 'WORDXCJOSEFMENGELEJOSE',0   ;this is the regcode before 'encryption'
  20.                  ;WOR = world license (SIT = site license)  DXC = some check
  21.                  ;the rest is the name; snikkel will be SNIKKELSNIKKELSN
  22.                  ;the alphabet will be  A t/m F + L t/m o + U t/m Z  (over 16 chars)
  23.                  ;according to this principle: divide total letters in name by 2
  24.                  ;sub 2 from answer and get 4 chars from beginning of name+answer
  25.                  ;put those 4 after first 6 chars, then put the last 6 letters in the
  26.                  ;name at the end  (spaces, numbers etc are ignored, all letters must be capitalized)
  27. fifthchar       db 0ah,0dh,0ah,0dh,'what would you like to be the 5th letter in your code?',0ah,0dh
  28.                 db ' enter anything from a to z',0ah,0dh,' $'
  29. wrong           db 'anything from a to z, isn',027h,'t that enuff?',0ah,0dh,' $'
  30. wagain          db 'why don',027h,'t you just fuck off',0ah,0dh,'$'
  31. whatkind        db 0ah,0dh,'would you like a site or a worldwide license? (s or w)',0ah,0dh,' $'
  32. personals       db 0ah,0dh,0ah,0dh,' your personal unlimited site license code is:',0ah,0dh,0ah,0dh,' $'
  33. personalw       db 0ah,0dh,0ah,0dh,' your personal unlimited world-wide license code is:',0ah,0dh,0ah,0dh,' $'
  34. to_enter        DB 'S2345678901234-6789012345',0ah,0dh,0ah,0dh,'$'   ;the code will be put here
  35.                                                            ;the S is the fifth char on which the 1st letter depends
  36. encodestr       DB 'XCFNAKSHIPZUJLDORGVQTEWYBM',0         ;according to this the letters will be 'encoded'
  37. checks          Dw 0                                      ;checksum (last char) will be put here
  38. keyb            db  033h,033h,034h  dup (0)               ;keyboard buffer, place for input
  39.  
  40. ;******************************************************************************
  41. ;       end of data, begin of code
  42. ;******************************************************************************
  43.  
  44. .code
  45. start:          JMP     begin
  46.  
  47. ;******************************************************************************
  48. ;       calculate code proc
  49. ;******************************************************************************
  50.  
  51. calculate       PROC    near
  52.                 mov     ax,@data
  53.                 mov     ds,ax
  54.                 mov     es,ax
  55.                 xor     bx,bx
  56.                 mov     cx,00001h
  57.                 xor     dx,dx
  58.  
  59. go:             mov     si,offset should_be
  60.                 add     si,bx
  61.                 MOV     al,byte ptr [si]              ;put byte of name you want in al
  62.                 cmp     al,000h
  63.                 jz      done
  64.                 mov     si,offset to_enter
  65.                 cmp     cx,00010h
  66.                 jnz     dont_use_the_2D_for_calculating
  67.                 inc     dx      ;make it skip the '-' for calculating next
  68.                 inc     dx
  69. dont_use_the_2D_for_calculating:
  70.                 add     si,bx
  71.                 add     si,dx
  72.                 mov     ah,byte ptr [si]    ;put byte in ah for substracting (adding)
  73.  
  74.                 inc     al
  75.                 cmp     bx,00000h
  76.                 jz      fifth
  77.                 jmp     continue
  78.  
  79. fifth:          mov     si,offset to_enter
  80.                 add     si,00004h              ;put the 1st char in should_be
  81.                 MOV     [si],ah                ;in the right place fer output
  82.                 sub     dx,001h
  83.  
  84. continue:       sub     ah,041h
  85.                 sub     al,041h
  86.                 add     al,ah
  87.                 cmp     al,01ah
  88.                 jge     rotate
  89.                 jmp     continue2
  90.  
  91. rotate:         sub     al,01ah
  92.  
  93. continue2:      mov     si,offset encodestr
  94.                 mov     ah,000h
  95.                 add     si,ax
  96.                 MOV     al,byte ptr [si]
  97.                 cmp     cx,0000eh
  98.                 jnz     dont_overwrite_the_2D_check
  99.                 inc     cx
  100.                 dec     dx       ; make it read the char before the '-' for calculating
  101. dont_overwrite_the_2D_check:
  102.                 cmp     cx,00005h
  103.                 jg      fifth2
  104.                 jz      incdx
  105.                 jmp     continue3
  106.  
  107. incdx:          inc     dx
  108.  
  109. fifth2:         mov     si,offset to_enter
  110.                 add     si,cx
  111.                 MOV     byte ptr [si],al
  112.                 inc     bx
  113.                 inc     cx
  114.                 jmp     go
  115.  
  116. continue3:      mov     si,offset to_enter
  117.                 add     si,bx
  118.                 MOV     byte ptr [si],al
  119.                 inc     bx
  120.                 inc     cx
  121.                 jmp     go
  122.  
  123. done:           RET                             ;return
  124.  
  125. calculate       ENDP
  126.  
  127. ;******************************************************************************
  128. ;       this part asks for name
  129. ;******************************************************************************
  130.  
  131. input           PROC    near
  132.                 mov     ax,@data
  133.                 mov     ds,ax
  134.                 mov     es,ax
  135.  
  136.                 MOV     ah,09h
  137.                 mov     dx,offset info             ;spam info
  138.                 int     21h
  139.                 mov     dx,offset keyb
  140.                 mov     ah,0ah
  141.                 int     21h                        ;and get user name
  142.  
  143.                 MOV     AH,09H
  144.                 MOV     DX,offset fifthchar        ;display fifth char message
  145.                 INT     21H
  146.                 xor     cx,cx
  147.  
  148. get5char:       mov     ax,0c07h        ;clear keyb buffer & wait for input
  149.                 int        21h
  150.                 cmp     al,061h         ; 'a'
  151.                 jge     letsee
  152.                 cmp     al,041h         ; 'A'
  153.                 jge     letsee2
  154.                 jmp     wrongg
  155.  
  156. letsee:         cmp     al,07bh         ;'z'
  157.                 jge     wrongg
  158.                 sub     al,020h
  159.                 jmp     putitin
  160.  
  161. letsee2:        cmp     al,05bh         ;'Z'
  162.                 jge     wrongg
  163.  
  164. putitin:        mov     si,offset to_enter
  165.                 MOV     byte ptr [si],al
  166.  
  167.                 MOV     AH,09H
  168.                 MOV     DX,offset whatkind        ;display question
  169.                 INT     21H
  170.  
  171. getregmode:     mov     ax,0c07h        ;clear keyb buffer & wait for input
  172.                 int        21h
  173.                 cmp     al,073h         ; 's'
  174.                 jz      sitelic
  175.                 cmp     al,041h         ; 'S'
  176.                 jz      sitelic
  177.                 cmp     al,077h         ;'w'
  178.                 jz      worldlic
  179.                 cmp     al,057h         ;'W'
  180.                 jz      worldlic
  181.                 jmp     getregmode
  182.  
  183. sitelic:        mov     si,offset should_be
  184.                 MOV     byte ptr [si],'S'
  185.                 MOV     byte ptr [si+1],'I'
  186.                 MOV     byte ptr [si+2],'T'
  187.                 ret
  188.  
  189. worldlic:       mov     si,offset should_be
  190.                 MOV     byte ptr [si],'W'
  191.                 MOV     byte ptr [si+1],'O'
  192.                 MOV     byte ptr [si+2],'R'
  193.                 ret
  194.  
  195. wrongg:         cmp     cx,001h
  196.                 jz      wrongagain
  197.                 mov     ah,09h
  198.                 mov     dx,offset wrong
  199.                 int        21h
  200.                 inc     cx
  201.                 jmp     get5char
  202.  
  203. wrongagain:     mov     ah,09h
  204.                 mov     dx,offset wagain
  205.                 int        21h
  206.                 jmp     exit
  207.  
  208.  
  209. ret
  210.  
  211. input           endp
  212.  
  213. ;******************************************************************************
  214. ;       calculate checksum
  215. ;******************************************************************************
  216.  
  217. checksum        PROC    near
  218.                 mov     ax,@data
  219.                 mov     ds,ax
  220.                 mov     es,ax
  221.                 xor     cx,cx
  222.                 mov     di,offset checks
  223.  
  224. go2:            mov     si,offset should_be
  225.                 xor     ax,ax
  226.                 cmp     cx,016h
  227.                 jz      cal_char
  228.                 add     si,cx
  229.                 MOV     al,byte ptr [si]              ;put byte of calculated in al
  230.                 sub     al,041h
  231.                 push    ax
  232.                 push    cx
  233.                 mov     ax,cx
  234.                 mov     cx,00002h
  235.                 div     cx
  236.                 pop     cx
  237.                 pop     ax
  238.                 test    dx,dx
  239.                 jz     nodouble
  240.                 add     ax,ax
  241.  
  242. nodouble:       cmp     ax,0001ah
  243.                 jb      allrighty
  244.                 sub     ax,00019h
  245.  
  246. allrighty:      add     [di],ax
  247.                 inc     cx
  248.                 jmp     go2
  249.  
  250. cal_char:       mov     ax,[di]
  251.                 mov     cx,01ah
  252.                 xor     dx,dx
  253.                 div     cx
  254.                 mov     bx,dx
  255.                 inc     bl
  256.                 mov     si,offset to_enter+017h   ;added one here, made it read the last char
  257.                 mov     bh,byte ptr [si]
  258.                 sub     bh,041h
  259.                 add     bl,bh
  260.                 cmp     bl,01ah
  261.                 jge     rotate2
  262.                 jmp     go_on
  263.  
  264. rotate2:        sub     bl,01ah
  265.  
  266. go_on:          mov     si,offset encodestr
  267.                 mov     bh,000h
  268.                 add     si,bx
  269.                 MOV     bl,byte ptr [si]
  270.                 mov     si,offset to_enter+018h     ;added one here cause of the '-'
  271.                 mov     byte ptr [si],bl
  272.  
  273.                 RET
  274.  
  275. checksum        endp
  276.  
  277. ;******************************************************************************
  278. ;      check and shape up user input
  279. ;******************************************************************************
  280.  
  281.  read_input     proc    near
  282.                 mov     ax,@data
  283.                 mov     ds,ax
  284.                 mov     es,ax
  285.                 xor     dx,dx
  286.                 xor     ax,ax
  287.                 xor     cx,cx
  288.                 mov     si,offset keyb
  289.                 mov     al,byte ptr [si+1]  ;get number of chars put in by user
  290.                 cmp     al,000h
  291.                 jz      step_no_input            ;number is zero
  292.                 mov     bx,ax
  293.                 add     si,2              ;move si to beginning of input
  294.  
  295. loopstart:      cmp     bx,000h
  296.                 jnz     notalldone
  297.                 jmp     reformat
  298.  
  299. step_no_input:  jmp     no_input
  300.  
  301. notalldone:     mov     al,byte ptr [si]
  302.  
  303.                 cmp     al,061h         ; 'a'     checking for letters or other chars
  304.                 jge     letsee3
  305.                 cmp     al,041h         ; 'A'
  306.                 jge     letsee4
  307.                 jmp     nolet
  308.  
  309. letsee3:        cmp     al,07bh         ;'z'
  310.                 jge     nolet
  311.                 sub     al,020h         ;capitalize
  312.                 jmp     putitinmem
  313.  
  314. letsee4:        cmp     al,05bh         ;'Z'
  315.                 jge     nolet
  316.  
  317. putitinmem:     mov     di,si
  318.                 sub     di,dx
  319.                 mov     byte ptr [di],al
  320.                 dec     bx
  321.                 inc     si
  322.                 jmp     loopstart
  323.  
  324. nolet:          inc     dx
  325.                 dec     bx
  326.                 inc     si
  327.                 jmp     loopstart
  328.  
  329. reformat:       xor     bx,bx
  330.                 mov     si,offset keyb
  331.                 mov     bl,byte ptr [si+1]  ;get number of chars put in by user
  332.                 sub     bx,dx               ;substract number of not-letters
  333.                 cmp     bl,000h
  334.                 jz      no_input
  335.                 cmp     bl,010h
  336.                 jg      strip               ;if name is over 16, strip 6th to ...
  337.  
  338.                 mov     si,offset keyb      ;if name is =< 16 chars, repeat till full
  339.                 add     si,002h
  340.                 mov     di,offset should_be
  341.                 add     di,006h
  342.                 mov     al,010h
  343.                 div     bl             ;full times to repeat is in al, remaining is in ah
  344.                                        ;(bl= number of valid letters in code)
  345.  
  346. loopje:         mov     si,offset keyb      ;if name is =< 16 chars, repeat till full
  347.                 add     si,002h
  348.                 mov     cl,bl
  349.                 repz    movsb                 ;put it in once
  350.                 dec     al                    ;one done
  351.                 cmp     al,000h               ;check if needs repeating
  352.                 jz      last_time             ;no, go put in remaining
  353.                 jmp     loopje                ;yes, do it again
  354.  
  355. last_time:      mov     si,offset keyb
  356.                 add     si,002h
  357.                 mov     cl,ah
  358.                 repz    movsb          ;put in the remaining chars
  359.                 ret
  360.  
  361. strip:          mov     si,offset keyb
  362.                 add     si,002h
  363.                 mov     di,offset should_be
  364.                 add     di,006h
  365.                 mov     cl,006h
  366.                 repz    movsb                      ;put 1st 6 in place
  367.                 xor     ax,ax
  368.                 mov     al,bl
  369.                 mov     cl,002h
  370.                 div     cl
  371.                 mov     si,offset keyb
  372.                 xor     cx,cx
  373.                 mov     cl,al
  374.                 add     si,cx                   ;put next 4 in place
  375.                 mov     cl,004h
  376.                 repz    movsb
  377.                 sub     bl,004h                  ;six from end, the two non chars
  378.                                                  ;from beginning 'keyb' counted
  379.                 mov     si,offset keyb
  380.                 add     si,bx
  381.                 mov     cl,006h
  382.                 repz    movsb
  383.                 ret
  384.  
  385. no_input:       mov     dx,offset notright
  386.                 mov     ah,009h
  387.                 int     21h
  388.                 jmp     exit
  389.  
  390.  
  391.  read_input     endp
  392. ;******************************************************************************
  393. ;       spam  the code
  394. ;******************************************************************************
  395.  
  396. spam            PROC    near
  397.                 mov     ax,@data
  398.                 mov     ds,ax
  399.                 mov     es,ax
  400.                 mov     di,offset should_be
  401.                 mov     al,byte ptr[di]
  402.                 cmp     al,'S'
  403.                 MOV     AH,09H
  404.                 jnz     wormessage
  405.                 MOV     DX,offset personals        ;display personal message
  406.                 INT     21H
  407.                 jmp     dispcode
  408.  
  409. wormessage:     MOV     DX,offset personalw        ;display personal message
  410.                 INT     21H
  411.  
  412. dispcode:       MOV     AH,09H
  413.                 MOV     DX,offset to_enter        ;display right code
  414.                 INT     21H
  415.                 RET
  416.  
  417. spam            endp
  418.  
  419.  
  420. ;******************************************************************************
  421. ;       the main program
  422. ;******************************************************************************
  423.  
  424. begin           PROC    near
  425.                 mov     ax,@data
  426.                 mov     ds,ax
  427.                 mov     es,ax
  428.                 MOV     AH,09H
  429.                 MOV     DX,offset header        ;display header
  430.                 INT     21H
  431.                 CALL    input         ;get user input
  432.                 call    read_input
  433.  
  434.                 CALL    calculate               ;calculate code from input
  435.                 call    checksum                ;calculate last char
  436.                 CALL    spam                    ;spam calculated code
  437.  
  438. exit:           MOV     AX,4C00H                ;and exit
  439.                 INT     21H
  440.  
  441. begin           ENDP
  442.  
  443. END     START
  444.