diff --git a/mythril/interfaces/cli.py b/mythril/interfaces/cli.py index 97e5c57d..cf8a2e08 100644 --- a/mythril/interfaces/cli.py +++ b/mythril/interfaces/cli.py @@ -538,9 +538,8 @@ def execute_command( params=[a.strip() for a in args.storage_slots.strip().split(",")], ) print(storage) - return - if args.command in DISASSEMBLE_LIST: + elif args.command in DISASSEMBLE_LIST: if disassembler.contracts[0].code: print("Runtime Disassembly: \n" + disassembler.contracts[0].get_easm()) if disassembler.contracts[0].creation_code: @@ -634,8 +633,6 @@ def parse_args_and_execute(parser: ArgumentParser, args: Namespace) -> None: :param parser: The parser :param args: The args """ - if args.command not in COMMAND_LIST: - parser.print_usage() if args.epic: path = os.path.dirname(os.path.realpath(__file__)) @@ -643,6 +640,10 @@ def parse_args_and_execute(parser: ArgumentParser, args: Namespace) -> None: os.system(" ".join(sys.argv) + " | python3 " + path + "/epic.py") sys.exit() + if args.command not in COMMAND_LIST or args.command is None: + parser.print_help() + sys.exit() + if args.command == "version": if args.outform == "json": print(json.dumps({"version_str": VERSION})) diff --git a/tests/cmd_line_test.py b/tests/cmd_line_test.py index 5fa6e3bb..258a6882 100644 --- a/tests/cmd_line_test.py +++ b/tests/cmd_line_test.py @@ -58,6 +58,10 @@ class CommandLineToolTestCase(BaseTestCase): ) self.assertIn(""""success": false""", output_of(command)) + def test_only_epic(self): + command = "python3 {}".format(MYTH) + self.assertIn("usage: ", output_of(command)) + def test_storage(self): solidity_file = str(TESTDATA / "input_contracts" / "origin.sol") command = """python3 {} read-storage "438767356, 3" 0x76799f77587738bfeef09452df215b63d2cfb08a """.format(