decorators.py 文件源码

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

项目:machammer 作者: filipp 项目源码 文件源码
def login(func):
    """Install Python function as a LoginHook."""
    def func_wrapper(hook='login'):
        path = '/var/root/Library/mh_%shook.py' % hook

        writesource(func, path)

        # only root should read and execute
        os.chown(path, 0, 0)
        os.chmod(path, stat.S_IXUSR | stat.S_IRUSR)

        if hook == 'login':
            hooks.login(path)
        else:
            hooks.logout(path)

        return path

    return func_wrapper
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号