AnalyzeControl.py 文件源码

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

项目:HaboMalHunter 作者: Tencent 项目源码 文件源码
def init_workspace(cfg, is_inplace=False):
    log.info("init workspace is_inplace:%r",is_inplace)
    if is_inplace:
        init_workspace_inplace(cfg)
    else:
        # create a clean workspace
        workspace_dir = os.path.join(BASE_HOME,cfg.exec_home)
        if not os.path.exists(workspace_dir):
            os.mkdir(workspace_dir)
        else:
            shutil.rmtree(workspace_dir)
            os.mkdir(workspace_dir)
        cfg.workspace_dir = workspace_dir

        # copy target file into workspace
        if os.path.exists(cfg.target):
            shutil.copy(cfg.target, workspace_dir)
            target_abs_path = os.path.join(workspace_dir, os.path.basename(cfg.target))
            cfg.target_abs_path = target_abs_path
            os.chmod(target_abs_path, stat.S_IRUSR)
        else:
            log.critical("%s dose not exist.", cfg.target)
            os._exit(1)
        log.info("Target absolute path: %s", cfg.target_abs_path)
        # I can not change dir at here, the dir will be changed everytime when analyzer starts.
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号