public static CommandResult Execute(string command, string password = "", string workingDirectory = "") { var bash = new Bash(command, password, workingDirectory); bash.Start(); return(bash.WaitForExit()); }
public static string WhoAmI() { var bash = new Bash("whoami"); bash.Start(); var result = bash.WaitForExit(); return(result.LastOutput); }
public static bool IsSudoPassword(string password) { Execute("sudo -k"); var bash = new Bash("whoami", password: password); bash.Start(); var result = bash.WaitForExit(); return(result.LastOutput == "root"); }