def __init__(self, cmd, output, afl, name, input_file, filename=None, mail=None, asan_bin=None): self.cmd = cmd self.output = output self.afl = afl self.name = name self.input_file = input_file self.filename = ".cur_input" if filename is None else filename self.mail = mail self.set_asan_cmd(asan_bin) self.tmp_dir = tempfile.mkdtemp() cmd, afl_path, qemu_mode = self.parse_fuzzer_stats() self.minimizer = minimizer.TestcaseMinimizer(cmd, afl_path, self.output, qemu_mode) self.import_state() self.make_dirs() atexit.register(self.cleanup)
def __init__(self, cmd, trace_bin, output, afl, name, filename=None, mail=None): self.cmd = cmd self.trace_bin = trace_bin self.output = output self.afl = afl self.name = name self.filename = ".cur_input" if filename is None else filename self.mail = mail self.tmp_dir = tempfile.mkdtemp() cmd, afl_path, qemu_mode = self.parse_fuzzer_stats() if qemu_mode != "": logger.debug("Tracing with QEMU mode: %s" % qemu_mode) self.minimizer = minimizer.TestcaseMinimizer(cmd, trace_bin, afl_path, qemu_mode, self.output) if os.path.exists("%s/%s" % (self.output, self.name)): logger.debug("Removing old Qsym subdirectory...") shutil.rmtree("%s/%s" % (self.output, self.name)) self.import_state() self.make_dirs() atexit.register(self.cleanup)
os.makedirs(output_dir) #print 'output directory already exist!' #exit() os.makedirs(queue_dir) os.makedirs(crash_dir) print 'target program: ' + prog_name print 'program argument: ' + prog_args print 'seed dir: ' + seed_dir init_queue(seed_dir) cmd = prog_name + ' ' + prog_args minimizer_ = minimizer.TestcaseMinimizer(cmd.split(' '), afl_path, output_dir) os.environ['ASAN_OPTIONS'] = 'abort_on_error=1:detect_leaks=0:symbolize=0:allocator_may_return_null=1' while True: s = queue[random.randrange(0, len(queue))] print 'cur_input: ' + s for i in range(100): # mutate 100 times for a test case mutate(s) cmd = prog_name + ' ' + prog_args cmd = cmd.replace('@@', cur_file)