def afl_showmap(input_path, first=False):
cmd = [
'afl-showmap',
'-m', str(args.memory_limit),
'-t', str(args.time_limit),
'-o', '-',
'-Z']
if args.qemu_mode:
cmd += ['-Q']
if args.edge_mode:
cmd += ['-e']
cmd += ['--', args.exe] + args.args
input_from_file = False
if args.stdin_file:
input_from_file = True
shutil.copy(input_path, args.stdin_file)
input_path = args.stdin_file
for i in range(len(cmd)):
if '@@' in cmd[i]:
input_from_file = True
cmd[i] = cmd[i].replace('@@', input_path)
if first:
logger.debug('run command line: %s', subprocess.list2cmdline(cmd))
if input_from_file:
p = subprocess.Popen(cmd, stdout=subprocess.PIPE, bufsize=1048576)
else:
p = subprocess.Popen(cmd, stdin=file(input_path), stdout=subprocess.PIPE, bufsize=1048576)
out = p.stdout.read()
p.wait()
#out = p.communicate()[0]
a = array.array('l', map(int, out.split()))
return a
评论列表
文章目录