Esempio n. 1
0
        public static string SetTimezone(RemoteShell shell, string rootPwd, string timezone)
        {
            // with root access execute
            // /etc/config-tools/config_timezone timezone=<timezone-value>

            var cmd = $"/etc/config-tools/config_timezone timezone={timezone}";

            return(shell.ExecCommand("root", rootPwd, cmd));
        }
Esempio n. 2
0
        public static string SetDateTime(RemoteShell shell, string rootPwd, DateTime dateTime)
        {
            // with root access execute
            // /etc/config-tools/config_clock < type=time-type-value time=time-value | date=date-value >

            var type = (dateTime.Kind == DateTimeKind.Utc) ? "utc" : "local";
            var date = dateTime.ToString("dd.MM.yyyy");
            var time = dateTime.ToString("hh:mm:ss");
            var cmd  = $"/etc/config-tools/config_clock type={type} date={date} time={time}";

            return(shell.ExecCommand("root", rootPwd, cmd));
        }
        public string GetRootPassword(List <string> passwords)
        {
            var shell = new RemoteShell(_controllerAddress);

            foreach (var password in passwords)
            {
                if (shell.CheckRootLogin(password))
                {
                    return(password);
                }
            }

            Console.Write("Enter root password of controller: ");
            var pwd = Console.ReadLine();

            return(shell.CheckRootLogin(pwd) ? pwd : null);
        }