Add query-signature argument, add ethereum-input-decoder to requirements

pull/594/head
Marcus Mönnig 6 years ago
parent c4be6e9088
commit 54280ec2c4
  1. 9
      mythril/interfaces/cli.py
  2. 1
      requirements.txt

@ -15,6 +15,7 @@ import argparse
from mythril.exceptions import CriticalError, AddressNotFoundError from mythril.exceptions import CriticalError, AddressNotFoundError
from mythril.mythril import Mythril from mythril.mythril import Mythril
from mythril.version import VERSION from mythril.version import VERSION
import mythril.support.signatures as sigs
def exit_with_error(format, message): 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('--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('--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('-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 = parser.add_argument_group('RPC options')
rpc.add_argument('-i', action='store_true', help='Preset: Infura Node service (Mainnet)') rpc.add_argument('-i', action='store_true', help='Preset: Infura Node service (Mainnet)')
@ -102,6 +104,7 @@ def main():
parser.print_help() parser.print_help()
sys.exit() sys.exit()
if args.v: if args.v:
if 0 <= args.v < 3: if 0 <= args.v < 3:
coloredlogs.install( coloredlogs.install(
@ -111,6 +114,12 @@ def main():
else: else:
exit_with_error(args.outform, "Invalid -v value, you can find valid values in usage") 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 -- # -- commands --
if args.hash: if args.hash:
print(Mythril.hash_for_function_signature(args.hash)) print(Mythril.hash_for_function_signature(args.hash))

@ -4,6 +4,7 @@ coverage
eth_abi>=1.0.0 eth_abi>=1.0.0
eth-account>=0.1.0a2 eth-account>=0.1.0a2
ethereum>=2.3.2 ethereum>=2.3.2
ethereum-input-decoder==0.2.2
eth-hash>=0.1.0 eth-hash>=0.1.0
eth-keyfile>=0.5.1 eth-keyfile>=0.5.1
eth-keys>=0.2.0b3 eth-keys>=0.2.0b3

Loading…
Cancel
Save