Exemplo n.º 1
0
        public static CommandResult Execute(string command, string password = "", string workingDirectory = "")
        {
            var bash = new Bash(command, password, workingDirectory);

            bash.Start();
            return(bash.WaitForExit());
        }
Exemplo n.º 2
0
        public static string WhoAmI()
        {
            var bash = new Bash("whoami");

            bash.Start();
            var result = bash.WaitForExit();

            return(result.LastOutput);
        }
Exemplo n.º 3
0
        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");
        }