public static string MacOSVersion() { var uname = new Command("sw_vers", "-productVersion", false); string output = uname.StartAndReadStandardOutput(); string version = output; // Parse the version number between the periods (e.g. "10.12.1" -> 12) output = output.Substring(output.IndexOf(".") + 1); output = output.Substring(0, output.LastIndexOf(".")); string release = "Unreleased Version"; switch (int.Parse(output)) { case 7: release = "Lion"; break; case 8: release = "Mountain Lion"; break; case 9: release = "Mavericks"; break; case 10: release = "Yosemite"; break; case 11: release = "El Capitan"; break; case 12: release = "Sierra"; break; case 13: release = "High Sierra"; break; } return(string.Format("macOS {0} ({1})", version, release)); }
string FetchHostKey() { Logger.LogInfo("Auth", string.Format("Fetching host key for {0}", RemoteUrl.Host)); var ssh_keyscan = new Command(SSHKeyScan, string.Format("-t rsa -p 22 {0}", RemoteUrl.Host)); if (RemoteUrl.Port > 0) { ssh_keyscan.StartInfo.Arguments = string.Format("-t rsa -p {0} {1}", RemoteUrl.Port, RemoteUrl.Host); } string host_key = ssh_keyscan.StartAndReadStandardOutput(); if (ssh_keyscan.ExitCode == 0 && !string.IsNullOrWhiteSpace(host_key)) { return(host_key); } return(null); }
string FetchHostKey() { Logger.LogInfo ("Auth", string.Format ("Fetching host key for {0}", RemoteUrl.Host)); var ssh_keyscan = new Command ("ssh-keyscan", string.Format ("-t rsa -p 22 {0}", RemoteUrl.Host)); if (RemoteUrl.Port > 0) ssh_keyscan.StartInfo.Arguments = string.Format ("-t rsa -p {0} {1}", RemoteUrl.Port, RemoteUrl.Host); string host_key = ssh_keyscan.StartAndReadStandardOutput (); if (ssh_keyscan.ExitCode == 0 && !string.IsNullOrWhiteSpace (host_key)) return host_key; return null; }