master.py 文件源码

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

项目:afl-mothership 作者: afl-mothership 项目源码 文件源码
def run_master(mothership_url, workingdir, master_of):
    with tempdir(workingdir, 'mothership_afl_master_') as directory:
        logger.info('Starting master in %s' % (directory,))
        master = MothershipMaster(mothership_url, directory, master_of)

        os.makedirs(master.campaign_directory)
        download_afl(mothership_url, directory)
        download_queue(master.download_url, master.campaign_directory, [], executable_name=master.program)

        master.start()
        while not master.instance.process:
            time.sleep(1)

        global active
        while not master.instance.process.poll():
            #time.sleep(5 * 60)
            time.sleep(10)
            try:
                campaign_active = requests.get(mothership_url + '/fuzzers/is_active/%d' % master_of).json()['active']
            except Exception:
                continue
            if active != campaign_active:
                if campaign_active:
                    logger.warn('Resuming master')
                    os.kill(master.instance.process.pid, signal.SIGCONT)
                else:
                    logger.warn('Pausing master')
                    os.kill(master.instance.process.pid, signal.SIGSTOP)
                active = campaign_active

        master.join()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号