Skip to content

Commit

Permalink
Merge pull request googleprojectzero#69 from 0vercl0k/dev-winaflcmin-…
Browse files Browse the repository at this point in the history
…improvements

Minor winafl-cmin improvements.
  • Loading branch information
ivanfratric authored Aug 16, 2017
2 parents 9e73925 + a944242 commit 47dc7e9
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions winafl-cmin.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,12 @@ def _to_showmap_options(args, trace_name = '-'):
'''Takes the argparse namespace, and convert it to the list of options used
to invoke afl-showmap.exe'''
r = [
'afl-showmap.exe', '-q', '-o', trace_name
'afl-showmap.exe', '-o', trace_name
]

if os.getenv('AFL_NO_SINKHOLE') is None:
r.append('-q')

if args.time_limit > 0:
r.extend(['-t', '%d' % args.time_limit])
else:
Expand Down Expand Up @@ -267,6 +270,10 @@ def setup_argparse():
'-w', '--workers', type = int, default = multiprocessing.cpu_count(),
metavar = 'n', help = 'The number of worker processes (default: cpu count)'
)
group.add_argument(
'--skip-dry-run', action = 'store_true', default = False,
help = 'Skip the dry-run step even if it failed'
)
parser.add_argument(
'target_cmdline', nargs = argparse.REMAINDER,
help = 'target command line'
Expand Down Expand Up @@ -296,6 +303,15 @@ def main(argc, argv):
if args.target_cmdline[0] == '--':
del args.target_cmdline[0]

# If we are not seeing the '@@' marker somewhere and that we are not
# specifying an input file with -f, then it means something is wrong
if args.file_read is None and '@@' not in args.target_cmdline:
logging.error(
'[!] The target command line needs to include the "@@" marker to'
' specify the input file.'
)
return 1

if os.path.isdir(args.working_dir) is False:
logging.error(
'[!] The working directory %r is not a directory', args.working_dir
Expand Down Expand Up @@ -375,7 +391,9 @@ def main(argc, argv):
' Return codes matching? %r',
results[0].returncode == results[1].returncode
)
return 1

if not args.skip_dry_run:
return 1

logging.info('[+] OK, %d tuples recorded.', len(results[0].tuples))

Expand Down

0 comments on commit 47dc7e9

Please sign in to comment.