From 54280ec2c4dc9b965a259163604ecf6370c25749 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcus=20M=C3=B6nnig?= Date: Wed, 17 Oct 2018 23:06:07 +0200 Subject: [PATCH] Add query-signature argument, add ethereum-input-decoder to requirements --- mythril/interfaces/cli.py | 9 +++++++++ requirements.txt | 1 + 2 files changed, 10 insertions(+) diff --git a/mythril/interfaces/cli.py b/mythril/interfaces/cli.py index 1784add4..b37bcb9b 100644 --- a/mythril/interfaces/cli.py +++ b/mythril/interfaces/cli.py @@ -15,6 +15,7 @@ import argparse from mythril.exceptions import CriticalError, AddressNotFoundError from mythril.mythril import Mythril from mythril.version import VERSION +import mythril.support.signatures as sigs def exit_with_error(format, message): @@ -78,6 +79,7 @@ def main(): options.add_argument('--phrack', action='store_true', help='Phrack-style call graph') options.add_argument('--enable-physics', action='store_true', help='enable graph physics simulation') options.add_argument('-v', type=int, help='log level (0-2)', metavar='LOG_LEVEL') + options.add_argument('-q', '--query-signature', action='store_true', help='Lookup function signatures through www.4byte.directory') rpc = parser.add_argument_group('RPC options') rpc.add_argument('-i', action='store_true', help='Preset: Infura Node service (Mainnet)') @@ -102,6 +104,7 @@ def main(): parser.print_help() sys.exit() + if args.v: if 0 <= args.v < 3: coloredlogs.install( @@ -111,6 +114,12 @@ def main(): else: exit_with_error(args.outform, "Invalid -v value, you can find valid values in usage") + if args.query_signature: + if sigs.ethereum_input_decoder == None: + exit_with_error(args.outform, "The --query-signature function requires the python package ethereum-input-decoder") + else: + sigs.ethereum_input_decoder = None + # -- commands -- if args.hash: print(Mythril.hash_for_function_signature(args.hash)) diff --git a/requirements.txt b/requirements.txt index 30162f8d..cd132a05 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,6 +4,7 @@ coverage eth_abi>=1.0.0 eth-account>=0.1.0a2 ethereum>=2.3.2 +ethereum-input-decoder==0.2.2 eth-hash>=0.1.0 eth-keyfile>=0.5.1 eth-keys>=0.2.0b3