home *** CD-ROM | disk | FTP | other *** search
/ Collection of Hack-Phreak Scene Programs / cleanhpvac.zip / cleanhpvac / ASM-T.ZIP / TBOOT.ASM < prev    next >
Assembly Source File  |  1994-10-06  |  5KB  |  172 lines

  1. ;This is a disassembly of Thunderbyte's anti-viral partition code.
  2. ;An org statement was not used because it appears that all offsets used 
  3. ;herein are either relative or absolute, i.e. it just doesn't matter.
  4. ;This should be compiled as a binary image file, it *WILL NOT* create 
  5. ;an executable file. This code is exactly 512 bytes long and should be 
  6. ;implanted into the hard drive at physical sector 1, cylinder 0, head 0
  7. ;using the BIOS direct write to disk function. *DO NOT* use DOS write to 
  8. ;disk functions or DEBUG because these functions can't access hidden sectors
  9. ;and you'll probably just overwrite the disk drive.
  10.  
  11. ;have fun, folks!
  12.  
  13. code_start:
  14.  
  15.         cli                     ;no interrupts
  16.         xor     cx, cx
  17.         mov     ss, cx
  18.         mov     sp, 7c00h
  19.         mov     si, sp
  20.         sti
  21.         cld
  22.  
  23.         mov     es, cx          ;cs already equals 0
  24.         mov     ds, cx
  25.  
  26.         mov     di, 0600h       ;
  27.  
  28.         mov     ch, 01          ;cx = 100h
  29.         repz    movsw           ;mov 200h bytes from 0000:7c00h to 0000:0600h
  30.                                 ;to make room for boot sector
  31.  
  32. jump_pt db      0e9h, 00, 8ah   ;this will act like far jmp to first_pt label
  33.                                 ;i.e. 0000:061ah, wraps around segment
  34. first_pt:                       ;when execution continues, this will be offset
  35.                                 ;061ah here
  36.         mov     si, 06ddh
  37.         call    routine_1
  38.         mov     si, 07eeh
  39.         call    routine_2
  40.         mov     bp, si
  41.         mov     si, 0733h
  42.         jb      second_pt
  43.         
  44.         mov     bx, sp          ;buffer at stack pointer (7c00h?)
  45.         mov     ax, 0201h       ;func 2, 1 sector - possibily boot sector?
  46.         int     13h             ;BIOS read sector
  47.  
  48.         mov     si, 0725h
  49. second_pt:
  50.         jb      sixth_pt
  51.  
  52.         mov     si, 745h
  53.         call    routine_1
  54.         call    routine_1
  55.                 
  56.         mov     si, 7c40h
  57.         mov     cx, 01c0h
  58. loop_1:
  59.         xchg    ax, bx
  60.         shl     bx, 1
  61.         lodsb                   ;from 0000:7c40h
  62.         add     ax, bx
  63.         mov     ah, bh
  64.         test    ah, ah
  65.         jns     third_pt
  66.         xor     ax, 0a097h
  67. third_pt:
  68.         loop    loop_1
  69.  
  70.         cmp     ax, 7805h
  71.         jnz     fourth_pt
  72.         mov     si, 0740h
  73.         call    routine_1
  74.  
  75.         mov     si, 0762h
  76.         call    01cdh
  77.         mov     dx, [si + 0fc9fh]
  78.         cmp     dx, 27eh
  79.         jb      fourth_pt
  80.  
  81.         mov     si, 740h
  82.         call    routine_1
  83.         mov     si, 774h
  84.         call    routine_1
  85.  
  86.         les     ax, [004c]
  87.         mov     bx, es
  88.         mov     cl, 04
  89.         shr     ax, cl
  90.         add     ax, bx
  91.         inc     cx
  92.         inc     cx
  93.         shl     dx, cl
  94.         cmp     ax, dx
  95.         jnb     fifth_pt
  96.  
  97. fourth_pt:
  98.         mov     si, 0787h
  99.         call    routine_1
  100.         int     16h
  101.         mov     si, 783h
  102.         or      al, 20h
  103.         cmp     al, 79h
  104.         jnz     seventh_pt
  105.  
  106. fifth_pt:
  107.         call    routine_1
  108.         mov     si, bp
  109.         mov     dx, [si]
  110.         jmp     sp              ;control goes to boot sector
  111.  
  112. sixth_pt:
  113.         call    routine_1
  114.         int     16h
  115.  
  116. seventh_pt:
  117.         int     18h             ;rom BASIC!
  118.  
  119. eighth_pt:
  120.         jmp     eighth_pt        ;infinite loop Lock Up!
  121.  
  122.  
  123. routine_2:
  124.         lea     di, [si - 30h]
  125. boot_chk:
  126.         cmp     byte ptr [si], 80h      ;looks like check for bootable parttn
  127.         jz      bootable
  128.         sub     si, 10h
  129.         cmp     si, di
  130.         jnb     boot_chk
  131.         ret
  132. bootable:
  133.         mov     dx, [si]
  134.         mov     cx, [si + 2]
  135. return_pt:
  136.         ret
  137.  
  138. routine_1:
  139.         lodsb
  140.         cbw                             ;convert to word
  141.         test    ax, ax                  ;huh?
  142.         jz      return_pt               ;like ret to original caller      
  143.                         
  144.         mov     ah, 0eh
  145.         xor     bx, bx
  146.         push    si
  147.         int     10h
  148.         pop     si
  149.         jmp     routine_1
  150.  
  151. code_end:
  152.  
  153.         msg1    db      13, 10, "Thunderbyte anti-virus partition "
  154.                 db      "v6.24 (C) 1993-94 Thunderbyte BV.", 13, 10, 10, 0
  155.         msg2    db      "Disk error!", 13, 10, 00
  156.         msg3    db      "No system!", 13, 10, 00
  157.         msg4    db      "OK!", 13, 10,"Checking ",0
  158.         msg5    db      "bootsector CRC -> ",0
  159.         msg6    db      "available RAM -> ",0
  160.         msg7    db      "INT 13h -> ",0
  161.         msg8    db      "OK!",13, 10, 10, 0
  162.         msg9    db      "Failed!", 13, 10, "System might be infected. Continue? (N/Y)", 07, 0
  163.  
  164.         misc    db      0, 0, 0, 80h, 01h, 01, 0, 06, 0dh, 0feh, 0f8h
  165.                 db      03eh, 0, 0, 0, 06h, 78h, 0dh, 0, 0, 0
  166.                 db      10h     dup(0)
  167.                 db      10h     dup(0)
  168.                 db      0eh     dup(0)
  169.  
  170.         id_sig  db      55h, 0aah
  171.  
  172.