loader.py 文件源码

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

项目:SuperHoneyPot 作者: TheFixers 项目源码 文件源码
def drop_privileges_Arch(uid_name="nobody", gid_name="nobody"):
    if os.getuid() != 0:
        # Already not root, take no action
        return

    # Get the uid/gid from the name
    running_uid = pwd.getpwnam(uid_name).pw_uid
    running_gid = grp.getgrnam(gid_name).gr_gid

    # Remove group privileges
    os.setgroups([])

    # Try setting the new uid/gid
    os.setgid(running_gid)
    os.setuid(running_uid)

    # Ensure a very conservative umask
    old_umask = os.umask(077)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号