Advertisement
Sajgoniarz

Remote Shutdown (wrong)

Jan 23rd, 2015
246
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.99 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. #include <conio.h>
  4.  
  5. using namespace std;
  6.  
  7. void main()
  8. {
  9.     char c = ' ';
  10.     string remoteComp, user, password;
  11.     cout << "Remote shutdown by Samko\n\nLista komputerów w sieci :\n";
  12.     system("net view");
  13.     string text = "net view";
  14.     cout << "Podaj nazwę komputera który chcesz wyłączyć (bez \\) :\n";
  15.     cin >> remoteComp;
  16.     cout << "Podaj nazwę użytkownika : \n";
  17.     cin >> user;
  18.     cout << "Podaj Hasło : ";
  19.  
  20.     while (true)
  21.     {
  22.         if ((c = _getch()) != 13){
  23.             password += c;
  24.             cout << "*";
  25.         }else{
  26.             cout << "\n";
  27.             break;
  28.         }
  29.     }
  30.     string prototype = "net use \\\\" + remoteComp + "\\IPC$ " + password + " /user:" + user;
  31.     system(prototype.c_str());
  32.     prototype = "shutdown /r /t 10 /m \\\\" + remoteComp;
  33.     system("cls");
  34.     cout << ("Czy na pewno zrestartować komputer? (y/n) :");
  35.  
  36.     if (_getch() == 'y')
  37.     {
  38.         system(prototype.c_str());
  39.         cout << "Komenda wysłana!\n";
  40.     }
  41.     else
  42.     {
  43.         cout << "Komenda anulowana!";
  44.     }
  45.     system("Pause");
  46.  
  47.  
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement