Update Program.cs
Signed-off-by: Lev Rusanov <30170278+JDM170@users.noreply.github.com>
This commit is contained in:
21
Program.cs
21
Program.cs
@@ -303,12 +303,18 @@ namespace domain_utility
|
||||
do
|
||||
{
|
||||
key = Console.ReadKey(true);
|
||||
if (key.KeyChar < 32 || key.KeyChar > 126)
|
||||
continue;
|
||||
if (key.Key == ConsoleKey.Backspace && password.Length > 0)
|
||||
{
|
||||
password = password.Substring(0, password.Length - 1);
|
||||
Console.Write("\b \b");
|
||||
}
|
||||
else if (key.KeyChar < 32 || key.KeyChar > 126)
|
||||
continue;
|
||||
else if (key.Key != ConsoleKey.Backspace)
|
||||
{
|
||||
password += key.KeyChar;
|
||||
Console.Write("*");
|
||||
}
|
||||
}
|
||||
while (key.Key != ConsoleKey.Enter);
|
||||
Console.Write("\n\n");
|
||||
@@ -321,6 +327,8 @@ namespace domain_utility
|
||||
int indexOfUserName = machineNameAndUser.IndexOf('\\') + 1;
|
||||
string machineUser = machineNameAndUser.Substring(indexOfUserName, machineNameAndUser.Length - indexOfUserName).ToLower();
|
||||
|
||||
try
|
||||
{
|
||||
using (SshClient client = new SshClient(remote, machineUser, password))
|
||||
{
|
||||
client.Connect();
|
||||
@@ -329,6 +337,11 @@ namespace domain_utility
|
||||
client.Disconnect();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine("Произошла ошибка: " + ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
private static void FixConky()
|
||||
{
|
||||
@@ -337,6 +350,8 @@ namespace domain_utility
|
||||
|
||||
string password = InputPassword();
|
||||
|
||||
Console.WriteLine(password);
|
||||
|
||||
ExecuteCommandViaSSH(remote, password, "sudo sed -i 's/update_interval = 0.5,/update_interval = 300,/' /etc/conky/conky.conf");
|
||||
|
||||
BackToMenu(FixConky);
|
||||
@@ -391,7 +406,7 @@ namespace domain_utility
|
||||
"4 - удаленно подключиться к компьютеру (Windows -> Windows, Windows -> Linux)", // StartRDPConnection
|
||||
"5 - удаленная перезагрузка компьютера (только Windows)", // RemoteRebootWindows
|
||||
"6 - открыть CUPS выбранного компьютера (только Linux)", // OpenComputerCups
|
||||
"7 - изменить время обновления conky с 0.5 на 300", // FixConky
|
||||
"7 - изменить время обновления conky с 0.5 на 300 (только Linux)", // FixConky
|
||||
"8 - удаленная перезагрузка компьютера (только Linux)", // RemoteRebootLinux
|
||||
"9 - выполнить команду удаленно (только Windows -> Linux)", // ExecuteCustomCommandViaSSH
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user