custom_runner.py 文件源码

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

项目:pov_fuzzing 作者: mechaphish 项目源码 文件源码
def _setup_env(self):
        prefix = "/dev/shm/tracer_"
        curdir = os.getcwd()
        tmpdir = tempfile.mkdtemp(prefix=prefix)
        # dont prefilter the core
        if len(self.binaries) > 1:
            with open("/proc/self/coredump_filter", "wb") as f:
                f.write("00000077")

        # allow cores to be dumped
        saved_limit = resource.getrlimit(resource.RLIMIT_CORE)
        resource.setrlimit(resource.RLIMIT_CORE, (resource.RLIM_INFINITY, resource.RLIM_INFINITY))
        binaries_old = [ ]
        for binary in self.binaries:
            binaries_old.append(os.path.abspath(binary))

        self.binaries = list(binaries_old)

        os.chdir(tmpdir)

        try:
            yield (tmpdir, self.binaries[0])

        finally:
            assert tmpdir.startswith(prefix)
            shutil.rmtree(tmpdir)
            os.chdir(curdir)
            resource.setrlimit(resource.RLIMIT_CORE, saved_limit)
            self.binaries = binaries_old
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号