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.  
  3. .model small
  4.  
  5. .stack 100h
  6.  
  7. .data
  8.  
  9.  
  10.  
  11. ;******************************************************************************
  12.  
  13. ;   variables for code gen
  14.  
  15. ;
  16.  
  17. ;******************************************************************************
  18.  
  19.  
  20.  
  21.  
  22.  
  23.  
  24.  
  25. header          DB ' Hypersnap-DX 3.02 license generator by +SNiKkEL',0ah,0dh,0ah,0dh,'$'
  26.  
  27. info            DB 0ah,0dh,' for some reason they decided to insert a ',027h,'-',027h,' into the code',0ah,0dh
  28.  
  29.                 DB ' invalid names are:',0ah,0dh
  30.  
  31.                 DB ' xygorf, Saltine, super user, tHATDUDE, ED!SON and hacker... sigh',0ah,0dh
  32.  
  33.                 db 0ah,0dh,'enter any name:',0ah,0dh,' $'
  34.  
  35. notright        db 0ah,0dh,' your name must contain at least one letter',0ah,0dh,'$'
  36.  
  37. should_be       DB 'WORDXCJOSEFMENGELEJOSE',0   ;this is the regcode before 'encryption'
  38.  
  39.                  ;WOR = world license (SIT = site license)  DXC = some check
  40.  
  41.                  ;the rest is the name; snikkel will be SNIKKELSNIKKELSN
  42.  
  43.                  ;the alphabet will be  A t/m F + L t/m o + U t/m Z  (over 16 chars)
  44.  
  45.                  ;according to this principle: divide total letters in name by 2
  46.  
  47.                  ;sub 2 from answer and get 4 chars from beginning of name+answer
  48.  
  49.                  ;put those 4 after first 6 chars, then put the last 6 letters in the
  50.  
  51.                  ;name at the end  (spaces, numbers etc are ignored, all letters must be capitalized)
  52.  
  53. fifthchar       db 0ah,0dh,0ah,0dh,'what would you like to be the 5th letter in your code?',0ah,0dh
  54.  
  55.                 db ' enter anything from a to z',0ah,0dh,' $'
  56.  
  57. wrong           db 'anything from a to z, isn',027h,'t that enuff?',0ah,0dh,' $'
  58.  
  59. wagain          db 'why don',027h,'t you just fuck off',0ah,0dh,'$'
  60.  
  61. whatkind        db 0ah,0dh,'would you like a site or a worldwide license? (s or w)',0ah,0dh,' $'
  62.  
  63. personals       db 0ah,0dh,0ah,0dh,' your personal unlimited site license code is:',0ah,0dh,0ah,0dh,' $'
  64.  
  65. personalw       db 0ah,0dh,0ah,0dh,' your personal unlimited world-wide license code is:',0ah,0dh,0ah,0dh,' $'
  66.  
  67. to_enter        DB 'S2345678901234-6789012345',0ah,0dh,0ah,0dh,'$'   ;the code will be put here
  68.  
  69.                                                            ;the S is the fifth char on which the 1st letter depends
  70.  
  71. encodestr       DB 'XCFNAKSHIPZUJLDORGVQTEWYBM',0         ;according to this the letters will be 'encoded'
  72.  
  73. checks          Dw 0                                      ;checksum (last char) will be put here
  74.  
  75. keyb            db  033h,033h,034h  dup (0)               ;keyboard buffer, place for input
  76.  
  77.  
  78.  
  79. ;******************************************************************************
  80.  
  81. ;       end of data, begin of code
  82.  
  83. ;******************************************************************************
  84.  
  85.  
  86.  
  87. .code
  88.  
  89. start:          JMP     begin
  90.  
  91.  
  92.  
  93. ;******************************************************************************
  94.  
  95. ;       calculate code proc
  96.  
  97. ;******************************************************************************
  98.  
  99.  
  100.  
  101. calculate       PROC    near
  102.  
  103.                 mov     ax,@data
  104.  
  105.                 mov     ds,ax
  106.  
  107.                 mov     es,ax
  108.  
  109.                 xor     bx,bx
  110.  
  111.                 mov     cx,00001h
  112.  
  113.                 xor     dx,dx
  114.  
  115.  
  116.  
  117. go:             mov     si,offset should_be
  118.  
  119.                 add     si,bx
  120.  
  121.                 MOV     al,byte ptr [si]              ;put byte of name you want in al
  122.  
  123.                 cmp     al,000h
  124.  
  125.                 jz      done
  126.  
  127.                 mov     si,offset to_enter
  128.  
  129.                 cmp     cx,00010h
  130.  
  131.                 jnz     dont_use_the_2D_for_calculating
  132.  
  133.                 inc     dx      ;make it skip the '-' for calculating next
  134.  
  135.                 inc     dx
  136.  
  137. dont_use_the_2D_for_calculating:
  138.  
  139.                 add     si,bx
  140.  
  141.                 add     si,dx
  142.  
  143.                 mov     ah,byte ptr [si]    ;put byte in ah for substracting (adding)
  144.  
  145.  
  146.  
  147.                 inc     al
  148.  
  149.                 cmp     bx,00000h
  150.  
  151.                 jz      fifth
  152.  
  153.                 jmp     continue
  154.  
  155.  
  156.  
  157. fifth:          mov     si,offset to_enter
  158.  
  159.                 add     si,00004h              ;put the 1st char in should_be
  160.  
  161.                 MOV     [si],ah                ;in the right place fer output
  162.  
  163.                 sub     dx,001h
  164.  
  165.  
  166.  
  167. continue:       sub     ah,041h
  168.  
  169.                 sub     al,041h
  170.  
  171.                 add     al,ah
  172.  
  173.                 cmp     al,01ah
  174.  
  175.                 jge     rotate
  176.  
  177.                 jmp     continue2
  178.  
  179.  
  180.  
  181. rotate:         sub     al,01ah
  182.  
  183.  
  184.  
  185. continue2:      mov     si,offset encodestr
  186.  
  187.                 mov     ah,000h
  188.  
  189.                 add     si,ax
  190.  
  191.                 MOV     al,byte ptr [si]
  192.  
  193.                 cmp     cx,0000eh
  194.  
  195.                 jnz     dont_overwrite_the_2D_check
  196.  
  197.                 inc     cx
  198.  
  199.                 dec     dx       ; make it read the char before the '-' for calculating
  200.  
  201. dont_overwrite_the_2D_check:
  202.  
  203.                 cmp     cx,00005h
  204.  
  205.                 jg      fifth2
  206.  
  207.                 jz      incdx
  208.  
  209.                 jmp     continue3
  210.  
  211.  
  212.  
  213. incdx:          inc     dx
  214.  
  215.  
  216.  
  217. fifth2:         mov     si,offset to_enter
  218.  
  219.                 add     si,cx
  220.  
  221.                 MOV     byte ptr [si],al
  222.  
  223.                 inc     bx
  224.  
  225.                 inc     cx
  226.  
  227.                 jmp     go
  228.  
  229.  
  230.  
  231. continue3:      mov     si,offset to_enter
  232.  
  233.                 add     si,bx
  234.  
  235.                 MOV     byte ptr [si],al
  236.  
  237.                 inc     bx
  238.  
  239.                 inc     cx
  240.  
  241.                 jmp     go
  242.  
  243.  
  244.  
  245. done:           RET                             ;return
  246.  
  247.  
  248.  
  249. calculate       ENDP
  250.  
  251.  
  252.  
  253. ;******************************************************************************
  254.  
  255. ;       this part asks for name
  256.  
  257. ;******************************************************************************
  258.  
  259.  
  260.  
  261. input           PROC    near
  262.  
  263.                 mov     ax,@data
  264.  
  265.                 mov     ds,ax
  266.  
  267.                 mov     es,ax
  268.  
  269.  
  270.  
  271.                 MOV     ah,09h
  272.  
  273.                 mov     dx,offset info             ;spam info
  274.  
  275.                 int     21h
  276.  
  277.                 mov     dx,offset keyb
  278.  
  279.                 mov     ah,0ah
  280.  
  281.                 int     21h                        ;and get user name
  282.  
  283.  
  284.  
  285.                 MOV     AH,09H
  286.  
  287.                 MOV     DX,offset fifthchar        ;display fifth char message
  288.  
  289.                 INT     21H
  290.  
  291.                 xor     cx,cx
  292.  
  293.  
  294.  
  295. get5char:       mov     ax,0c07h        ;clear keyb buffer & wait for input
  296.  
  297.                 int        21h
  298.  
  299.                 cmp     al,061h         ; 'a'
  300.  
  301.                 jge     letsee
  302.  
  303.                 cmp     al,041h         ; 'A'
  304.  
  305.                 jge     letsee2
  306.  
  307.                 jmp     wrongg
  308.  
  309.  
  310.  
  311. letsee:         cmp     al,07bh         ;'z'
  312.  
  313.                 jge     wrongg
  314.  
  315.                 sub     al,020h
  316.  
  317.                 jmp     putitin
  318.  
  319.  
  320.  
  321. letsee2:        cmp     al,05bh         ;'Z'
  322.  
  323.                 jge     wrongg
  324.  
  325.  
  326.  
  327. putitin:        mov     si,offset to_enter
  328.  
  329.                 MOV     byte ptr [si],al
  330.  
  331.  
  332.  
  333.                 MOV     AH,09H
  334.  
  335.                 MOV     DX,offset whatkind        ;display question
  336.  
  337.                 INT     21H
  338.  
  339.  
  340.  
  341. getregmode:     mov     ax,0c07h        ;clear keyb buffer & wait for input
  342.  
  343.                 int        21h
  344.  
  345.                 cmp     al,073h         ; 's'
  346.  
  347.                 jz      sitelic
  348.  
  349.                 cmp     al,041h         ; 'S'
  350.  
  351.                 jz      sitelic
  352.  
  353.                 cmp     al,077h         ;'w'
  354.  
  355.                 jz      worldlic
  356.  
  357.                 cmp     al,057h         ;'W'
  358.  
  359.                 jz      worldlic
  360.  
  361.                 jmp     getregmode
  362.  
  363.  
  364.  
  365. sitelic:        mov     si,offset should_be
  366.  
  367.                 MOV     byte ptr [si],'S'
  368.  
  369.                 MOV     byte ptr [si+1],'I'
  370.  
  371.                 MOV     byte ptr [si+2],'T'
  372.  
  373.                 ret
  374.  
  375.  
  376.  
  377. worldlic:       mov     si,offset should_be
  378.  
  379.                 MOV     byte ptr [si],'W'
  380.  
  381.                 MOV     byte ptr [si+1],'O'
  382.  
  383.                 MOV     byte ptr [si+2],'R'
  384.  
  385.                 ret
  386.  
  387.  
  388.  
  389. wrongg:         cmp     cx,001h
  390.  
  391.                 jz      wrongagain
  392.  
  393.                 mov     ah,09h
  394.  
  395.                 mov     dx,offset wrong
  396.  
  397.                 int        21h
  398.  
  399.                 inc     cx
  400.  
  401.                 jmp     get5char
  402.  
  403.  
  404.  
  405. wrongagain:     mov     ah,09h
  406.  
  407.                 mov     dx,offset wagain
  408.  
  409.                 int        21h
  410.  
  411.                 jmp     exit
  412.  
  413.  
  414.  
  415.  
  416.  
  417. ret
  418.  
  419.  
  420.  
  421. input           endp
  422.  
  423.  
  424.  
  425. ;******************************************************************************
  426.  
  427. ;       calculate checksum
  428.  
  429. ;******************************************************************************
  430.  
  431.  
  432.  
  433. checksum        PROC    near
  434.  
  435.                 mov     ax,@data
  436.  
  437.                 mov     ds,ax
  438.  
  439.                 mov     es,ax
  440.  
  441.                 xor     cx,cx
  442.  
  443.                 mov     di,offset checks
  444.  
  445.  
  446.  
  447. go2:            mov     si,offset should_be
  448.  
  449.                 xor     ax,ax
  450.  
  451.                 cmp     cx,016h
  452.  
  453.                 jz      cal_char
  454.  
  455.                 add     si,cx
  456.  
  457.                 MOV     al,byte ptr [si]              ;put byte of calculated in al
  458.  
  459.                 sub     al,041h
  460.  
  461.                 push    ax
  462.  
  463.                 push    cx
  464.  
  465.                 mov     ax,cx
  466.  
  467.                 mov     cx,00002h
  468.  
  469.                 div     cx
  470.  
  471.                 pop     cx
  472.  
  473.                 pop     ax
  474.  
  475.                 test    dx,dx
  476.  
  477.                 jz     nodouble
  478.  
  479.                 add     ax,ax
  480.  
  481.  
  482.  
  483. nodouble:       cmp     ax,0001ah
  484.  
  485.                 jb      allrighty
  486.  
  487.                 sub     ax,00019h
  488.  
  489.  
  490.  
  491. allrighty:      add     [di],ax
  492.  
  493.                 inc     cx
  494.  
  495.                 jmp     go2
  496.  
  497.  
  498.  
  499. cal_char:       mov     ax,[di]
  500.  
  501.                 mov     cx,01ah
  502.  
  503.                 xor     dx,dx
  504.  
  505.                 div     cx
  506.  
  507.                 mov     bx,dx
  508.  
  509.                 inc     bl
  510.  
  511.                 mov     si,offset to_enter+017h   ;added one here, made it read the last char
  512.  
  513.                 mov     bh,byte ptr [si]
  514.  
  515.                 sub     bh,041h
  516.  
  517.                 add     bl,bh
  518.  
  519.                 cmp     bl,01ah
  520.  
  521.                 jge     rotate2
  522.  
  523.                 jmp     go_on
  524.  
  525.  
  526.  
  527. rotate2:        sub     bl,01ah
  528.  
  529.  
  530.  
  531. go_on:          mov     si,offset encodestr
  532.  
  533.                 mov     bh,000h
  534.  
  535.                 add     si,bx
  536.  
  537.                 MOV     bl,byte ptr [si]
  538.  
  539.                 mov     si,offset to_enter+018h     ;added one here cause of the '-'
  540.  
  541.                 mov     byte ptr [si],bl
  542.  
  543.  
  544.  
  545.                 RET
  546.  
  547.  
  548.  
  549. checksum        endp
  550.  
  551.  
  552.  
  553. ;******************************************************************************
  554.  
  555. ;      check and shape up user input
  556.  
  557. ;******************************************************************************
  558.  
  559.  
  560.  
  561.  read_input     proc    near
  562.  
  563.                 mov     ax,@data
  564.  
  565.                 mov     ds,ax
  566.  
  567.                 mov     es,ax
  568.  
  569.                 xor     dx,dx
  570.  
  571.                 xor     ax,ax
  572.  
  573.                 xor     cx,cx
  574.  
  575.                 mov     si,offset keyb
  576.  
  577.                 mov     al,byte ptr [si+1]  ;get number of chars put in by user
  578.  
  579.                 cmp     al,000h
  580.  
  581.                 jz      step_no_input            ;number is zero
  582.  
  583.                 mov     bx,ax
  584.  
  585.                 add     si,2              ;move si to beginning of input
  586.  
  587.  
  588.  
  589. loopstart:      cmp     bx,000h
  590.  
  591.                 jnz     notalldone
  592.  
  593.                 jmp     reformat
  594.  
  595.  
  596.  
  597. step_no_input:  jmp     no_input
  598.  
  599.  
  600.  
  601. notalldone:     mov     al,byte ptr [si]
  602.  
  603.  
  604.  
  605.                 cmp     al,061h         ; 'a'     checking for letters or other chars
  606.  
  607.                 jge     letsee3
  608.  
  609.                 cmp     al,041h         ; 'A'
  610.  
  611.                 jge     letsee4
  612.  
  613.                 jmp     nolet
  614.  
  615.  
  616.  
  617. letsee3:        cmp     al,07bh         ;'z'
  618.  
  619.                 jge     nolet
  620.  
  621.                 sub     al,020h         ;capitalize
  622.  
  623.                 jmp     putitinmem
  624.  
  625.  
  626.  
  627. letsee4:        cmp     al,05bh         ;'Z'
  628.  
  629.                 jge     nolet
  630.  
  631.  
  632.  
  633. putitinmem:     mov     di,si
  634.  
  635.                 sub     di,dx
  636.  
  637.                 mov     byte ptr [di],al
  638.  
  639.                 dec     bx
  640.  
  641.                 inc     si
  642.  
  643.                 jmp     loopstart
  644.  
  645.  
  646.  
  647. nolet:          inc     dx
  648.  
  649.                 dec     bx
  650.  
  651.                 inc     si
  652.  
  653.                 jmp     loopstart
  654.  
  655.  
  656.  
  657. reformat:       xor     bx,bx
  658.  
  659.                 mov     si,offset keyb
  660.  
  661.                 mov     bl,byte ptr [si+1]  ;get number of chars put in by user
  662.  
  663.                 sub     bx,dx               ;substract number of not-letters
  664.  
  665.                 cmp     bl,000h
  666.  
  667.                 jz      no_input
  668.  
  669.                 cmp     bl,010h
  670.  
  671.                 jg      strip               ;if name is over 16, strip 6th to ...
  672.  
  673.  
  674.  
  675.                 mov     si,offset keyb      ;if name is =< 16 chars, repeat till full
  676.  
  677.                 add     si,002h
  678.  
  679.                 mov     di,offset should_be
  680.  
  681.                 add     di,006h
  682.  
  683.                 mov     al,010h
  684.  
  685.                 div     bl             ;full times to repeat is in al, remaining is in ah
  686.  
  687.                                        ;(bl= number of valid letters in code)
  688.  
  689.  
  690.  
  691. loopje:         mov     si,offset keyb      ;if name is =< 16 chars, repeat till full
  692.  
  693.                 add     si,002h
  694.  
  695.                 mov     cl,bl
  696.  
  697.                 repz    movsb                 ;put it in once
  698.  
  699.                 dec     al                    ;one done
  700.  
  701.                 cmp     al,000h               ;check if needs repeating
  702.  
  703.                 jz      last_time             ;no, go put in remaining
  704.  
  705.                 jmp     loopje                ;yes, do it again
  706.  
  707.  
  708.  
  709. last_time:      mov     si,offset keyb
  710.  
  711.                 add     si,002h
  712.  
  713.                 mov     cl,ah
  714.  
  715.                 repz    movsb          ;put in the remaining chars
  716.  
  717.                 ret
  718.  
  719.  
  720.  
  721. strip:          mov     si,offset keyb
  722.  
  723.                 add     si,002h
  724.  
  725.                 mov     di,offset should_be
  726.  
  727.                 add     di,006h
  728.  
  729.                 mov     cl,006h
  730.  
  731.                 repz    movsb                      ;put 1st 6 in place
  732.  
  733.                 xor     ax,ax
  734.  
  735.                 mov     al,bl
  736.  
  737.                 mov     cl,002h
  738.  
  739.                 div     cl
  740.  
  741.                 mov     si,offset keyb
  742.  
  743.                 xor     cx,cx
  744.  
  745.                 mov     cl,al
  746.  
  747.                 add     si,cx                   ;put next 4 in place
  748.  
  749.                 mov     cl,004h
  750.  
  751.                 repz    movsb
  752.  
  753.                 sub     bl,004h                  ;six from end, the two non chars
  754.  
  755.                                                  ;from beginning 'keyb' counted
  756.  
  757.                 mov     si,offset keyb
  758.  
  759.                 add     si,bx
  760.  
  761.                 mov     cl,006h
  762.  
  763.                 repz    movsb
  764.  
  765.                 ret
  766.  
  767.  
  768.  
  769. no_input:       mov     dx,offset notright
  770.  
  771.                 mov     ah,009h
  772.  
  773.                 int     21h
  774.  
  775.                 jmp     exit
  776.  
  777.  
  778.  
  779.  
  780.  
  781.  read_input     endp
  782.  
  783. ;******************************************************************************
  784.  
  785. ;       spam  the code
  786.  
  787. ;******************************************************************************
  788.  
  789.  
  790.  
  791. spam            PROC    near
  792.  
  793.                 mov     ax,@data
  794.  
  795.                 mov     ds,ax
  796.  
  797.                 mov     es,ax
  798.  
  799.                 mov     di,offset should_be
  800.  
  801.                 mov     al,byte ptr[di]
  802.  
  803.                 cmp     al,'S'
  804.  
  805.                 MOV     AH,09H
  806.  
  807.                 jnz     wormessage
  808.  
  809.                 MOV     DX,offset personals        ;display personal message
  810.  
  811.                 INT     21H
  812.  
  813.                 jmp     dispcode
  814.  
  815.  
  816.  
  817. wormessage:     MOV     DX,offset personalw        ;display personal message
  818.  
  819.                 INT     21H
  820.  
  821.  
  822.  
  823. dispcode:       MOV     AH,09H
  824.  
  825.                 MOV     DX,offset to_enter        ;display right code
  826.  
  827.                 INT     21H
  828.  
  829.                 RET
  830.  
  831.  
  832.  
  833. spam            endp
  834.  
  835.  
  836.  
  837.  
  838.  
  839. ;******************************************************************************
  840.  
  841. ;       the main program
  842.  
  843. ;******************************************************************************
  844.  
  845.  
  846.  
  847. begin           PROC    near
  848.  
  849.                 mov     ax,@data
  850.  
  851.                 mov     ds,ax
  852.  
  853.                 mov     es,ax
  854.  
  855.                 MOV     AH,09H
  856.  
  857.                 MOV     DX,offset header        ;display header
  858.  
  859.                 INT     21H
  860.  
  861.                 CALL    input         ;get user input
  862.  
  863.                 call    read_input
  864.  
  865.  
  866.  
  867.                 CALL    calculate               ;calculate code from input
  868.  
  869.                 call    checksum                ;calculate last char
  870.  
  871.                 CALL    spam                    ;spam calculated code
  872.  
  873.  
  874.  
  875. exit:           MOV     AX,4C00H                ;and exit
  876.  
  877.                 INT     21H
  878.  
  879.  
  880.  
  881. begin           ENDP
  882.  
  883.  
  884.  
  885. END     START
  886.  
  887.