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()
评论列表
文章目录