Optimize imports

pull/845/head
Dominik Muhs 6 years ago
parent 430814182e
commit 0bdc7ed48e
  1. 3
      mythril/analysis/callgraph.py
  2. 11
      mythril/analysis/modules/dependence_on_predictable_vars.py
  3. 5
      mythril/analysis/modules/deprecated_ops.py
  4. 12
      mythril/analysis/modules/ether_thief.py
  5. 8
      mythril/analysis/modules/exceptions.py
  6. 11
      mythril/analysis/modules/external_calls.py
  7. 16
      mythril/analysis/modules/integer.py
  8. 5
      mythril/analysis/modules/suicide.py
  9. 5
      mythril/analysis/modules/transaction_order_dependence.py
  10. 3
      mythril/analysis/ops.py
  11. 8
      mythril/analysis/security.py
  12. 9
      mythril/analysis/symbolic.py
  13. 8
      mythril/ethereum/evmcontract.py
  14. 10
      mythril/ethereum/interface/leveldb/accountindexing.py
  15. 2
      mythril/ethereum/interface/rpc/base_client.py
  16. 8
      mythril/ethereum/interface/rpc/client.py
  17. 13
      mythril/ethereum/util.py
  18. 12
      mythril/interfaces/cli.py
  19. 7
      mythril/laser/ethereum/call.py
  20. 3
      mythril/laser/ethereum/cfg.py
  21. 43
      mythril/laser/ethereum/instructions.py
  22. 4
      mythril/laser/ethereum/natives.py
  23. 4
      mythril/laser/ethereum/state/account.py
  24. 19
      mythril/laser/ethereum/state/calldata.py
  25. 6
      mythril/laser/ethereum/state/environment.py
  26. 12
      mythril/laser/ethereum/state/memory.py
  27. 4
      mythril/laser/ethereum/strategy/basic.py
  28. 13
      mythril/laser/ethereum/svm.py
  29. 7
      mythril/laser/ethereum/taint_analysis.py
  30. 19
      mythril/laser/ethereum/transaction/transaction_models.py
  31. 8
      mythril/laser/ethereum/util.py
  32. 8
      mythril/laser/smt/__init__.py
  33. 3
      mythril/laser/smt/array.py
  34. 5
      mythril/laser/smt/bitvec.py
  35. 4
      mythril/laser/smt/bool.py
  36. 2
      mythril/laser/smt/solver.py
  37. 29
      mythril/mythril.py
  38. 13
      mythril/support/signatures.py
  39. 15
      mythril/support/truffle.py
  40. 8
      solidity_examples/suicide.sol

@ -4,8 +4,9 @@ graphs."""
import re import re
from jinja2 import Environment, PackageLoader, select_autoescape from jinja2 import Environment, PackageLoader, select_autoescape
from mythril.laser.ethereum.svm import NodeFlags
from z3 import Z3Exception from z3 import Z3Exception
from mythril.laser.ethereum.svm import NodeFlags
from mythril.laser.smt import simplify from mythril.laser.smt import simplify
default_opts = { default_opts = {

@ -1,15 +1,16 @@
"""This module contains the detection code for predictable variable """This module contains the detection code for predictable variable
dependence.""" dependence."""
import logging
import re import re
from mythril.laser.ethereum.state.global_state import GlobalState
from mythril.analysis.ops import Call, VarType
from mythril.analysis import solver from mythril.analysis import solver
from mythril.analysis.report import Issue
from mythril.analysis.call_helpers import get_call_from_state from mythril.analysis.call_helpers import get_call_from_state
from mythril.analysis.swc_data import TIMESTAMP_DEPENDENCE, PREDICTABLE_VARS_DEPENDENCE
from mythril.analysis.modules.base import DetectionModule from mythril.analysis.modules.base import DetectionModule
from mythril.analysis.ops import Call, VarType
from mythril.analysis.report import Issue
from mythril.analysis.swc_data import PREDICTABLE_VARS_DEPENDENCE, TIMESTAMP_DEPENDENCE
from mythril.exceptions import UnsatError from mythril.exceptions import UnsatError
import logging from mythril.laser.ethereum.state.global_state import GlobalState
log = logging.getLogger(__name__) log = logging.getLogger(__name__)

@ -1,9 +1,10 @@
"""This module contains the detection code for deprecated op codes.""" """This module contains the detection code for deprecated op codes."""
import logging
from mythril.analysis.modules.base import DetectionModule
from mythril.analysis.report import Issue from mythril.analysis.report import Issue
from mythril.analysis.swc_data import DEPRICATED_FUNCTIONS_USAGE from mythril.analysis.swc_data import DEPRICATED_FUNCTIONS_USAGE
from mythril.analysis.modules.base import DetectionModule
from mythril.laser.ethereum.state.global_state import GlobalState from mythril.laser.ethereum.state.global_state import GlobalState
import logging
log = logging.getLogger(__name__) log = logging.getLogger(__name__)

@ -1,15 +1,15 @@
"""This module contains the detection code for unauthorized ether """This module contains the detection code for unauthorized ether
withdrawal.""" withdrawal."""
from mythril.analysis.ops import * import logging
from copy import copy
from mythril.analysis import solver from mythril.analysis import solver
from mythril.analysis.modules.base import DetectionModule
from mythril.analysis.report import Issue from mythril.analysis.report import Issue
from mythril.analysis.swc_data import UNPROTECTED_ETHER_WITHDRAWAL from mythril.analysis.swc_data import UNPROTECTED_ETHER_WITHDRAWAL
from mythril.analysis.modules.base import DetectionModule
from mythril.laser.ethereum.state.global_state import GlobalState
from mythril.exceptions import UnsatError from mythril.exceptions import UnsatError
from mythril.laser.smt import symbol_factory, UGT, Sum, BVAddNoOverflow from mythril.laser.ethereum.state.global_state import GlobalState
import logging from mythril.laser.smt import UGT, BVAddNoOverflow, Sum, symbol_factory
from copy import copy
log = logging.getLogger(__name__) log = logging.getLogger(__name__)

@ -1,11 +1,11 @@
"""This module contains the detection code for reachable exceptions.""" """This module contains the detection code for reachable exceptions."""
import logging
from mythril.analysis import solver
from mythril.analysis.modules.base import DetectionModule
from mythril.analysis.report import Issue from mythril.analysis.report import Issue
from mythril.analysis.swc_data import ASSERT_VIOLATION from mythril.analysis.swc_data import ASSERT_VIOLATION
from mythril.exceptions import UnsatError from mythril.exceptions import UnsatError
from mythril.analysis import solver
from mythril.analysis.modules.base import DetectionModule
import logging
from mythril.laser.ethereum.state.global_state import GlobalState from mythril.laser.ethereum.state.global_state import GlobalState
log = logging.getLogger(__name__) log = logging.getLogger(__name__)

@ -1,13 +1,14 @@
"""This module contains the detection code for potentially insecure low-level """This module contains the detection code for potentially insecure low-level
calls.""" calls."""
from mythril.analysis.report import Issue import logging
from mythril.analysis import solver from mythril.analysis import solver
from mythril.analysis.swc_data import REENTRANCY
from mythril.analysis.modules.base import DetectionModule from mythril.analysis.modules.base import DetectionModule
from mythril.laser.smt import UGT, symbol_factory from mythril.analysis.report import Issue
from mythril.laser.ethereum.state.global_state import GlobalState from mythril.analysis.swc_data import REENTRANCY
from mythril.exceptions import UnsatError from mythril.exceptions import UnsatError
import logging from mythril.laser.ethereum.state.global_state import GlobalState
from mythril.laser.smt import UGT, symbol_factory
log = logging.getLogger(__name__) log = logging.getLogger(__name__)

@ -1,25 +1,23 @@
"""This module contains the detection code for integer overflows and """This module contains the detection code for integer overflows and
underflows.""" underflows."""
import copy
import logging
from mythril.analysis import solver from mythril.analysis import solver
from mythril.analysis.modules.base import DetectionModule
from mythril.analysis.report import Issue from mythril.analysis.report import Issue
from mythril.analysis.swc_data import INTEGER_OVERFLOW_AND_UNDERFLOW from mythril.analysis.swc_data import INTEGER_OVERFLOW_AND_UNDERFLOW
from mythril.exceptions import UnsatError from mythril.exceptions import UnsatError
from mythril.laser.ethereum.taint_analysis import TaintRunner from mythril.laser.ethereum.taint_analysis import TaintRunner
from mythril.analysis.modules.base import DetectionModule
from mythril.laser.smt import ( from mythril.laser.smt import (
BitVec,
BVAddNoOverflow, BVAddNoOverflow,
BVSubNoUnderflow,
BVMulNoOverflow, BVMulNoOverflow,
BitVec, BVSubNoUnderflow,
symbol_factory,
Not, Not,
symbol_factory,
) )
import copy
import logging
log = logging.getLogger(__name__) log = logging.getLogger(__name__)

@ -1,10 +1,11 @@
import logging
from mythril.analysis import solver from mythril.analysis import solver
from mythril.analysis.modules.base import DetectionModule
from mythril.analysis.report import Issue from mythril.analysis.report import Issue
from mythril.analysis.swc_data import UNPROTECTED_SELFDESTRUCT from mythril.analysis.swc_data import UNPROTECTED_SELFDESTRUCT
from mythril.exceptions import UnsatError from mythril.exceptions import UnsatError
from mythril.analysis.modules.base import DetectionModule
from mythril.laser.ethereum.state.global_state import GlobalState from mythril.laser.ethereum.state.global_state import GlobalState
import logging
log = logging.getLogger(__name__) log = logging.getLogger(__name__)

@ -1,17 +1,16 @@
"""This module contains the detection code to find the existence of transaction """This module contains the detection code to find the existence of transaction
order dependence.""" order dependence."""
import copy
import logging import logging
import re import re
import copy
from mythril.analysis import solver from mythril.analysis import solver
from mythril.analysis.modules.base import DetectionModule
from mythril.analysis.ops import * from mythril.analysis.ops import *
from mythril.analysis.report import Issue from mythril.analysis.report import Issue
from mythril.analysis.swc_data import TX_ORDER_DEPENDENCE from mythril.analysis.swc_data import TX_ORDER_DEPENDENCE
from mythril.analysis.modules.base import DetectionModule
from mythril.exceptions import UnsatError from mythril.exceptions import UnsatError
log = logging.getLogger(__name__) log = logging.getLogger(__name__)

@ -1,8 +1,9 @@
"""This module contains various helper methods for dealing with EVM """This module contains various helper methods for dealing with EVM
operations.""" operations."""
from mythril.laser.smt import simplify
from enum import Enum from enum import Enum
from mythril.laser.ethereum import util from mythril.laser.ethereum import util
from mythril.laser.smt import simplify
class VarType(Enum): class VarType(Enum):

@ -1,11 +1,13 @@
"""This module contains functionality for hooking in detection modules and """This module contains functionality for hooking in detection modules and
executing them.""" executing them."""
import importlib.util
import logging
import pkgutil
from collections import defaultdict from collections import defaultdict
from ethereum.opcodes import opcodes from ethereum.opcodes import opcodes
from mythril.analysis import modules from mythril.analysis import modules
import pkgutil
import importlib.util
import logging
log = logging.getLogger(__name__) log = logging.getLogger(__name__)

@ -1,17 +1,18 @@
"""This module contains a wrapper around LASER for extended analysis """This module contains a wrapper around LASER for extended analysis
purposes.""" purposes."""
import copy
from mythril.analysis.security import get_detection_module_hooks from mythril.analysis.security import get_detection_module_hooks
from mythril.laser.ethereum import svm from mythril.laser.ethereum import svm
from mythril.laser.ethereum.state.account import Account from mythril.laser.ethereum.state.account import Account
from mythril.solidity.soliditycontract import SolidityContract, EVMContract
import copy
from .ops import get_variable, SStore, Call, VarType
from mythril.laser.ethereum.strategy.basic import ( from mythril.laser.ethereum.strategy.basic import (
DepthFirstSearchStrategy,
BreadthFirstSearchStrategy, BreadthFirstSearchStrategy,
DepthFirstSearchStrategy,
ReturnRandomNaivelyStrategy, ReturnRandomNaivelyStrategy,
ReturnWeightedRandomStrategy, ReturnWeightedRandomStrategy,
) )
from mythril.solidity.soliditycontract import EVMContract, SolidityContract
from .ops import Call, SStore, VarType, get_variable
class SymExecWrapper: class SymExecWrapper:

@ -1,10 +1,12 @@
"""This module contains the class representing EVM contracts, aka Smart """This module contains the class representing EVM contracts, aka Smart
Contracts.""" Contracts."""
from mythril.disassembler.disassembly import Disassembly
from ethereum import utils
import persistent
import re import re
import persistent
from ethereum import utils
from mythril.disassembler.disassembly import Disassembly
class EVMContract(persistent.Persistent): class EVMContract(persistent.Persistent):
"""This class represents an address with associated code (Smart """This class represents an address with associated code (Smart

@ -4,13 +4,15 @@ This includes a sedes class for lists, account storage receipts for
LevelDB and a class for updating account addresses. LevelDB and a class for updating account addresses.
""" """
import logging import logging
from mythril import ethereum
import time import time
from ethereum.messages import Log
import rlp import rlp
from rlp.sedes import big_endian_int, binary
from ethereum import utils from ethereum import utils
from ethereum.utils import hash32, address, int256 from ethereum.messages import Log
from ethereum.utils import address, hash32, int256
from rlp.sedes import big_endian_int, binary
from mythril import ethereum
from mythril.exceptions import AddressNotFoundError from mythril.exceptions import AddressNotFoundError
log = logging.getLogger(__name__) log = logging.getLogger(__name__)

@ -5,7 +5,7 @@ This code is adapted from: https://github.com/ConsenSys/ethjsonrpc
from abc import abstractmethod from abc import abstractmethod
from .constants import BLOCK_TAGS, BLOCK_TAG_LATEST from .constants import BLOCK_TAG_LATEST, BLOCK_TAGS
from .utils import hex_to_dec, validate_block from .utils import hex_to_dec, validate_block
GETH_DEFAULT_RPC_PORT = 8545 GETH_DEFAULT_RPC_PORT = 8545

@ -4,16 +4,18 @@ This code is adapted from: https://github.com/ConsenSys/ethjsonrpc
""" """
import json import json
import logging import logging
import requests import requests
from requests.adapters import HTTPAdapter from requests.adapters import HTTPAdapter
from requests.exceptions import ConnectionError as RequestsConnectionError from requests.exceptions import ConnectionError as RequestsConnectionError
from .base_client import BaseClient
from .exceptions import ( from .exceptions import (
ConnectionError,
BadStatusCodeError,
BadJsonError, BadJsonError,
BadResponseError, BadResponseError,
BadStatusCodeError,
ConnectionError,
) )
from .base_client import BaseClient
log = logging.getLogger(__name__) log = logging.getLogger(__name__)

@ -1,14 +1,15 @@
"""This module contains various utility functions regarding unit conversion and """This module contains various utility functions regarding unit conversion and
solc integration.""" solc integration."""
from ethereum.abi import encode_abi, encode_int
from ethereum.utils import zpad
from ethereum.abi import method_id
from mythril.exceptions import CompilerError
from subprocess import Popen, PIPE
import binascii import binascii
import os
import json import json
import os
from pathlib import Path from pathlib import Path
from subprocess import PIPE, Popen
from ethereum.abi import encode_abi, encode_int, method_id
from ethereum.utils import zpad
from mythril.exceptions import CompilerError
def safe_decode(hex_encoded_string): def safe_decode(hex_encoded_string):

@ -5,18 +5,20 @@
http://www.github.com/ConsenSys/mythril http://www.github.com/ConsenSys/mythril
""" """
import logging, coloredlogs import argparse
import json import json
import logging
import os import os
import sys import sys
import argparse
# logging.basicConfig(level=logging.DEBUG) import coloredlogs
from mythril.exceptions import CriticalError, AddressNotFoundError import mythril.support.signatures as sigs
from mythril.exceptions import AddressNotFoundError, CriticalError
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
# logging.basicConfig(level=logging.DEBUG)
log = logging.getLogger(__name__) log = logging.getLogger(__name__)

@ -3,18 +3,19 @@ instructions.py to get the necessary elements from the stack and determine the
parameters for the new global state.""" parameters for the new global state."""
import logging import logging
import re
from typing import Union from typing import Union
from mythril.laser.smt import simplify, Expression, symbol_factory
import mythril.laser.ethereum.util as util import mythril.laser.ethereum.util as util
from mythril.laser.ethereum.state.account import Account from mythril.laser.ethereum.state.account import Account
from mythril.laser.ethereum.state.calldata import ( from mythril.laser.ethereum.state.calldata import (
CalldataType, CalldataType,
SymbolicCalldata,
ConcreteCalldata, ConcreteCalldata,
SymbolicCalldata,
) )
from mythril.laser.ethereum.state.global_state import GlobalState from mythril.laser.ethereum.state.global_state import GlobalState
from mythril.laser.smt import Expression, simplify, symbol_factory
from mythril.support.loader import DynLoader from mythril.support.loader import DynLoader
import re
""" """
This module contains the business logic used by Instruction in instructions.py This module contains the business logic used by Instruction in instructions.py

@ -1,8 +1,9 @@
"""This module.""" """This module."""
from flags import Flags
from enum import Enum from enum import Enum
from typing import Dict from typing import Dict
from flags import Flags
gbl_next_uid = 0 # node counter gbl_next_uid = 0 # node counter

@ -2,33 +2,11 @@
transitions between them.""" transitions between them."""
import binascii import binascii
import logging import logging
from copy import copy, deepcopy from copy import copy, deepcopy
from typing import Callable, List, Union from typing import Callable, List, Union
from functools import reduce
from ethereum import utils from ethereum import utils
from mythril.laser.smt import (
Extract,
Expression,
UDiv,
simplify,
Concat,
ULT,
UGT,
BitVec,
is_true,
is_false,
URem,
SRem,
If,
Bool,
Or,
Not,
)
from mythril.laser.smt import symbol_factory
import mythril.laser.ethereum.natives as natives import mythril.laser.ethereum.natives as natives
import mythril.laser.ethereum.util as helper import mythril.laser.ethereum.util as helper
from mythril.laser.ethereum import util from mythril.laser.ethereum import util
@ -49,9 +27,26 @@ from mythril.laser.ethereum.transaction import (
TransactionStartSignal, TransactionStartSignal,
ContractCreationTransaction, ContractCreationTransaction,
) )
from mythril.laser.smt import (
Extract,
Expression,
UDiv,
simplify,
Concat,
ULT,
UGT,
BitVec,
is_true,
is_false,
URem,
SRem,
If,
Bool,
Or,
Not,
)
from mythril.laser.smt import symbol_factory
from mythril.support.loader import DynLoader from mythril.support.loader import DynLoader
from mythril.analysis.solver import get_model
log = logging.getLogger(__name__) log = logging.getLogger(__name__)

@ -2,14 +2,14 @@
import hashlib import hashlib
import logging import logging
from typing import Union, List from typing import List, Union
from ethereum.utils import ecrecover_to_pub from ethereum.utils import ecrecover_to_pub
from py_ecc.secp256k1 import N as secp256k1n from py_ecc.secp256k1 import N as secp256k1n
from rlp.utils import ALL_BYTES from rlp.utils import ALL_BYTES
from mythril.laser.ethereum.state.calldata import BaseCalldata, ConcreteCalldata from mythril.laser.ethereum.state.calldata import BaseCalldata, ConcreteCalldata
from mythril.laser.ethereum.util import bytearray_to_int, sha3, get_concrete_int from mythril.laser.ethereum.util import bytearray_to_int, sha3
from mythril.laser.smt import Concat, simplify from mythril.laser.smt import Concat, simplify
log = logging.getLogger(__name__) log = logging.getLogger(__name__)

@ -3,12 +3,12 @@
This includes classes representing accounts and their storage. This includes classes representing accounts and their storage.
""" """
from typing import Dict, Union, Any, KeysView from typing import Any, Dict, KeysView, Union
from z3 import ExprRef from z3 import ExprRef
from mythril.laser.smt import symbol_factory
from mythril.disassembler.disassembly import Disassembly from mythril.disassembler.disassembly import Disassembly
from mythril.laser.smt import symbol_factory
class Storage: class Storage:

@ -1,16 +1,23 @@
"""This module declares classes to represent call data.""" """This module declares classes to represent call data."""
from enum import Enum from enum import Enum
from typing import Union, Any from typing import Any, Union
from mythril.laser.smt import K, Array, If, simplify, Concat, Expression, BitVec
from mythril.laser.smt import symbol_factory
from mythril.laser.ethereum.util import get_concrete_int
from z3 import Model from z3 import Model
from z3.z3types import Z3Exception from z3.z3types import Z3Exception
from mythril.laser.ethereum.util import get_concrete_int
from mythril.laser.smt import (
Array,
BitVec,
Concat,
Expression,
If,
K,
simplify,
symbol_factory,
)
class CalldataType(Enum): class CalldataType(Enum):
CONCRETE = 1 CONCRETE = 1

@ -2,11 +2,11 @@
environment.""" environment."""
from typing import Dict from typing import Dict
from z3 import ExprRef, BitVecVal from z3 import ExprRef
from mythril.laser.smt import symbol_factory
from mythril.laser.ethereum.state.account import Account from mythril.laser.ethereum.state.account import Account
from mythril.laser.ethereum.state.calldata import CalldataType, BaseCalldata from mythril.laser.ethereum.state.calldata import BaseCalldata, CalldataType
from mythril.laser.smt import symbol_factory
class Environment: class Environment:

@ -1,16 +1,18 @@
"""This module contains a representation of a smart contract's memory.""" """This module contains a representation of a smart contract's memory."""
from typing import Union from typing import Union
from z3 import Z3Exception from z3 import Z3Exception
from mythril.laser.ethereum import util
from mythril.laser.smt import ( from mythril.laser.smt import (
BitVec, BitVec,
symbol_factory,
If,
Concat,
simplify,
Bool, Bool,
Concat,
Extract, Extract,
If,
simplify,
symbol_factory,
) )
from mythril.laser.ethereum import util
class Memory: class Memory:

@ -1,7 +1,7 @@
"""This module implements basic symbolic execution search strategies.""" """This module implements basic symbolic execution search strategies."""
from mythril.laser.ethereum.state.global_state import GlobalState
from typing import List
from random import randrange from random import randrange
from mythril.laser.ethereum.state.global_state import GlobalState
from . import BasicSearchStrategy from . import BasicSearchStrategy
try: try:

@ -4,22 +4,19 @@ from collections import defaultdict
from copy import copy from copy import copy
from datetime import datetime, timedelta from datetime import datetime, timedelta
from functools import reduce from functools import reduce
from typing import List, Tuple, Union, Callable, Dict from typing import Callable, Dict, List, Tuple, Union
from mythril.laser.ethereum.cfg import NodeFlags, Node, Edge, JumpType from mythril.laser.ethereum.cfg import Edge, JumpType, Node, NodeFlags
from mythril.laser.ethereum.evm_exceptions import StackUnderflowException from mythril.laser.ethereum.evm_exceptions import StackUnderflowException, VmException
from mythril.laser.ethereum.evm_exceptions import VmException
from mythril.laser.ethereum.instructions import Instruction from mythril.laser.ethereum.instructions import Instruction
from mythril.laser.ethereum.state.account import Account from mythril.laser.ethereum.state.account import Account
from mythril.laser.ethereum.state.global_state import GlobalState from mythril.laser.ethereum.state.global_state import GlobalState
from mythril.laser.ethereum.state.world_state import WorldState from mythril.laser.ethereum.state.world_state import WorldState
from mythril.laser.ethereum.strategy.basic import DepthFirstSearchStrategy from mythril.laser.ethereum.strategy.basic import DepthFirstSearchStrategy
from mythril.laser.ethereum.transaction import ( from mythril.laser.ethereum.transaction import (
TransactionStartSignal,
TransactionEndSignal,
ContractCreationTransaction, ContractCreationTransaction,
) TransactionEndSignal,
from mythril.laser.ethereum.transaction import ( TransactionStartSignal,
execute_contract_creation, execute_contract_creation,
execute_message_call, execute_message_call,
) )

@ -1,12 +1,13 @@
"""This module implements classes needed to perform taint analysis.""" """This module implements classes needed to perform taint analysis."""
import logging
import copy import copy
from typing import Union, List, Tuple import logging
from typing import List, Tuple, Union
import mythril.laser.ethereum.util as helper import mythril.laser.ethereum.util as helper
from mythril.analysis.symbolic import SymExecWrapper
from mythril.laser.ethereum.cfg import JumpType, Node from mythril.laser.ethereum.cfg import JumpType, Node
from mythril.laser.ethereum.state.environment import Environment from mythril.laser.ethereum.state.environment import Environment
from mythril.laser.ethereum.state.global_state import GlobalState from mythril.laser.ethereum.state.global_state import GlobalState
from mythril.analysis.symbolic import SymExecWrapper
from mythril.laser.smt import Expression from mythril.laser.smt import Expression
log = logging.getLogger(__name__) log = logging.getLogger(__name__)

@ -1,21 +1,18 @@
"""This module contians the transaction models used throughout LASER's symbolic """This module contians the transaction models used throughout LASER's symbolic
execution.""" execution."""
import array
from typing import Union from typing import Union
from mythril.disassembler.disassembly import Disassembly
from mythril.laser.smt import symbol_factory
from mythril.laser.ethereum.state.environment import Environment from z3 import ExprRef
from mythril.laser.ethereum.state.calldata import (
BaseCalldata, from mythril.disassembler.disassembly import Disassembly
ConcreteCalldata,
SymbolicCalldata,
)
from mythril.laser.ethereum.state.account import Account from mythril.laser.ethereum.state.account import Account
from mythril.laser.ethereum.state.world_state import WorldState from mythril.laser.ethereum.state.calldata import BaseCalldata, SymbolicCalldata
from mythril.laser.ethereum.state.environment import Environment
from mythril.laser.ethereum.state.global_state import GlobalState from mythril.laser.ethereum.state.global_state import GlobalState
from z3 import ExprRef from mythril.laser.ethereum.state.world_state import WorldState
import array from mythril.laser.smt import symbol_factory
_next_transaction_id = 0 _next_transaction_id = 0

@ -1,15 +1,11 @@
"""This module contains various utility conversion functions and constants for """This module contains various utility conversion functions and constants for
LASER.""" LASER."""
import re import re
from typing import Dict, List, Union
from mythril.laser.smt import is_false, is_true, simplify, If, BitVec, Bool, Expression
from mythril.laser.smt import symbol_factory
import logging
from typing import Union, List, Dict
import sha3 as _sha3 import sha3 as _sha3
from mythril.laser.smt import BitVec, Bool, Expression, If, simplify, symbol_factory
TT256 = 2 ** 256 TT256 = 2 ** 256
TT256M1 = 2 ** 256 - 1 TT256M1 = 2 ** 256 - 1

@ -1,3 +1,6 @@
import z3
from mythril.laser.smt.array import K, Array, BaseArray
from mythril.laser.smt.bitvec import ( from mythril.laser.smt.bitvec import (
BitVec, BitVec,
If, If,
@ -14,13 +17,10 @@ from mythril.laser.smt.bitvec import (
BVMulNoOverflow, BVMulNoOverflow,
BVSubNoUnderflow, BVSubNoUnderflow,
) )
from mythril.laser.smt.expression import Expression, simplify
from mythril.laser.smt.bool import Bool, is_true, is_false, Or, Not from mythril.laser.smt.bool import Bool, is_true, is_false, Or, Not
from mythril.laser.smt.array import K, Array, BaseArray from mythril.laser.smt.expression import Expression, simplify
from mythril.laser.smt.solver import Solver, Optimize from mythril.laser.smt.solver import Solver, Optimize
import z3
class SymbolFactory: class SymbolFactory:
"""A symbol factory provides a default interface for all the components of """A symbol factory provides a default interface for all the components of

@ -5,9 +5,10 @@ operations, as well as as a K-array, which can be initialized with
default values over a certain range. default values over a certain range.
""" """
from mythril.laser.smt.bitvec import BitVec
import z3 import z3
from mythril.laser.smt.bitvec import BitVec
class BaseArray: class BaseArray:
"""Base array type, which implements basic store and set operations.""" """Base array type, which implements basic store and set operations."""

@ -1,11 +1,12 @@
"""This module provides classes for an SMT abstraction of bit vectors.""" """This module provides classes for an SMT abstraction of bit vectors."""
from typing import Union
import z3 import z3
from mythril.laser.smt.expression import Expression
from mythril.laser.smt.bool import Bool from mythril.laser.smt.bool import Bool
from mythril.laser.smt.expression import Expression
from typing import Union
# fmt: off # fmt: off

@ -1,11 +1,13 @@
"""This module provides classes for an SMT abstraction of boolean """This module provides classes for an SMT abstraction of boolean
expressions.""" expressions."""
import z3
from typing import Union from typing import Union
import z3
from mythril.laser.smt.expression import Expression from mythril.laser.smt.expression import Expression
# fmt: off # fmt: off

@ -1,6 +1,6 @@
"""This module contains an abstract SMT representation of an SMT solver.""" """This module contains an abstract SMT representation of an SMT solver."""
import z3 import z3
from mythril.laser.smt.bool import Bool
from mythril.laser.smt.expression import Expression from mythril.laser.smt.expression import Expression

@ -5,35 +5,34 @@
http://www.github.com/b-mueller/mythril http://www.github.com/b-mueller/mythril
""" """
import codecs
import logging import logging
import json
import os import os
import platform
import re import re
from configparser import ConfigParser
from pathlib import Path from pathlib import Path
from shutil import copyfile
import solc
from ethereum import utils from ethereum import utils
import codecs
from solc.exceptions import SolcError from solc.exceptions import SolcError
import solc
from configparser import ConfigParser
import platform
from shutil import copyfile
from mythril.analysis.callgraph import generate_graph
from mythril.analysis.report import Report
from mythril.analysis.security import fire_lasers
from mythril.analysis.symbolic import SymExecWrapper
from mythril.analysis.traceexplore import get_serializable_statespace
from mythril.ethereum import util from mythril.ethereum import util
from mythril.ethereum.evmcontract import EVMContract from mythril.ethereum.evmcontract import EVMContract
from mythril.solidity.soliditycontract import SolidityContract, get_contracts_from_file from mythril.ethereum.interface.leveldb.client import EthLevelDB
from mythril.ethereum.interface.rpc.client import EthJsonRpc from mythril.ethereum.interface.rpc.client import EthJsonRpc
from mythril.ethereum.interface.rpc.exceptions import ConnectionError from mythril.ethereum.interface.rpc.exceptions import ConnectionError
from mythril.exceptions import CompilerError, CriticalError, NoContractFoundError
from mythril.solidity.soliditycontract import SolidityContract, get_contracts_from_file
from mythril.support import signatures from mythril.support import signatures
from mythril.support.truffle import analyze_truffle_project
from mythril.support.loader import DynLoader from mythril.support.loader import DynLoader
from mythril.exceptions import CompilerError, NoContractFoundError, CriticalError from mythril.support.truffle import analyze_truffle_project
from mythril.analysis.symbolic import SymExecWrapper
from mythril.analysis.callgraph import generate_graph
from mythril.analysis.traceexplore import get_serializable_statespace
from mythril.analysis.security import fire_lasers
from mythril.analysis.report import Report
from mythril.ethereum.interface.leveldb.client import EthLevelDB
log = logging.getLogger(__name__) log = logging.getLogger(__name__)

@ -1,17 +1,16 @@
"""The Mythril function signature database.""" """The Mythril function signature database."""
import os import functools
import time
import logging import logging
import sqlite3
import multiprocessing import multiprocessing
import functools import os
from typing import List import sqlite3
import time
from collections import defaultdict from collections import defaultdict
from subprocess import PIPE, Popen
from typing import List
from subprocess import Popen, PIPE
from mythril.exceptions import CompilerError from mythril.exceptions import CompilerError
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
lock = multiprocessing.Lock() lock = multiprocessing.Lock()

@ -1,20 +1,21 @@
"""This module contains functionality used to easily analyse Truffle """This module contains functionality used to easily analyse Truffle
projects.""" projects."""
import json
import logging
import os import os
from pathlib import PurePath
import re import re
import sys import sys
import json from pathlib import PurePath
import logging
from ethereum.utils import sha3 from ethereum.utils import sha3
from mythril.ethereum.evmcontract import EVMContract
from mythril.solidity.soliditycontract import SourceMapping from mythril.analysis.report import Report
from mythril.analysis.security import fire_lasers from mythril.analysis.security import fire_lasers
from mythril.analysis.symbolic import SymExecWrapper from mythril.analysis.symbolic import SymExecWrapper
from mythril.analysis.report import Report
from mythril.ethereum import util from mythril.ethereum import util
from mythril.ethereum.evmcontract import EVMContract
from mythril.laser.ethereum.util import get_instruction_index from mythril.laser.ethereum.util import get_instruction_index
from mythril.solidity.soliditycontract import SourceMapping
log = logging.getLogger(__name__) log = logging.getLogger(__name__)

@ -1,10 +1,12 @@
pragma solidity 0.5.0; pragma solidity 0.5.1;
contract Suicide { contract Suicide {
function kill(address payable addr) public { function kill(address payable addr) public {
selfdestruct(addr); if (addr == address(0x0)) {
selfdestruct(addr);
}
} }
} }

Loading…
Cancel
Save