home *** CD-ROM | disk | FTP | other *** search
/ Phoenix Rising BBS / phoenixrising.zip / phoenixrising / vir-docs / crptlt18.arj / KRTTDEMO.ASM < prev    next >
Assembly Source File  |  1993-08-31  |  5KB  |  144 lines

  1. ;********************************************************************************
  2. ; KRTTdemo.ASM
  3. ; AUTHOR:      Köhntark
  4. ; DATE:        27 August 1993
  5. ;********************************************************************************
  6.  
  7. ;***************************************************************
  8. ; TUNNEL 4.1 procedure usage:
  9.  
  10. ; INPUT:   
  11. ;          bp=01                 => search for original INT 2Ah
  12. ;          bp=02                 => search for original INT 13h
  13. ;          any other value in bp => search for original INT 21h
  14.  
  15.  
  16. ; OUTPUT: ah=00  Not found 
  17. ;         ah=01  Found! 
  18. ;         ah=02  Int 21h / 2Ah / 13h  Not Hooked
  19. ;         ah=03  DOS internal interrupts are hooked
  20. ;         If found:
  21. ;         dx=    DOS INT 21h / 2Ah / 13h SEGMENT
  22. ;         di=    INT 21h  / 2Ah / 13h OFFSET
  23. ;         al=    RECURSION DEPT
  24. ; DESTROYED: ax,bx,cx,dx,di,bp,es
  25. ;***************************************************************
  26.  
  27. extrn TUNNEL:proc
  28.  
  29. MAIN    SEGMENT BYTE
  30.         ASSUME cs:main,ds:main,ss:nothing      ;all part in one segment=com file
  31.         org    100h
  32.  
  33. START:
  34.          mov  ah,09                            ;otherwise ...
  35.          lea  dx,[FIRST_MSG]                   ;display KREATOR's msg
  36.          int  21h
  37.          
  38.          push es                              ;save necessary registers
  39.          call TUNNEL                          ;call TUNNELING ENGINE
  40.          pop  es                              ;restore necessary registers
  41.          
  42.          mov  cx,ax                           ;save return codes
  43.          mov  ah,09                           ;print found message
  44.          
  45.          cmp  ch,00                           ;was int 21h found?
  46.          je   NOT_FOUND
  47.          
  48.          cmp  ch,03                           ;TROUBLE?
  49.          je   TROUBLE
  50.          
  51.          mov  bp,dx                           ;bp=int 21h segment, di = offset
  52.          
  53.          cmp  ch,02                           ;was int 21h found?
  54.          je   NOT_HOOKED
  55.  
  56.          cmp  ch,01                           ;is int 21h hooked?
  57.          jne  TROUBLE
  58.  
  59.          lea  dx,[FOUND_MSG]
  60.          int  21h
  61.          
  62.          lea  dx,[OFFSET_MSG]                 ;display header
  63.          int  21h
  64.  
  65.          mov  bx,di                           ;display offset found
  66.          call BIN_TO_HEX
  67.  
  68.          lea  dx,[SEGMENT_MSG]                ;display header       
  69.          int  21h
  70.  
  71.          mov  bx,bp                           ;display segment found
  72.          call BIN_TO_HEX
  73.               
  74.          lea  dx,[RECURSION_DEPT_MSG]         ;display header       
  75.          int  21h
  76.  
  77.          and  cx,000FFh                       ;cx=cl
  78.          mov  bx,cx                           ;recursion dept count
  79.          call BIN_TO_HEX
  80.  
  81.          int  20h                             ;exit
  82.  
  83.  
  84. NOT_HOOKED:     lea  dx,[OK_MSG]
  85.                 int  21h
  86.                 int  20h
  87.  
  88. NOT_FOUND:      lea  dx,[SAD_MSG]
  89.                 int  21h
  90.                 int  20h
  91.  
  92. TROUBLE:        lea  dx,[TROUBLE_MSG]
  93.                 int  21h
  94.                 int  20h
  95.  
  96. ;*****************************************************************************
  97.  
  98. BIN_TO_HEX:
  99.             push cx       ;save registers
  100.             push dx
  101.             push ax
  102.  
  103.             mov  ch,04    ;# of digits to process
  104. ROTATE:     mov  cl,04    ;# of bits to rotate
  105.             rol  bx,cl    ;rotate bx l to r
  106.             mov  al,bl    ;move to al  (2 digits)
  107.             and  al,0Fh   ;mask off upper digit
  108.             add  al,30h   ;convert to ASCII
  109.             cmp  al,3Ah   ;is it > 9?
  110.             jl   PRINTIT  ;jump of digit =0 to 9
  111.             add  al,07h   ;digit is A to F
  112. PRINTIT:
  113.             mov dl,al
  114.             mov ah,2     ;INT 21h function
  115.             int 21h      ;print character
  116.             dec ch
  117.             jnz ROTATE
  118.  
  119.             pop  ax      ;restore registers
  120.             pop  dx
  121.             pop  cx
  122.             ret
  123.  
  124. ;****************************************************************************
  125.  
  126. FIRST_MSG      db  '════════════════════════════════',13d,10d
  127.                db  '  KöhntarK',027h,'s Tunneling Toolkit  ',13d,10d
  128.                db  '    Version 4.1 DEMO (C) 1993   ',13d,10d
  129.                db  '════════════════════════════════',13d,10d,13d,10d,'$'
  130.  
  131. OK_MSG             db  'INT 21h not hooked. ',13d,10d,'$'
  132. FOUND_MSG          db  'ORIGINAL INT 21h FOUND! ',13d,10d,'$'
  133. OFFSET_MSG         db  'INT 21h OFFSET FOUND:  ','$'
  134. SEGMENT_MSG        db  13d,10d,'INT 21h SEGMENT FOUND: ','$'
  135. SAD_MSG            db  'COULDN',027h,'T FIND INT 21h ! ',13d,10d,'$'
  136. RECURSION_DEPT_MSG db  13d,10d,'RECURSION DEPT: ','$'
  137. TROUBLE_MSG        db  'Internal DOS interrupts hooked ',13d,10d,'$'
  138.  
  139. INT_21_OFF         dw  0      
  140. INT_21_SEG         dw  0      
  141.  
  142. MAIN ENDS
  143.      END START
  144.