pull/780/head
Nathan 6 years ago
parent 0335a71a45
commit e2557432a5
  1. 4
      mythril/analysis/modules/dependence_on_predictable_vars.py
  2. 1
      mythril/analysis/modules/exceptions.py
  3. 1
      mythril/analysis/modules/transaction_order_dependence.py
  4. 1
      mythril/analysis/modules/unchecked_retval.py
  5. 4
      mythril/ethereum/interface/leveldb/accountindexing.py
  6. 14
      mythril/interfaces/cli.py
  7. 4
      mythril/laser/ethereum/instructions.py
  8. 8
      mythril/laser/ethereum/svm.py
  9. 1
      mythril/laser/ethereum/taint_analysis.py
  10. 1
      mythril/mythril.py
  11. 5
      mythril/support/loader.py
  12. 1
      mythril/support/truffle.py

@ -33,9 +33,7 @@ class PredictableDependenceModule(DetectionModule):
for call in statespace.calls: for call in statespace.calls:
if "callvalue" in str(call.value): if "callvalue" in str(call.value):
log.debug( log.debug("[DEPENDENCE_ON_PREDICTABLE_VARS] Skipping refund function")
"[DEPENDENCE_ON_PREDICTABLE_VARS] Skipping refund function"
)
continue continue
# We're only interested in calls that send Ether # We're only interested in calls that send Ether

@ -8,6 +8,7 @@ import logging
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
class ReachableExceptionsModule(DetectionModule): class ReachableExceptionsModule(DetectionModule):
def __init__(self): def __init__(self):
super().__init__( super().__init__(

@ -12,6 +12,7 @@ from mythril.exceptions import UnsatError
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
class TxOrderDependenceModule(DetectionModule): class TxOrderDependenceModule(DetectionModule):
def __init__(self): def __init__(self):
super().__init__( super().__init__(

@ -8,6 +8,7 @@ import re
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
class UncheckedRetvalModule(DetectionModule): class UncheckedRetvalModule(DetectionModule):
def __init__(self): def __init__(self):
super().__init__( super().__init__(

@ -78,9 +78,7 @@ class AccountIndexer(object):
""" """
Processesing method Processesing method
""" """
log.debug( log.debug("Processing blocks %d to %d" % (startblock, startblock + BATCH_SIZE))
"Processing blocks %d to %d" % (startblock, startblock + BATCH_SIZE)
)
addresses = [] addresses = []

@ -191,7 +191,9 @@ def main():
options.add_argument( options.add_argument(
"--enable-physics", action="store_true", help="enable graph physics simulation" "--enable-physics", action="store_true", help="enable graph physics simulation"
) )
options.add_argument("-v", type=int, help="log level (0-2)", metavar="LOG_LEVEL", default=0) options.add_argument(
"-v", type=int, help="log level (0-2)", metavar="LOG_LEVEL", default=0
)
options.add_argument( options.add_argument(
"-q", "-q",
"--query-signature", "--query-signature",
@ -247,18 +249,20 @@ def main():
if args.v: if args.v:
if 0 <= args.v < 3: if 0 <= args.v < 3:
''' """
logging.basicConfig( logging.basicConfig(
format="%(name)s[%(process)d] %(levelname)s %(message)s", format="%(name)s[%(process)d] %(levelname)s %(message)s",
level=[logging.NOTSET, logging.INFO, logging.DEBUG][args.v], level=[logging.NOTSET, logging.INFO, logging.DEBUG][args.v],
) )
''' """
coloredlogs.install( coloredlogs.install(
#fmt="%(filename)s[%(process)d] %(levelname)s %(message)s", # fmt="%(filename)s[%(process)d] %(levelname)s %(message)s",
fmt="%(name)s[%(process)d] %(levelname)s %(message)s", fmt="%(name)s[%(process)d] %(levelname)s %(message)s",
level=[logging.NOTSET, logging.INFO, logging.DEBUG][args.v], level=[logging.NOTSET, logging.INFO, logging.DEBUG][args.v],
) )
logging.getLogger("mythril").setLevel([logging.NOTSET, logging.INFO, logging.DEBUG][args.v]) logging.getLogger("mythril").setLevel(
[logging.NOTSET, logging.INFO, logging.DEBUG][args.v]
)
else: else:
exit_with_error( exit_with_error(
args.outform, "Invalid -v value, you can find valid values in usage" args.outform, "Invalid -v value, you can find valid values in usage"

@ -865,9 +865,7 @@ class Instruction:
try: try:
state.mem_extend(mstart, 32) state.mem_extend(mstart, 32)
except Exception: except Exception:
log.debug( log.debug("Error extending memory, mstart = " + str(mstart) + ", size = 32")
"Error extending memory, mstart = " + str(mstart) + ", size = 32"
)
log.debug("MSTORE to mem[" + str(mstart) + "]: " + str(value)) log.debug("MSTORE to mem[" + str(mstart) + "]: " + str(value))

@ -78,9 +78,7 @@ class LaserEVM:
self.pre_hooks = defaultdict(list) self.pre_hooks = defaultdict(list)
self.post_hooks = defaultdict(list) self.post_hooks = defaultdict(list)
log.info( log.info("LASER EVM initialized with dynamic loader: " + str(dynamic_loader))
"LASER EVM initialized with dynamic loader: " + str(dynamic_loader)
)
def register_hooks(self, hook_type: str, hook_dict: Dict[str, List[Callable]]): def register_hooks(self, hook_type: str, hook_dict: Dict[str, List[Callable]]):
if hook_type == "pre": if hook_type == "pre":
@ -224,9 +222,7 @@ class LaserEVM:
# In this case we don't put an unmodified world state in the open_states list Since in the case of an # In this case we don't put an unmodified world state in the open_states list Since in the case of an
# exceptional halt all changes should be discarded, and this world state would not provide us with a # exceptional halt all changes should be discarded, and this world state would not provide us with a
# previously unseen world state # previously unseen world state
log.debug( log.debug("Encountered a VmException, ending path: `{}`".format(str(e)))
"Encountered a VmException, ending path: `{}`".format(str(e))
)
new_global_states = [] new_global_states = []
else: else:
# First execute the post hook for the transaction ending instruction # First execute the post hook for the transaction ending instruction

@ -10,6 +10,7 @@ from mythril.analysis.symbolic import SymExecWrapper
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
class TaintRecord: class TaintRecord:
""" """
TaintRecord contains tainting information for a specific (state, node) TaintRecord contains tainting information for a specific (state, node)

@ -36,6 +36,7 @@ from mythril.ethereum.interface.leveldb.client import EthLevelDB
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
class Mythril(object): class Mythril(object):
""" """
Mythril main interface class. Mythril main interface class.

@ -4,6 +4,7 @@ import re
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
class DynLoader: class DynLoader:
def __init__(self, eth, contract_loading=True, storage_loading=True): def __init__(self, eth, contract_loading=True, storage_loading=True):
self.eth = eth self.eth = eth
@ -47,9 +48,7 @@ class DynLoader:
if not self.contract_loading: if not self.contract_loading:
raise ValueError("Cannot load contract when contract_loading flag is false") raise ValueError("Cannot load contract when contract_loading flag is false")
log.debug( log.debug("Dynld at contract " + contract_address + ": " + dependency_address)
"Dynld at contract " + contract_address + ": " + dependency_address
)
m = re.match(r"^(0x[0-9a-fA-F]{40})$", dependency_address) m = re.match(r"^(0x[0-9a-fA-F]{40})$", dependency_address)

@ -16,6 +16,7 @@ from mythril.laser.ethereum.util import get_instruction_index
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
def analyze_truffle_project(sigs, args): def analyze_truffle_project(sigs, args):
project_root = os.getcwd() project_root = os.getcwd()

Loading…
Cancel
Save