|
|
|
@ -11,8 +11,9 @@ from mythril.ether.ethcontract import ETHContract |
|
|
|
|
from mythril.ether.util import compile_solidity |
|
|
|
|
from mythril.rpc.client import EthJsonRpc |
|
|
|
|
from mythril.ipc.client import EthIpc |
|
|
|
|
from mythril.support.loader import DynLoader |
|
|
|
|
from ethereum import utils |
|
|
|
|
from laser.ethereum import laserfree |
|
|
|
|
from laser.ethereum import svm, laserfree |
|
|
|
|
from pathlib import Path |
|
|
|
|
import logging |
|
|
|
|
import sys |
|
|
|
@ -50,6 +51,7 @@ commands.add_argument('--init-db', action='store_true', help='initialize the con |
|
|
|
|
inputs = parser.add_argument_group('input arguments') |
|
|
|
|
inputs.add_argument('-c', '--code', help='hex-encoded bytecode string ("6060604052...")', metavar='BYTECODE') |
|
|
|
|
inputs.add_argument('-a', '--address', help='pull contract from the blockchain', metavar='CONTRACT_ADDRESS') |
|
|
|
|
inputs.add_argument('-l', '--dynld', action='store_true', help='auto-load dependencies (experimental)') |
|
|
|
|
inputs.add_argument('--data', help='message call input data for tracing') |
|
|
|
|
|
|
|
|
|
options = parser.add_argument_group('options') |
|
|
|
@ -163,7 +165,6 @@ elif (len(args.solidity_file)): |
|
|
|
|
else: |
|
|
|
|
exitWithError("No input bytecode. Please provide EVM code via -c BYTECODE, -a ADDRESS, or -i SOLIDITY_FILES") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Commands |
|
|
|
|
|
|
|
|
|
if (args.disassemble): |
|
|
|
@ -198,12 +199,18 @@ elif (args.graph) or (args.fire_lasers): |
|
|
|
|
for contract in contracts: |
|
|
|
|
modules[contract.address] = contract.as_dict() |
|
|
|
|
|
|
|
|
|
if (args.dynld): |
|
|
|
|
loader = DynLoader(eth) |
|
|
|
|
_svm = svm.SVM(modules, loader) |
|
|
|
|
else: |
|
|
|
|
_svm = svm.SVM(modules) |
|
|
|
|
|
|
|
|
|
if (args.graph): |
|
|
|
|
|
|
|
|
|
if args.enable_physics is not None: |
|
|
|
|
physics = True |
|
|
|
|
|
|
|
|
|
html = generate_callgraph(modules, contracts[0].address, args.enable_physics) |
|
|
|
|
html = generate_callgraph(_svm, contracts[0].address, args.enable_physics) |
|
|
|
|
|
|
|
|
|
try: |
|
|
|
|
with open(args.graph, "w") as f: |
|
|
|
@ -214,7 +221,7 @@ elif (args.graph) or (args.fire_lasers): |
|
|
|
|
|
|
|
|
|
else: |
|
|
|
|
|
|
|
|
|
laserfree.fire(modules) |
|
|
|
|
laserfree.fire(_svm) |
|
|
|
|
|
|
|
|
|
else: |
|
|
|
|
parser.print_help() |
|
|
|
|