From 8b66e58c7b1922e218c9536ad620ce2811950d80 Mon Sep 17 00:00:00 2001 From: Mark Mossberg Date: Thu, 7 Sep 2017 20:15:31 -0400 Subject: [PATCH] Document cli better (#482) * Update README.md * Rewrite -h * Clearer cli usage * Fix forgotten variable name changes * Fix more forgotten variables --- README.md | 4 +++- manticore/__main__.py | 6 +++--- manticore/manticore.py | 6 +++--- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 8914107..d4c05ed 100644 --- a/README.md +++ b/README.md @@ -100,7 +100,9 @@ have to manually set the workspace to the redis URI. ## Usage ``` -$ manticore ./path/to/binary # runs, and creates a mcore_* directory with analysis results +$ manticore ./path/to/binary # runs, and creates a mcore_* directory with analysis results +$ manticore ./path/to/binary ab cd # use concrete strings "ab", "cd" as program arguments +$ manticore ./path/to/binary ++ ++ # use two symbolic strings of length two as program arguments ``` or diff --git a/manticore/__main__.py b/manticore/__main__.py index f87c741..fbc1c10 100644 --- a/manticore/__main__.py +++ b/manticore/__main__.py @@ -52,8 +52,8 @@ def parse_arguments(): help='Enable profiling mode.') parser.add_argument('--procs', type=int, default=1, help='Number of parallel processes to spawn') - parser.add_argument('programs', type=str, nargs='+', metavar='PROGRAM', - help='Programs to analyze (arguments after ?)') + parser.add_argument('argv', type=str, nargs='+', + help="Path to program, and arguments ('+' in arguments indicates symbolic byte).") parser.add_argument('--replay', type=str, default=None, help='The trace filename to replay') parser.add_argument('--size', type=str, help='Specify buffer full size') @@ -79,7 +79,7 @@ def parse_arguments(): def main(): args = parse_arguments() - m = Manticore(args.programs[0], args.programs[1:], disasm=args.disasm) + m = Manticore(args.argv[0], args.argv[1:], disasm=args.disasm) m.policy = args.policy m.args = args diff --git a/manticore/manticore.py b/manticore/manticore.py index 66a5a5b..4c73655 100644 --- a/manticore/manticore.py +++ b/manticore/manticore.py @@ -89,7 +89,7 @@ def makeLinux(program, disasm, argv, env, symbolic_files, concrete_start=''): def makeWindows(args): assert args.size is not None, "Need to specify buffer size" assert args.buffer is not None, "Need to specify buffer base address" - logger.debug('Loading program %s (platform: Windows)', args.programs) + logger.debug('Loading program %s (platform: Windows)', args.argv) additional_context = None if args.context: with open(args.context, "r") as addl_context_file: @@ -97,7 +97,7 @@ def makeWindows(args): logger.debug('Additional context loaded with contents {}'.format(additional_context)) #DEBUG constraints = ConstraintSet() - platform = windows.SWindows(constraints, args.programs[0], additional_context, snapshot_folder=args.workspace) + platform = windows.SWindows(constraints, args.argv[0], additional_context, snapshot_folder=args.workspace) #This will interpret the buffer specification written in INTEL ASM. (It may dereference pointers) data_size = parse(args.size, platform.current.read_bytes, platform.current.read_register) @@ -173,7 +173,7 @@ class Manticore(object): self._check_disassembler_present(disasm) self._disasm = disasm # yan's comment - self._argv = args # args.programs[1:] + self._argv = args self._env = {} # Will be set to a temporary directory if not set before running start() self._policy = 'random'