Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <conio.h>
- using namespace std;
- void main()
- {
- char c = ' ';
- string remoteComp, user, password;
- cout << "Remote shutdown by Samko\n\nLista komputerów w sieci :\n";
- system("net view");
- string text = "net view";
- cout << "Podaj nazwę komputera który chcesz wyłączyć (bez \\) :\n";
- cin >> remoteComp;
- cout << "Podaj nazwę użytkownika : \n";
- cin >> user;
- cout << "Podaj Hasło : ";
- while (true)
- {
- if ((c = _getch()) != 13){
- password += c;
- cout << "*";
- }else{
- cout << "\n";
- break;
- }
- }
- string prototype = "net use \\\\" + remoteComp + "\\IPC$ " + password + " /user:" + user;
- system(prototype.c_str());
- prototype = "shutdown /r /t 10 /m \\\\" + remoteComp;
- system("cls");
- cout << ("Czy na pewno zrestartować komputer? (y/n) :");
- if (_getch() == 'y')
- {
- system(prototype.c_str());
- cout << "Komenda wysłana!\n";
- }
- else
- {
- cout << "Komenda anulowana!";
- }
- system("Pause");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement