afl-cmin.py 文件源码

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

项目:afl-kit 作者: kcwu 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号