deploy.py 文件源码

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

项目:picoCTF 作者: picoCTF 项目源码 文件源码
def update_problem_class(Class, problem_object, seed, user, instance_directory):
    """
    Changes the metaclass of the given class to introduce necessary fields before
    object instantiation.

    Args:
        Class: The problem class to be updated
        problem_name: The problem name
        seed: The seed for the Random object
        user: The linux username for this challenge instance
        instance_directory: The deployment directory for this instance

    Returns:
        The updated class described above
    """

    random = Random(seed)
    attributes = deepcopy(problem_object)

    # pass configuration options in as class fields
    attributes.update(dict(deploy_config))

    attributes.update({"random": random, "user": user, "directory": instance_directory,
                       "server": deploy_config.hostname})

    return challenge_meta(attributes)(Class.__name__, Class.__bases__, Class.__dict__)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号