Enable+apply isort via ruff/pre-commit (#1871)

* Enable+apply isort via ruff/pre-commit

* Fix cyclic imports

---------

Co-authored-by: Nikhil Parasaram <nikhilparasaram@gmail.com>
pull/1874/head
Daniel Bast 3 months ago committed by GitHub
parent 9bbe7d607e
commit 0717111a55
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 8
      .pre-commit-config.yaml
  2. 9
      mypy-stubs/z3/__init__.pyi
  3. 2
      myth
  4. 3
      mythril/__init__.py
  5. 4
      mythril/analysis/call_helpers.py
  6. 2
      mythril/analysis/issue_annotation.py
  7. 2
      mythril/analysis/module/__init__.py
  8. 6
      mythril/analysis/module/base.py
  9. 15
      mythril/analysis/module/loader.py
  10. 5
      mythril/analysis/module/modules/arbitrary_jump.py
  11. 4
      mythril/analysis/module/modules/arbitrary_write.py
  12. 10
      mythril/analysis/module/modules/delegatecall.py
  13. 7
      mythril/analysis/module/modules/dependence_on_origin.py
  14. 12
      mythril/analysis/module/modules/dependence_on_predictable_vars.py
  15. 8
      mythril/analysis/module/modules/ether_thief.py
  16. 8
      mythril/analysis/module/modules/exceptions.py
  17. 15
      mythril/analysis/module/modules/external_calls.py
  18. 27
      mythril/analysis/module/modules/integer.py
  19. 9
      mythril/analysis/module/modules/multiple_sends.py
  20. 7
      mythril/analysis/module/modules/requirements_violation.py
  21. 18
      mythril/analysis/module/modules/state_change_external_calls.py
  22. 10
      mythril/analysis/module/modules/suicide.py
  23. 12
      mythril/analysis/module/modules/transaction_order_dependence.py
  24. 14
      mythril/analysis/module/modules/unchecked_retval.py
  25. 10
      mythril/analysis/module/modules/unexpected_ether.py
  26. 12
      mythril/analysis/module/modules/user_assertions.py
  27. 6
      mythril/analysis/module/util.py
  28. 2
      mythril/analysis/potential_issues.py
  29. 15
      mythril/analysis/report.py
  30. 6
      mythril/analysis/security.py
  31. 6
      mythril/analysis/solver.py
  32. 25
      mythril/analysis/symbolic.py
  33. 6
      mythril/analysis/traceexplore.py
  34. 8
      mythril/concolic/concolic_execution.py
  35. 1
      mythril/concolic/concrete_data.py
  36. 10
      mythril/concolic/find_trace.py
  37. 2
      mythril/disassembler/asm.py
  38. 6
      mythril/disassembler/disassembly.py
  39. 6
      mythril/ethereum/evmcontract.py
  40. 12
      mythril/ethereum/util.py
  41. 19
      mythril/interfaces/cli.py
  42. 2
      mythril/interfaces/epic.py
  43. 12
      mythril/laser/ethereum/call.py
  44. 5
      mythril/laser/ethereum/cfg.py
  45. 5
      mythril/laser/ethereum/cheat_code.py
  46. 2
      mythril/laser/ethereum/function_managers/__init__.py
  47. 5
      mythril/laser/ethereum/function_managers/exponent_function_manager.py
  48. 18
      mythril/laser/ethereum/function_managers/keccak_function_manager.py
  49. 16
      mythril/laser/ethereum/instruction_data.py
  50. 79
      mythril/laser/ethereum/instructions.py
  51. 19
      mythril/laser/ethereum/natives.py
  52. 7
      mythril/laser/ethereum/state/account.py
  53. 14
      mythril/laser/ethereum/state/calldata.py
  54. 12
      mythril/laser/ethereum/state/constraints.py
  55. 10
      mythril/laser/ethereum/state/global_state.py
  56. 9
      mythril/laser/ethereum/state/machine_state.py
  57. 7
      mythril/laser/ethereum/state/memory.py
  58. 3
      mythril/laser/ethereum/state/transient_storage.py
  59. 9
      mythril/laser/ethereum/state/world_state.py
  60. 1
      mythril/laser/ethereum/strategy/__init__.py
  61. 4
      mythril/laser/ethereum/strategy/basic.py
  62. 1
      mythril/laser/ethereum/strategy/beam.py
  63. 19
      mythril/laser/ethereum/strategy/concolic.py
  64. 4
      mythril/laser/ethereum/strategy/constraint_strategy.py
  65. 10
      mythril/laser/ethereum/strategy/extensions/bounded_loops.py
  66. 19
      mythril/laser/ethereum/svm.py
  67. 1
      mythril/laser/ethereum/time_handler.py
  68. 4
      mythril/laser/ethereum/transaction/__init__.py
  69. 9
      mythril/laser/ethereum/transaction/concolic.py
  70. 13
      mythril/laser/ethereum/transaction/symbolic.py
  71. 19
      mythril/laser/ethereum/transaction/transaction_models.py
  72. 4
      mythril/laser/ethereum/tx_prioritiser/rf_prioritiser.py
  73. 8
      mythril/laser/ethereum/util.py
  74. 4
      mythril/laser/plugin/builder.py
  75. 2
      mythril/laser/plugin/loader.py
  76. 10
      mythril/laser/plugin/plugins/benchmark.py
  77. 6
      mythril/laser/plugin/plugins/call_depth_limiter.py
  78. 11
      mythril/laser/plugin/plugins/coverage/coverage_plugin.py
  79. 2
      mythril/laser/plugin/plugins/coverage/coverage_strategy.py
  80. 2
      mythril/laser/plugin/plugins/coverage_metrics/coverage_data.py
  81. 13
      mythril/laser/plugin/plugins/coverage_metrics/metrics_plugin.py
  82. 22
      mythril/laser/plugin/plugins/dependency_pruner.py
  83. 7
      mythril/laser/plugin/plugins/instruction_profiler.py
  84. 14
      mythril/laser/plugin/plugins/mutation_pruner.py
  85. 10
      mythril/laser/plugin/plugins/plugin_annotations.py
  86. 3
      mythril/laser/plugin/plugins/state_merge/check_mergeability.py
  87. 7
      mythril/laser/plugin/plugins/state_merge/merge_states.py
  88. 12
      mythril/laser/plugin/plugins/state_merge/state_merge_plugin.py
  89. 11
      mythril/laser/plugin/plugins/summary/annotations.py
  90. 46
      mythril/laser/plugin/plugins/summary/core.py
  91. 11
      mythril/laser/plugin/plugins/summary/summary.py
  92. 7
      mythril/laser/plugin/plugins/trace.py
  93. 34
      mythril/laser/smt/__init__.py
  94. 1
      mythril/laser/smt/array.py
  95. 4
      mythril/laser/smt/bitvec.py
  96. 7
      mythril/laser/smt/bitvec_helper.py
  97. 2
      mythril/laser/smt/bool.py
  98. 4
      mythril/laser/smt/expression.py
  99. 3
      mythril/laser/smt/function.py
  100. 4
      mythril/laser/smt/model.py
  101. Some files were not shown because too many files have changed in this diff Show More

@ -10,15 +10,15 @@ repos:
hooks:
- id: check-toml
- id: check-yaml
- repo: https://github.com/psf/black
rev: 24.8.0
hooks:
- id: black
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.6.1
hooks:
- id: ruff
args: [--fix, --show-fixes]
- repo: https://github.com/psf/black
rev: 24.8.0
hooks:
- id: black
- repo: https://github.com/scop/pre-commit-shfmt
rev: v3.8.0-1
hooks:

@ -1,15 +1,16 @@
from typing import (
overload,
Tuple,
Any,
List,
Iterable,
Iterator,
List,
Optional,
Sequence,
Tuple,
TypeVar,
Union,
Sequence,
overload,
)
from .z3types import Ast, ContextObj
class Context: ...

@ -4,8 +4,8 @@
http://www.github.com/ConsenSys/mythril
"""
from sys import exit
import mythril.interfaces.cli
import mythril.interfaces.cli
if __name__ == "__main__":
mythril.interfaces.cli.main()

@ -3,8 +3,9 @@
__docformat__ = "restructuredtext"
import logging
from mythril.plugin.loader import MythrilPluginLoader
# Accept mythril.VERSION to get mythril's current version number
from .__version__ import __version__ as VERSION
from mythril.plugin.loader import MythrilPluginLoader
log = logging.getLogger(__name__)

@ -3,9 +3,9 @@ call functionality."""
from typing import Union
from mythril.analysis.ops import VarType, Call, get_variable
from mythril.laser.ethereum.state.global_state import GlobalState
from mythril.analysis.ops import Call, VarType, get_variable
from mythril.laser.ethereum.natives import PRECOMPILE_COUNT
from mythril.laser.ethereum.state.global_state import GlobalState
def get_call_from_state(state: GlobalState) -> Union[Call, None]:

@ -1,9 +1,9 @@
from copy import deepcopy
from typing import List
from mythril.analysis.report import Issue
from mythril.laser.ethereum.state.annotation import StateAnnotation
from mythril.laser.smt import SMTBool as Bool
from copy import deepcopy
class IssueAnnotation(StateAnnotation):

@ -1,4 +1,4 @@
from mythril.analysis.module.base import EntryPoint, DetectionModule
from mythril.analysis.module.base import DetectionModule, EntryPoint
from mythril.analysis.module.loader import ModuleLoader
from mythril.analysis.module.util import (
get_detection_module_hooks,

@ -5,14 +5,14 @@ DetectionModules implement different analysis rules to find weaknesses and vulne
"""
import logging
from typing import List, Set, Optional, Tuple
from abc import ABC, abstractmethod
from enum import Enum
from typing import List, Optional, Set, Tuple
from mythril.analysis.report import Issue
from mythril.laser.ethereum.state.global_state import GlobalState
from mythril.support.support_args import args
from mythril.support.support_utils import get_code_hash
from abc import ABC, abstractmethod
from enum import Enum
# Get logger instance
log = logging.getLogger(__name__)

@ -1,14 +1,13 @@
from mythril.analysis.module.base import DetectionModule, EntryPoint
from mythril.support.support_utils import Singleton
from mythril.support.support_args import args
from typing import List, Optional
from mythril.analysis.module.base import DetectionModule, EntryPoint
from mythril.analysis.module.modules.arbitrary_jump import ArbitraryJump
from mythril.analysis.module.modules.arbitrary_write import ArbitraryStorage
from mythril.analysis.module.modules.delegatecall import ArbitraryDelegateCall
from mythril.analysis.module.modules.dependence_on_origin import TxOrigin
from mythril.analysis.module.modules.dependence_on_predictable_vars import (
PredictableVariables,
)
from mythril.analysis.module.modules.dependence_on_origin import TxOrigin
from mythril.analysis.module.modules.ether_thief import EtherThief
from mythril.analysis.module.modules.exceptions import Exceptions
from mythril.analysis.module.modules.external_calls import ExternalCalls
@ -23,13 +22,11 @@ from mythril.analysis.module.modules.transaction_order_dependence import (
TransactionOrderDependence,
)
from mythril.analysis.module.modules.unchecked_retval import UncheckedRetval
from mythril.analysis.module.modules.user_assertions import UserAssertions
from mythril.analysis.module.modules.unexpected_ether import UnexpectedEther
from mythril.analysis.module.modules.user_assertions import UserAssertions
from mythril.exceptions import DetectorNotFoundError
from typing import Optional, List
from mythril.support.support_args import args
from mythril.support.support_utils import Singleton
class ModuleLoader(object, metaclass=Singleton):

@ -2,11 +2,10 @@
import logging
from mythril.analysis.solver import get_transaction_sequence, UnsatError
from mythril.analysis.issue_annotation import IssueAnnotation
from mythril.analysis.module.base import DetectionModule, Issue, EntryPoint
from mythril.analysis.module.base import DetectionModule, EntryPoint, Issue
from mythril.analysis.solver import UnsatError, get_transaction_sequence
from mythril.analysis.swc_data import ARBITRARY_JUMP
from mythril.laser.ethereum.state.global_state import GlobalState
from mythril.laser.smt import And, BitVec, symbol_factory
from mythril.support.model import get_model

@ -1,12 +1,12 @@
"""This module contains the detection code for arbitrary storage write."""
import logging
from mythril.analysis.module.base import DetectionModule, EntryPoint
from mythril.analysis.potential_issues import (
get_potential_issues_annotation,
PotentialIssue,
get_potential_issues_annotation,
)
from mythril.analysis.swc_data import WRITE_TO_ARBITRARY_STORAGE
from mythril.laser.ethereum.state.global_state import GlobalState
from mythril.laser.smt import symbol_factory

@ -3,19 +3,19 @@
import logging
from typing import List
from mythril.analysis.module.base import DetectionModule, EntryPoint
from mythril.analysis.potential_issues import (
get_potential_issues_annotation,
PotentialIssue,
get_potential_issues_annotation,
)
from mythril.analysis.swc_data import DELEGATECALL_TO_UNTRUSTED_CONTRACT
from mythril.exceptions import UnsatError
from mythril.laser.ethereum.state.global_state import GlobalState
from mythril.laser.ethereum.transaction.symbolic import ACTORS
from mythril.laser.ethereum.transaction.transaction_models import (
ContractCreationTransaction,
)
from mythril.analysis.module.base import DetectionModule, EntryPoint
from mythril.exceptions import UnsatError
from mythril.laser.ethereum.state.global_state import GlobalState
from mythril.laser.smt import symbol_factory, UGT
from mythril.laser.smt import UGT, symbol_factory
log = logging.getLogger(__name__)

@ -3,15 +3,16 @@ dependence."""
import logging
from copy import copy
from typing import List
from mythril.analysis import solver
from mythril.analysis.issue_annotation import IssueAnnotation
from mythril.analysis.module.base import DetectionModule, EntryPoint
from mythril.analysis.report import Issue
from mythril.exceptions import UnsatError
from mythril.analysis import solver
from mythril.analysis.swc_data import TX_ORIGIN_USAGE
from mythril.exceptions import UnsatError
from mythril.laser.ethereum.state.global_state import GlobalState
from mythril.laser.smt import And
from typing import List
log = logging.getLogger(__name__)

@ -2,18 +2,18 @@
dependence."""
import logging
from typing import List, cast
from mythril.analysis import solver
from mythril.analysis.issue_annotation import IssueAnnotation
from mythril.analysis.module.base import DetectionModule, EntryPoint
from mythril.analysis.module.module_helpers import is_prehook
from mythril.analysis.report import Issue
from mythril.exceptions import UnsatError
from mythril.analysis import solver
from mythril.laser.smt import And, ULT, symbol_factory
from mythril.analysis.swc_data import TIMESTAMP_DEPENDENCE, WEAK_RANDOMNESS
from mythril.analysis.module.module_helpers import is_prehook
from mythril.laser.ethereum.state.global_state import GlobalState
from mythril.exceptions import UnsatError
from mythril.laser.ethereum.state.annotation import StateAnnotation
from typing import cast, List
from mythril.laser.ethereum.state.global_state import GlobalState
from mythril.laser.smt import ULT, And, symbol_factory
log = logging.getLogger(__name__)

@ -4,16 +4,16 @@ withdrawal."""
import logging
from copy import copy
from mythril.analysis import solver
from mythril.analysis.module.base import DetectionModule, EntryPoint
from mythril.analysis.potential_issues import (
get_potential_issues_annotation,
PotentialIssue,
get_potential_issues_annotation,
)
from mythril.laser.ethereum.transaction.symbolic import ACTORS
from mythril.analysis.swc_data import UNPROTECTED_ETHER_WITHDRAWAL
from mythril.laser.ethereum.state.global_state import GlobalState
from mythril.analysis import solver
from mythril.exceptions import UnsatError
from mythril.laser.ethereum.state.global_state import GlobalState
from mythril.laser.ethereum.transaction.symbolic import ACTORS
from mythril.laser.smt import UGT
log = logging.getLogger(__name__)

@ -1,20 +1,18 @@
"""This module contains the detection code for reachable exceptions."""
import logging
from typing import List, Optional, cast
from typing import cast, List, Optional
from mythril.analysis import solver
from mythril.analysis.issue_annotation import IssueAnnotation
from mythril.analysis.module.base import DetectionModule, EntryPoint
from mythril.analysis.report import Issue
from mythril.analysis.swc_data import ASSERT_VIOLATION
from mythril.exceptions import UnsatError
from mythril.laser.ethereum.state.global_state import GlobalState
from mythril.laser.ethereum.state.annotation import StateAnnotation
from mythril.laser.ethereum import util
from mythril.laser.ethereum.state.annotation import StateAnnotation
from mythril.laser.ethereum.state.global_state import GlobalState
from mythril.laser.smt import And
from mythril.support.support_utils import get_code_hash
log = logging.getLogger(__name__)

@ -1,21 +1,22 @@
"""This module contains the detection code for potentially insecure low-level
calls."""
import logging
from copy import copy
from mythril.analysis import solver
from mythril.analysis.module.base import DetectionModule, EntryPoint
from mythril.analysis.potential_issues import (
PotentialIssue,
get_potential_issues_annotation,
)
from mythril.analysis.swc_data import REENTRANCY
from mythril.laser.ethereum.state.constraints import Constraints
from mythril.laser.ethereum.transaction.symbolic import ACTORS
from mythril.analysis.module.base import DetectionModule, EntryPoint
from mythril.laser.smt import UGT, symbol_factory, Or, BitVec
from mythril.exceptions import UnsatError
from mythril.laser.ethereum.natives import PRECOMPILE_COUNT
from mythril.laser.ethereum.state.constraints import Constraints
from mythril.laser.ethereum.state.global_state import GlobalState
from mythril.exceptions import UnsatError
from copy import copy
import logging
from mythril.laser.ethereum.transaction.symbolic import ACTORS
from mythril.laser.smt import UGT, BitVec, Or, symbol_factory
log = logging.getLogger(__name__)

@ -1,33 +1,34 @@
"""This module contains the detection code for integer overflows and
underflows."""
from math import log2, ceil
from typing import cast, List, Set
import logging
from copy import copy
from math import ceil, log2
from typing import List, Set, cast
from mythril.analysis import solver
from mythril.analysis.issue_annotation import IssueAnnotation
from mythril.analysis.module.base import DetectionModule, EntryPoint
from mythril.analysis.report import Issue
from mythril.analysis.swc_data import INTEGER_OVERFLOW_AND_UNDERFLOW
from mythril.exceptions import UnsatError
from mythril.laser.ethereum.state.global_state import GlobalState
from mythril.laser.ethereum.state.annotation import StateAnnotation
from mythril.analysis.module.base import DetectionModule, EntryPoint
from copy import copy
from mythril.laser.ethereum.state.global_state import GlobalState
from mythril.laser.smt import (
And,
BitVec,
BVAddNoOverflow,
BVSubNoUnderflow,
BVMulNoOverflow,
BitVec,
BVSubNoUnderflow,
Expression,
If,
symbol_factory,
Not,
Expression,
symbol_factory,
)
from mythril.laser.smt import (
SMTBool as Bool,
And,
)
import logging
log = logging.getLogger(__name__)

@ -1,17 +1,18 @@
"""This module contains the detection code to find multiple sends occurring in
a single transaction."""
import logging
from copy import copy
from typing import cast, List
from typing import List, cast
from mythril.analysis.issue_annotation import IssueAnnotation
from mythril.analysis.module.base import DetectionModule, EntryPoint
from mythril.analysis.report import Issue
from mythril.analysis.solver import get_transaction_sequence, UnsatError
from mythril.analysis.solver import UnsatError, get_transaction_sequence
from mythril.analysis.swc_data import MULTIPLE_SENDS
from mythril.analysis.module.base import DetectionModule, EntryPoint
from mythril.laser.ethereum.state.annotation import StateAnnotation
from mythril.laser.ethereum.state.global_state import GlobalState
from mythril.laser.smt import And
import logging
log = logging.getLogger(__name__)

@ -1,17 +1,16 @@
"""This module contains the detection code for requirement violations in a call"""
import logging
from typing import List
from mythril.analysis import solver
from mythril.analysis.issue_annotation import IssueAnnotation
from mythril.analysis.module.base import DetectionModule
from mythril.analysis.report import Issue
from mythril.analysis.issue_annotation import IssueAnnotation
from mythril.laser.smt import And
from mythril.analysis.swc_data import REQUIREMENT_VIOLATION
from mythril.exceptions import UnsatError
from mythril.laser.ethereum.state.global_state import GlobalState
from typing import List
from mythril.laser.smt import And
log = logging.getLogger(__name__)

@ -1,19 +1,19 @@
import logging
from copy import copy
from typing import List, Optional, cast
from mythril.analysis import solver
from mythril.analysis.module.base import DetectionModule, EntryPoint
from mythril.analysis.potential_issues import (
PotentialIssue,
get_potential_issues_annotation,
)
from mythril.analysis.swc_data import REENTRANCY
from mythril.analysis.module.base import DetectionModule, EntryPoint
from mythril.exceptions import UnsatError
from mythril.laser.ethereum.state.annotation import StateAnnotation
from mythril.laser.ethereum.state.constraints import Constraints
from mythril.laser.smt import symbol_factory, UGT, BitVec, Or
from mythril.laser.ethereum.state.global_state import GlobalState
from mythril.laser.ethereum.state.annotation import StateAnnotation
from mythril.analysis import solver
from mythril.exceptions import UnsatError
from typing import List, cast, Optional
from copy import copy
import logging
from mythril.laser.smt import UGT, BitVec, Or, symbol_factory
log = logging.getLogger(__name__)

@ -1,17 +1,17 @@
import logging
from mythril.analysis import solver
from mythril.analysis.issue_annotation import IssueAnnotation
from mythril.analysis.module.base import DetectionModule, EntryPoint
from mythril.analysis.report import Issue
from mythril.analysis.swc_data import UNPROTECTED_SELFDESTRUCT
from mythril.exceptions import UnsatError
from mythril.analysis.issue_annotation import IssueAnnotation
from mythril.analysis.module.base import DetectionModule, EntryPoint
from mythril.laser.ethereum.state.global_state import GlobalState
from mythril.laser.ethereum.transaction.symbolic import ACTORS
from mythril.laser.smt.bool import And
from mythril.laser.ethereum.transaction.transaction_models import (
ContractCreationTransaction,
)
import logging
from mythril.laser.smt.bool import And
log = logging.getLogger(__name__)

@ -1,17 +1,19 @@
"""This module contains the detection code for transaction order dependence."""
import logging
from mythril.analysis import solver
from mythril.analysis.module.base import DetectionModule
from mythril.analysis.potential_issues import (
PotentialIssue,
get_potential_issues_annotation,
)
from mythril.analysis.swc_data import TX_ORDER_DEPENDENCE
from mythril.laser.ethereum.transaction.symbolic import ACTORS
from mythril.analysis.module.base import DetectionModule
from mythril.laser.smt import Or, SMTBool as Bool
from mythril.laser.ethereum.state.global_state import GlobalState
from mythril.exceptions import UnsatError
import logging
from mythril.laser.ethereum.state.global_state import GlobalState
from mythril.laser.ethereum.transaction.symbolic import ACTORS
from mythril.laser.smt import Or
from mythril.laser.smt import SMTBool as Bool
log = logging.getLogger(__name__)

@ -1,22 +1,22 @@
"""This module contains detection code to find occurrences of calls whose
return value remains unchecked."""
import logging
from copy import copy
from typing import cast, List
from typing import List, cast
from typing_extensions import TypedDict
from mythril.analysis import solver
from mythril.analysis.issue_annotation import IssueAnnotation
from mythril.analysis.module.base import DetectionModule, EntryPoint
from mythril.analysis.report import Issue
from mythril.analysis.swc_data import UNCHECKED_RET_VAL
from mythril.analysis.module.base import DetectionModule, EntryPoint
from mythril.exceptions import UnsatError
from mythril.laser.smt import And
from mythril.laser.smt.bitvec import BitVec
from mythril.laser.ethereum.state.annotation import StateAnnotation
from mythril.laser.ethereum.state.global_state import GlobalState
import logging
from typing_extensions import TypedDict
from mythril.laser.smt import And
from mythril.laser.smt.bitvec import BitVec
log = logging.getLogger(__name__)

@ -1,16 +1,16 @@
"""This module contains the detection code for unexpected ether balance."""
from mythril.analysis.report import Issue
import logging
from mythril.analysis.issue_annotation import IssueAnnotation
from mythril.analysis.swc_data import UNEXPECTED_ETHER_BALANCE
from mythril.analysis.module.base import DetectionModule
from mythril.analysis.module.module_helpers import is_prehook
from mythril.laser.smt import BitVec, And
from mythril.analysis.report import Issue
from mythril.analysis.solver import UnsatError, get_transaction_sequence
from mythril.analysis.swc_data import UNEXPECTED_ETHER_BALANCE
from mythril.laser.ethereum.state.annotation import StateAnnotation
from mythril.laser.ethereum.state.global_state import GlobalState
import logging
from mythril.laser.smt import And, BitVec
log = logging.getLogger(__name__)

@ -1,16 +1,18 @@
"""This module contains the detection code for potentially insecure low-level
calls."""
import logging
import eth_abi
from mythril.analysis import solver
from mythril.analysis.issue_annotation import IssueAnnotation
from mythril.analysis.module.base import DetectionModule, EntryPoint
from mythril.analysis.potential_issues import Issue
from mythril.analysis.swc_data import ASSERT_VIOLATION
from mythril.analysis.module.base import DetectionModule, EntryPoint
from mythril.laser.ethereum.state.global_state import GlobalState
from mythril.laser.smt import Extract, And
from mythril.exceptions import UnsatError
import logging
import eth_abi
from mythril.laser.ethereum.state.global_state import GlobalState
from mythril.laser.smt import And, Extract
log = logging.getLogger(__name__)

@ -1,10 +1,10 @@
from collections import defaultdict
from typing import List, Optional, Callable, Mapping, Dict
import logging
from collections import defaultdict
from typing import Callable, Dict, List, Mapping, Optional
from mythril.support.opcodes import OPCODES
from mythril.analysis.module.base import DetectionModule, EntryPoint
from mythril.analysis.module.loader import ModuleLoader
from mythril.support.opcodes import OPCODES
log = logging.getLogger(__name__)
OP_CODE_LIST = OPCODES.keys()

@ -1,5 +1,5 @@
from mythril.analysis.report import Issue
from mythril.analysis.issue_annotation import IssueAnnotation
from mythril.analysis.report import Issue
from mythril.analysis.solver import get_transaction_sequence
from mythril.exceptions import UnsatError
from mythril.laser.ethereum.state.annotation import StateAnnotation

@ -1,27 +1,28 @@
"""This module provides classes that make up an issue report."""
import logging
import re
import json
import logging
import operator
import re
try:
from eth_abi import decode
except ImportError:
from eth_abi import decode_abi as decode
from jinja2 import PackageLoader, Environment
from typing import Dict, Iterable, List, Any, Optional
import hashlib
from time import time
from typing import Any, Dict, Iterable, List, Optional
from jinja2 import Environment, PackageLoader
from mythril.analysis.swc_data import SWC_TO_TITLE
from mythril.laser.execution_info import ExecutionInfo
from mythril.solidity.soliditycontract import SolidityContract
from mythril.analysis.swc_data import SWC_TO_TITLE
from mythril.support.signatures import SignatureDB
from mythril.support.source_support import Source
from mythril.support.start_time import StartTime
from mythril.support.support_utils import get_code_hash
from mythril.support.signatures import SignatureDB
from time import time
log = logging.getLogger(__name__)

@ -1,13 +1,13 @@
"""This module contains functionality for hooking in detection modules and
executing them."""
import logging
from typing import List, Optional
from mythril.analysis.module import ModuleLoader, reset_callback_modules
from mythril.analysis.module.base import EntryPoint
from mythril.analysis.report import Issue
from typing import Optional, List
import logging
log = logging.getLogger(__name__)

@ -1,17 +1,15 @@
"""This module contains analysis module helpers to solve path constraints."""
from typing import Dict, List, Tuple, Union, Any
import z3
import logging
from typing import Any, Dict, List, Tuple, Union
import z3
from z3 import FuncInterp
from mythril.exceptions import UnsatError
from mythril.laser.ethereum.function_managers import (
keccak_function_manager,
)
from mythril.laser.ethereum.state.constraints import Constraints
from mythril.laser.ethereum.state.global_state import GlobalState
from mythril.laser.ethereum.transaction import BaseTransaction

@ -1,42 +1,43 @@
"""This module contains a wrapper around LASER for extended analysis
purposes."""
from typing import List, Optional, Type, Union
from mythril.analysis.module import EntryPoint, ModuleLoader, get_detection_module_hooks
from mythril.laser.execution_info import ExecutionInfo
from mythril.laser.ethereum import svm
from mythril.laser.ethereum.natives import PRECOMPILE_COUNT
from mythril.laser.ethereum.state.account import Account
from mythril.laser.ethereum.state.world_state import WorldState
from mythril.laser.ethereum.strategy.basic import (
BasicSearchStrategy,
BreadthFirstSearchStrategy,
DepthFirstSearchStrategy,
ReturnRandomNaivelyStrategy,
ReturnWeightedRandomStrategy,
BasicSearchStrategy,
)
from mythril.laser.ethereum.strategy.constraint_strategy import DelayConstraintStrategy
from mythril.laser.ethereum.strategy.beam import BeamSearch
from mythril.laser.ethereum.natives import PRECOMPILE_COUNT
from mythril.laser.ethereum.strategy.constraint_strategy import DelayConstraintStrategy
from mythril.laser.ethereum.strategy.extensions.bounded_loops import (
BoundedLoopsStrategy,
)
from mythril.laser.ethereum.transaction.symbolic import ACTORS
from mythril.laser.ethereum.tx_prioritiser import RfTxPrioritiser
from mythril.laser.execution_info import ExecutionInfo
from mythril.laser.plugin.loader import LaserPluginLoader
from mythril.laser.plugin.plugins import (
CallDepthLimitBuilder,
CoveragePluginBuilder,
CoverageMetricsPluginBuilder,
CoveragePluginBuilder,
DependencyPrunerBuilder,
InstructionProfilerBuilder,
MutationPrunerBuilder,
StateMergePluginBuilder,
SymbolicSummaryPluginBuilder,
)
from mythril.laser.ethereum.strategy.extensions.bounded_loops import (
BoundedLoopsStrategy,
)
from mythril.laser.smt import symbol_factory, BitVec
from mythril.support.support_args import args
from typing import Union, List, Type, Optional
from mythril.laser.smt import BitVec, symbol_factory
from mythril.solidity.soliditycontract import EVMContract, SolidityContract
from mythril.support.support_args import args
from .ops import Call, VarType, get_variable

@ -1,10 +1,12 @@
"""This module provides a function to convert a state space into a set of state
nodes and transition edges."""
import re
from z3 import Z3Exception
from mythril.laser.smt import simplify
from mythril.laser.ethereum.svm import NodeFlags
import re
from mythril.laser.smt import simplify
colors = [
{

@ -1,16 +1,16 @@
from datetime import datetime
from typing import Dict, List, Any
from copy import deepcopy
from datetime import datetime
from typing import Any, Dict, List
from mythril.concolic.concrete_data import ConcreteData
from mythril.concolic.find_trace import concrete_execution
from mythril.laser.ethereum.state.world_state import WorldState
from mythril.laser.ethereum.strategy.concolic import ConcolicStrategy
from mythril.laser.ethereum.svm import LaserEVM
from mythril.laser.ethereum.state.world_state import WorldState
from mythril.laser.ethereum.time_handler import time_handler
from mythril.laser.ethereum.transaction.symbolic import execute_transaction
from mythril.laser.ethereum.transaction.transaction_models import tx_id_manager
from mythril.laser.smt import symbol_factory
from mythril.laser.ethereum.time_handler import time_handler
from mythril.support.support_args import args

@ -1,4 +1,5 @@
from typing import Dict, List
from typing_extensions import TypedDict

@ -1,21 +1,19 @@
import binascii
from copy import deepcopy
from datetime import datetime
from typing import List, Tuple
from mythril.concolic.concrete_data import ConcreteData
from mythril.disassembler.disassembly import Disassembly
from mythril.laser.ethereum.svm import LaserEVM
from mythril.laser.ethereum.state.world_state import WorldState
from mythril.laser.ethereum.state.account import Account
from mythril.laser.ethereum.state.world_state import WorldState
from mythril.laser.ethereum.svm import LaserEVM
from mythril.laser.ethereum.time_handler import time_handler
from mythril.laser.plugin.plugins import TraceFinderBuilder
from mythril.laser.ethereum.transaction.concolic import execute_transaction
from mythril.laser.ethereum.transaction.transaction_models import tx_id_manager
from mythril.laser.plugin.loader import LaserPluginLoader
from mythril.laser.plugin.plugins import TraceFinderBuilder
from mythril.laser.smt import symbol_factory
from mythril.laser.ethereum.transaction.transaction_models import tx_id_manager
from mythril.support.support_args import args

@ -11,7 +11,7 @@ except ImportError:
from functools import lru_cache
from mythril.ethereum import util
from mythril.support.opcodes import OPCODES, ADDRESS, ADDRESS_OPCODE_MAPPING
from mythril.support.opcodes import ADDRESS, ADDRESS_OPCODE_MAPPING, OPCODES
regex_PUSH = re.compile(r"^PUSH(\d*)$")

@ -1,11 +1,11 @@
"""This module contains the class used to represent disassembly code."""
from mythril.ethereum import util
from typing import Dict, List, Tuple
from mythril.disassembler import asm
from mythril.ethereum import util
from mythril.support.signatures import SignatureDB
from typing import Dict, List, Tuple
class Disassembly(object):
"""Disassembly class.

@ -1,13 +1,13 @@
"""This module contains the class representing EVM contracts, aka Smart
Contracts."""
import re
import logging
import re
import persistent
from mythril.support.support_utils import sha3
from mythril.disassembler.disassembly import Disassembly
from mythril.support.support_utils import get_code_hash
from mythril.support.support_utils import get_code_hash, sha3
log = logging.getLogger(__name__)

@ -3,24 +3,22 @@ solc integration."""
import binascii
import json
import logging
import os
import platform
import logging
import typing
from requests.exceptions import ConnectionError
from json.decoder import JSONDecodeError
from subprocess import PIPE, Popen
from typing import Tuple
from json.decoder import JSONDecodeError
import semantic_version as semver
from pyparsing import Word, Optional, Regex, Combine
import solcx
from pyparsing import Combine, Optional, Regex, Word
from requests.exceptions import ConnectionError
from mythril.exceptions import CompilerError
from mythril.support.support_args import args
import solcx
log = logging.getLogger(__name__)

@ -10,27 +10,24 @@ import json
import logging
import os
import sys
import coloredlogs
import traceback
from argparse import ArgumentParser, Namespace, RawTextHelpFormatter
from ast import literal_eval
from argparse import ArgumentParser, Namespace, RawTextHelpFormatter
import coloredlogs
from mythril.__version__ import __version__ as VERSION
from mythril.analysis.module import ModuleLoader
from mythril.analysis.report import Report
from mythril.concolic import concolic_execution
from mythril.exceptions import (
DetectorNotFoundError,
CriticalError,
DetectorNotFoundError,
)
from mythril.laser.ethereum.transaction.symbolic import ACTORS
from mythril.mythril import MythrilAnalyzer, MythrilConfig, MythrilDisassembler
from mythril.plugin.loader import MythrilPluginLoader
from mythril.mythril import MythrilAnalyzer, MythrilDisassembler, MythrilConfig
from mythril.analysis.module import ModuleLoader
from mythril.analysis.report import Report
from mythril.__version__ import __version__ as VERSION
# Initialise core Mythril Component
_ = MythrilPluginLoader()

@ -10,6 +10,7 @@
# https://github.com/tehmaze/lolcat
import argparse
import atexit
import math
import os
@ -17,7 +18,6 @@ import random
import re
import sys
import time
import argparse
PY3 = sys.version_info >= (3,)

@ -4,23 +4,23 @@ parameters for the new global state."""
import logging
import re
from typing import Union, List, cast, Optional
from typing import List, Optional, Union, cast
from eth.constants import GAS_CALLSTIPEND
import mythril.laser.ethereum.util as util
from mythril.laser.ethereum.util import insert_ret_val
from mythril.laser.ethereum import natives
from mythril.laser.ethereum.instruction_data import calculate_native_gas
from mythril.laser.ethereum.state.account import Account
from mythril.laser.ethereum.natives import PRECOMPILE_COUNT, PRECOMPILE_FUNCTIONS
from mythril.laser.ethereum.state.account import Account
from mythril.laser.ethereum.state.calldata import (
BaseCalldata,
SymbolicCalldata,
ConcreteCalldata,
SymbolicCalldata,
)
from mythril.laser.ethereum.state.global_state import GlobalState
from mythril.laser.smt import BitVec, If
from mythril.laser.smt import simplify, Expression, symbol_factory
from mythril.laser.ethereum.util import insert_ret_val
from mythril.laser.smt import BitVec, Expression, If, simplify, symbol_factory
from mythril.support.loader import DynLoader
"""

@ -1,11 +1,12 @@
"""This module."""
from enum import Enum
from typing import Dict, List, TYPE_CHECKING
from typing import TYPE_CHECKING, Dict, List
from mythril.laser.ethereum.state.constraints import Constraints
from flags import Flags
from mythril.laser.ethereum.state.constraints import Constraints
if TYPE_CHECKING:
from mythril.laser.ethereum.state.global_state import GlobalState

@ -1,12 +1,11 @@
from typing import Union
from mythril.laser.ethereum.util import insert_ret_val
from mythril.laser.ethereum.state.calldata import (
BaseCalldata,
)
from mythril.laser.ethereum.state.global_state import GlobalState
from mythril.laser.smt import BitVec
from mythril.laser.smt import Expression
from mythril.laser.ethereum.util import insert_ret_val
from mythril.laser.smt import BitVec, Expression
class hevm_cheat_code:

@ -1,2 +1,2 @@
from .exponent_function_manager import exponent_function_manager
from .keccak_function_manager import keccak_function_manager, KeccakFunctionManager
from .keccak_function_manager import KeccakFunctionManager, keccak_function_manager

@ -1,15 +1,16 @@
import logging
from typing import Tuple
from mythril.laser.smt import (
And,
BitVec,
SMTBool as Bool,
Function,
URem,
symbol_factory,
)
from mythril.laser.smt import (
SMTBool as Bool,
)
log = logging.getLogger(__name__)

@ -1,20 +1,20 @@
import logging
from typing import Dict, List, Optional, Tuple
from mythril.laser.smt import (
ULE,
ULT,
And,
BitVec,
Function,
Or,
URem,
symbol_factory,
ULE,
And,
ULT,
)
from mythril.laser.smt import (
SMTBool as Bool,
Or,
)
from mythril.support.support_utils import sha3
from typing import Dict, Tuple, List, Optional
import logging
TOTAL_PARTS = 10**40
PART = (2**256 - 1) // TOTAL_PARTS

@ -1,18 +1,20 @@
from eth._utils.numeric import ceil32
from typing import Tuple
from mythril.support.opcodes import OPCODES, STACK, GAS
from eth._utils.numeric import ceil32
from eth.constants import (
GAS_ECRECOVER,
GAS_SHA256WORD,
GAS_SHA256,
GAS_RIPEMD160,
GAS_RIPEMD160WORD,
GAS_IDENTITY,
GAS_IDENTITYWORD,
GAS_SHA3WORD,
GAS_RIPEMD160,
GAS_RIPEMD160WORD,
GAS_SHA3,
GAS_SHA3WORD,
GAS_SHA256,
GAS_SHA256WORD,
)
from mythril.support.opcodes import GAS, OPCODES, STACK
def calculate_sha3_gas(length: int):
"""

@ -2,71 +2,66 @@
transitions between them."""
import logging
from copy import copy, deepcopy
from typing import cast, Callable, List, Union, Tuple
from mythril.exceptions import UnsatError
from mythril.laser.smt import (
Extract,
Expression,
UDiv,
simplify,
Concat,
ULT,
UGT,
BitVec,
is_false,
URem,
SRem,
If,
SMTBool as Bool,
Not,
LShR,
UGE,
)
from mythril.laser.smt import symbol_factory
from mythril.disassembler.disassembly import Disassembly
from mythril.laser.ethereum.state.calldata import ConcreteCalldata, SymbolicCalldata
from typing import Callable, List, Tuple, Union, cast
import mythril.laser.ethereum.util as helper
from mythril.disassembler.disassembly import Disassembly
from mythril.exceptions import UnsatError
from mythril.laser.ethereum import util
from mythril.laser.ethereum.function_managers import (
keccak_function_manager,
exponent_function_manager,
)
from mythril.laser.ethereum.call import (
SYMBOLIC_CALLDATA_SIZE,
get_call_data,
get_call_parameters,
native_call,
get_call_data,
SYMBOLIC_CALLDATA_SIZE,
)
from mythril.laser.ethereum.evm_exceptions import (
VmException,
StackUnderflowException,
InvalidJumpDestination,
InvalidInstruction,
InvalidJumpDestination,
OutOfGasException,
StackUnderflowException,
VmException,
WriteProtection,
)
from mythril.laser.ethereum.instruction_data import get_opcode_gas, calculate_sha3_gas
from mythril.laser.ethereum.function_managers import (
exponent_function_manager,
keccak_function_manager,
)
from mythril.laser.ethereum.instruction_data import calculate_sha3_gas, get_opcode_gas
from mythril.laser.ethereum.state.calldata import ConcreteCalldata, SymbolicCalldata
from mythril.laser.ethereum.state.global_state import GlobalState
from mythril.laser.ethereum.state.return_data import ReturnData
from mythril.laser.ethereum.transaction import (
ContractCreationTransaction,
MessageCallTransaction,
TransactionStartSignal,
ContractCreationTransaction,
tx_id_manager,
)
from mythril.laser.smt import (
UGE,
UGT,
ULT,
BitVec,
Concat,
Expression,
Extract,
If,
LShR,
Not,
SRem,
UDiv,
URem,
is_false,
simplify,
symbol_factory,
)
from mythril.laser.smt import (
SMTBool as Bool,
)
from mythril.support.loader import DynLoader
from mythril.support.model import get_model
from mythril.support.support_utils import get_code_hash
from mythril.support.loader import DynLoader
log = logging.getLogger(__name__)
TT256 = symbol_factory.BitVecVal(0, 256)

@ -2,24 +2,21 @@
import hashlib
import logging
import blake2b
import coincurve
from typing import List
from py_ecc.secp256k1 import N as secp256k1n
from py_ecc.secp256k1 import ecdsa_raw_recover
import blake2b
import coincurve
import py_ecc.optimized_bn128 as bn128
from rlp.utils import ALL_BYTES
from eth_utils import ValidationError
from eth._utils.blake2.coders import extract_blake2b_parameters
from eth._utils.bn128 import validate_point
from eth_utils import ValidationError, big_endian_to_int, int_to_big_endian
from py_ecc.secp256k1 import N as secp256k1n
from py_ecc.secp256k1 import ecdsa_raw_recover
from rlp.utils import ALL_BYTES
from mythril.support.support_utils import sha3, zpad
from mythril.laser.ethereum.state.calldata import BaseCalldata, ConcreteCalldata
from mythril.laser.ethereum.util import extract_copy, extract32
from eth_utils import int_to_big_endian, big_endian_to_int
from mythril.laser.ethereum.util import extract32, extract_copy
from mythril.support.support_utils import sha3, zpad
log = logging.getLogger(__name__)

@ -5,12 +5,11 @@ This includes classes representing accounts and their storage.
import logging
from copy import copy, deepcopy
from typing import Any, Dict, Union, Set
from typing import Any, Dict, Set, Union
from mythril.laser.smt import Array, K, BitVec, simplify, BaseArray, If, SMTBool as Bool
from mythril.disassembler.disassembly import Disassembly
from mythril.laser.smt import symbol_factory
from mythril.laser.smt import Array, BaseArray, BitVec, If, K, simplify, symbol_factory
from mythril.laser.smt import SMTBool as Bool
from mythril.support.support_args import args
log = logging.getLogger(__name__)

@ -1,26 +1,24 @@
"""This module declares classes to represent call data."""
from typing import cast, Union, Tuple, List
from typing import Any, List, Tuple, Union, cast
from typing import Any
from z3 import Model, unsat, unknown
from z3 import Model, unknown, unsat
from z3.z3types import Z3Exception
from mythril.laser.ethereum.util import get_concrete_int
from mythril.laser.smt import (
Array,
BitVec,
SMTBool as Bool,
Concat,
Expression,
If,
K,
Solver,
simplify,
symbol_factory,
Solver,
)
from mythril.laser.smt import (
SMTBool as Bool,
)

@ -1,14 +1,16 @@
"""This module contains the class used to represent state-change constraints in
the call graph."""
from mythril.exceptions import UnsatError, SolverTimeOutException
from mythril.laser.smt import symbol_factory, simplify, SMTBool as Bool
from mythril.support.model import get_model
from mythril.laser.ethereum.function_managers import keccak_function_manager
from mythril.laser.smt.model import Model
from copy import copy
from typing import Iterable, List, Optional, Union
from mythril.exceptions import SolverTimeOutException, UnsatError
from mythril.laser.ethereum.function_managers import keccak_function_manager
from mythril.laser.smt import SMTBool as Bool
from mythril.laser.smt import simplify, symbol_factory
from mythril.laser.smt.model import Model
from mythril.support.model import get_model
class Constraints(list):
"""This class should maintain a solver and it's constraints, This class

@ -1,21 +1,21 @@
"""This module contains a representation of the global execution state."""
from typing import Dict, Union, List, Iterable, TYPE_CHECKING
from copy import copy, deepcopy
from typing import TYPE_CHECKING, Dict, Iterable, List, Union
from z3 import BitVec
from mythril.laser.smt import symbol_factory
from mythril.laser.ethereum.cfg import Node
from mythril.laser.ethereum.state.annotation import StateAnnotation
from mythril.laser.ethereum.state.environment import Environment
from mythril.laser.ethereum.state.machine_state import MachineState
from mythril.laser.ethereum.state.annotation import StateAnnotation
from mythril.laser.smt import symbol_factory
if TYPE_CHECKING:
from mythril.laser.ethereum.state.world_state import WorldState
from mythril.laser.ethereum.transaction.transaction_models import (
MessageCallTransaction,
ContractCreationTransaction,
MessageCallTransaction,
)

@ -2,18 +2,19 @@
stack."""
from copy import copy
from typing import cast, Sized, Union, Any, List, Dict, Optional
from typing import Any, Dict, List, Optional, Sized, Union, cast
from mythril.laser.smt import BitVec, SMTBool as Bool, If, Expression, symbol_factory
from eth._utils.numeric import ceil32
from eth.constants import GAS_MEMORY, GAS_MEMORY_QUADRATIC_DENOMINATOR
from mythril.laser.ethereum.evm_exceptions import (
OutOfGasException,
StackOverflowException,
StackUnderflowException,
OutOfGasException,
)
from mythril.laser.ethereum.state.memory import Memory
from mythril.laser.smt import BitVec, Expression, If, symbol_factory
from mythril.laser.smt import SMTBool as Bool
class MachineStack(list):

@ -1,19 +1,22 @@
"""This module contains a representation of a smart contract's memory."""
from copy import copy
from typing import cast, Dict, List, Union, overload
from typing import Dict, List, Union, cast, overload
from z3 import Z3Exception
from mythril.laser.ethereum import util
from mythril.laser.smt import (
BitVec,
SMTBool as Bool,
Concat,
Extract,
If,
simplify,
symbol_factory,
)
from mythril.laser.smt import (
SMTBool as Bool,
)
def convert_bv(val: Union[int, BitVec]) -> BitVec:

@ -1,6 +1,7 @@
from mythril.laser.smt import K, Concat, simplify
from copy import copy, deepcopy
from mythril.laser.smt import Concat, K, simplify
class TransientStorage:
"""

@ -2,15 +2,16 @@
from copy import copy, deepcopy
from random import randint
from typing import Dict, List, Iterator, Optional, TYPE_CHECKING
from typing import TYPE_CHECKING, Dict, Iterator, List, Optional
from eth._utils.address import generate_contract_address
from mythril.laser.ethereum.state.transient_storage import TransientStorage
from mythril.support.loader import DynLoader
from mythril.laser.smt import symbol_factory, Array, BitVec
from mythril.laser.ethereum.state.account import Account
from mythril.laser.ethereum.state.annotation import StateAnnotation
from mythril.laser.ethereum.state.constraints import Constraints
from mythril.laser.ethereum.state.transient_storage import TransientStorage
from mythril.laser.smt import Array, BitVec, symbol_factory
from mythril.support.loader import DynLoader
if TYPE_CHECKING:
from mythril.laser.ethereum.cfg import Node

@ -1,5 +1,6 @@
from abc import ABC, abstractmethod
from typing import List
from mythril.laser.ethereum.state.global_state import GlobalState

@ -1,10 +1,10 @@
"""This module implements basic symbolic execution search strategies."""
from random import randrange
from random import choices, randrange
from mythril.laser.ethereum.state.global_state import GlobalState
from . import BasicSearchStrategy
from random import choices
class DepthFirstSearchStrategy(BasicSearchStrategy):

@ -1,4 +1,5 @@
from mythril.laser.ethereum.state.global_state import GlobalState
from . import BasicSearchStrategy

@ -1,16 +1,17 @@
from mythril.laser.ethereum.state.global_state import GlobalState
from mythril.laser.ethereum.state.constraints import Constraints
from mythril.laser.ethereum.state.annotation import StateAnnotation
import logging
import operator
from copy import copy
from functools import reduce
from typing import Any, Dict, List, Tuple, cast
from mythril.analysis.solver import get_transaction_sequence
from mythril.laser.smt import Not
from mythril.exceptions import UnsatError
from mythril.laser.ethereum.state.annotation import StateAnnotation
from mythril.laser.ethereum.state.constraints import Constraints
from mythril.laser.ethereum.state.global_state import GlobalState
from mythril.laser.smt import Not
from functools import reduce
from typing import Dict, cast, List, Any, Tuple
from copy import copy
from . import CriterionSearchStrategy
import logging
import operator
log = logging.getLogger(__name__)

@ -1,9 +1,9 @@
import logging
from mythril.laser.ethereum.state.global_state import GlobalState
from mythril.laser.ethereum.strategy.basic import BasicSearchStrategy
from mythril.support.support_utils import ModelCache
import logging
log = logging.getLogger(__name__)

@ -1,11 +1,11 @@
import logging
from copy import copy
from typing import Dict, List, cast
from mythril.laser.ethereum.state.annotation import StateAnnotation
from mythril.laser.ethereum.state.global_state import GlobalState
from mythril.laser.ethereum.strategy.basic import BasicSearchStrategy
from mythril.laser.ethereum.state.annotation import StateAnnotation
from mythril.laser.ethereum.transaction import ContractCreationTransaction
from typing import Dict, cast, List
from copy import copy
import logging
log = logging.getLogger(__name__)

@ -1,27 +1,23 @@
"""This module implements the main symbolic execution engine."""
import logging
import random
from abc import ABCMeta
from collections import defaultdict
from copy import copy
from datetime import datetime, timedelta
import random
from typing import Callable, Dict, DefaultDict, List, Tuple, Optional
from typing import Callable, DefaultDict, Dict, List, Optional, Tuple
from mythril.support.opcodes import OPCODES
from mythril.analysis.potential_issues import check_potential_issues
from mythril.laser.execution_info import ExecutionInfo
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, VmException
from mythril.laser.ethereum.instructions import Instruction
from mythril.laser.ethereum.instruction_data import get_required_stack_elements
from mythril.laser.plugin.signals import PluginSkipWorldState, PluginSkipState
from mythril.laser.ethereum.instructions import Instruction
from mythril.laser.ethereum.state.global_state import GlobalState
from mythril.laser.ethereum.state.world_state import WorldState
from mythril.laser.ethereum.strategy.basic import DepthFirstSearchStrategy
from mythril.laser.ethereum.strategy.constraint_strategy import DelayConstraintStrategy
from abc import ABCMeta
from mythril.laser.ethereum.time_handler import time_handler
from mythril.laser.ethereum.transaction import (
ContractCreationTransaction,
TransactionEndSignal,
@ -29,7 +25,10 @@ from mythril.laser.ethereum.transaction import (
execute_contract_creation,
execute_message_call,
)
from mythril.laser.smt import And, symbol_factory, simplify
from mythril.laser.execution_info import ExecutionInfo
from mythril.laser.plugin.signals import PluginSkipState, PluginSkipWorldState
from mythril.laser.smt import And, simplify, symbol_factory
from mythril.support.opcodes import OPCODES
from mythril.support.support_args import args
log = logging.getLogger(__name__)

@ -1,4 +1,5 @@
import time
from mythril.support.support_utils import Singleton

@ -1,5 +1,5 @@
from mythril.laser.ethereum.transaction.transaction_models import *
from mythril.laser.ethereum.transaction.symbolic import (
execute_message_call,
execute_contract_creation,
execute_message_call,
)
from mythril.laser.ethereum.transaction.transaction_models import *

@ -2,21 +2,20 @@
calls."""
import binascii
from typing import List, Union
from mythril.exceptions import IllegalArgumentError
from mythril.disassembler.disassembly import Disassembly
from mythril.laser.ethereum.cfg import Node, Edge, JumpType
from mythril.laser.smt import symbol_factory
from mythril.exceptions import IllegalArgumentError
from mythril.laser.ethereum.cfg import Edge, JumpType, Node
from mythril.laser.ethereum.state.calldata import ConcreteCalldata
from mythril.laser.ethereum.state.global_state import GlobalState
from mythril.laser.ethereum.state.world_state import WorldState
from mythril.laser.ethereum.transaction.transaction_models import (
MessageCallTransaction,
ContractCreationTransaction,
MessageCallTransaction,
tx_id_manager,
)
from mythril.laser.smt import symbol_factory
def execute_contract_creation(

@ -2,22 +2,21 @@
symbolic values."""
import logging
from typing import Optional, List
from typing import List, Optional
from mythril.disassembler.disassembly import Disassembly
from mythril.laser.ethereum.cfg import Node, Edge, JumpType
from mythril.laser.ethereum.cfg import Edge, JumpType, Node
from mythril.laser.ethereum.state.account import Account
from mythril.laser.ethereum.state.calldata import SymbolicCalldata
from mythril.laser.ethereum.state.world_state import WorldState
from mythril.laser.ethereum.transaction.transaction_models import (
MessageCallTransaction,
BaseTransaction,
ContractCreationTransaction,
MessageCallTransaction,
tx_id_manager,
BaseTransaction,
)
from mythril.laser.smt import symbol_factory, Or, SMTBool as Bool, BitVec
from mythril.laser.smt import BitVec, Or, symbol_factory
from mythril.laser.smt import SMTBool as Bool
FUNCTION_HASH_BYTE_LENGTH = 4

@ -1,19 +1,24 @@
"""This module contains the transaction models used throughout LASER's symbolic
execution."""
import logging
from copy import deepcopy
from typing import Optional, Union
from z3 import ExprRef
from typing import Union, Optional
from mythril.support.support_utils import Singleton
from mythril.laser.ethereum.state.calldata import ConcreteCalldata
from mythril.laser.ethereum.state.account import Account
from mythril.laser.ethereum.state.calldata import BaseCalldata, SymbolicCalldata
from mythril.laser.ethereum.state.return_data import ReturnData
from mythril.laser.ethereum.state.calldata import (
BaseCalldata,
ConcreteCalldata,
SymbolicCalldata,
)
from mythril.laser.ethereum.state.environment import Environment
from mythril.laser.ethereum.state.global_state import GlobalState
from mythril.laser.ethereum.state.return_data import ReturnData
from mythril.laser.ethereum.state.world_state import WorldState
from mythril.laser.smt import symbol_factory, UGE, BitVec
import logging
from mythril.laser.smt import UGE, BitVec, symbol_factory
from mythril.support.support_utils import Singleton
log = logging.getLogger(__name__)

@ -1,7 +1,7 @@
import logging
import pickle
import numpy as np
import logging
import numpy as np
log = logging.getLogger(__name__)

@ -2,19 +2,21 @@
LASER."""
import re
from typing import Dict, List, Union, TYPE_CHECKING, cast
from typing import TYPE_CHECKING, Dict, List, Union, cast
if TYPE_CHECKING:
from mythril.laser.ethereum.state.machine_state import MachineState
from mythril.laser.ethereum.state.global_state import GlobalState
from mythril.laser.ethereum.state.machine_state import MachineState
from mythril.laser.smt import (
BitVec,
SMTBool as Bool,
Expression,
If,
simplify,
symbol_factory,
)
from mythril.laser.smt import (
SMTBool as Bool,
)
TT256 = 2**256
TT256M1 = 2**256 - 1

@ -1,7 +1,7 @@
from mythril.laser.plugin.interface import LaserPlugin
from abc import ABC, abstractmethod
from mythril.laser.plugin.interface import LaserPlugin
class PluginBuilder(ABC):
"""PluginBuilder

@ -2,8 +2,8 @@ import logging
from typing import Dict, List, Optional
from mythril.laser.ethereum.svm import LaserEVM
from mythril.laser.plugin.interface import LaserPlugin
from mythril.laser.plugin.builder import PluginBuilder
from mythril.laser.plugin.interface import LaserPlugin
from mythril.support.support_utils import Singleton
log = logging.getLogger(__name__)

@ -1,9 +1,11 @@
from mythril.laser.ethereum.svm import LaserEVM
from mythril.laser.plugin.interface import LaserPlugin
from mythril.laser.plugin.builder import PluginBuilder
import logging
from time import time
import matplotlib.pyplot as plt
import logging
from mythril.laser.ethereum.svm import LaserEVM
from mythril.laser.plugin.builder import PluginBuilder
from mythril.laser.plugin.interface import LaserPlugin
log = logging.getLogger(__name__)

@ -1,8 +1,8 @@
from mythril.laser.plugin.signals import PluginSkipState
from mythril.laser.plugin.interface import LaserPlugin
from mythril.laser.plugin.builder import PluginBuilder
from mythril.laser.ethereum.state.global_state import GlobalState
from mythril.laser.ethereum.svm import LaserEVM
from mythril.laser.plugin.builder import PluginBuilder
from mythril.laser.plugin.interface import LaserPlugin
from mythril.laser.plugin.signals import PluginSkipState
class CallDepthLimitBuilder(PluginBuilder):

@ -1,11 +1,10 @@
import logging
from typing import Dict, List, Tuple
from mythril.laser.ethereum.state.global_state import GlobalState
from mythril.laser.ethereum.svm import LaserEVM
from mythril.laser.plugin.interface import LaserPlugin
from mythril.laser.plugin.builder import PluginBuilder
from mythril.laser.ethereum.state.global_state import GlobalState
from typing import Dict, Tuple, List
import logging
from mythril.laser.plugin.interface import LaserPlugin
log = logging.getLogger(__name__)

@ -1,5 +1,5 @@
from mythril.laser.ethereum.strategy import BasicSearchStrategy
from mythril.laser.ethereum.state.global_state import GlobalState
from mythril.laser.ethereum.strategy import BasicSearchStrategy
from mythril.laser.plugin.plugins.coverage import InstructionCoveragePlugin

@ -1,7 +1,7 @@
import json
from mythril.support.support_utils import get_code_hash
from mythril.laser.execution_info import ExecutionInfo
from mythril.support.support_utils import get_code_hash
class InstructionCoverageInfo(ExecutionInfo):

@ -1,15 +1,16 @@
import logging
import time
from mythril.laser.ethereum.state.global_state import GlobalState
from mythril.laser.ethereum.svm import LaserEVM
from mythril.laser.plugin.interface import LaserPlugin
from mythril.laser.plugin.builder import PluginBuilder
from mythril.laser.ethereum.state.global_state import GlobalState
from mythril.laser.plugin.interface import LaserPlugin
from .constants import BATCH_OF_STATES
from .coverage_data import (
CoverageTimeSeries,
InstructionCoverageInfo,
)
from .constants import BATCH_OF_STATES
import time
import logging
log = logging.getLogger(__name__)

@ -1,20 +1,20 @@
import logging
from typing import Dict, List, Set, cast
from mythril.analysis import solver
from mythril.exceptions import UnsatError
from mythril.laser.ethereum.state.global_state import GlobalState
from mythril.laser.ethereum.svm import LaserEVM
from mythril.laser.plugin.interface import LaserPlugin
from mythril.laser.ethereum.transaction.transaction_models import (
ContractCreationTransaction,
)
from mythril.laser.plugin.builder import PluginBuilder
from mythril.laser.plugin.signals import PluginSkipState
from mythril.laser.plugin.interface import LaserPlugin
from mythril.laser.plugin.plugins.plugin_annotations import (
DependencyAnnotation,
WSDependencyAnnotation,
)
from mythril.laser.ethereum.state.global_state import GlobalState
from mythril.laser.ethereum.transaction.transaction_models import (
ContractCreationTransaction,
)
from mythril.exceptions import UnsatError
from mythril.analysis import solver
from typing import cast, List, Dict, Set
import logging
from mythril.laser.plugin.signals import PluginSkipState
log = logging.getLogger(__name__)

@ -1,11 +1,12 @@
import logging
from collections import namedtuple
from datetime import datetime
from typing import Dict, List, Tuple
from mythril.laser.ethereum.state.global_state import GlobalState
from mythril.laser.ethereum.svm import LaserEVM
from mythril.laser.plugin.builder import PluginBuilder
from mythril.laser.plugin.interface import LaserPlugin
from mythril.laser.ethereum.svm import LaserEVM
from mythril.laser.ethereum.state.global_state import GlobalState
import logging
# Type annotations:
# start_time: datetime

@ -1,15 +1,15 @@
from mythril.laser.plugin.signals import PluginSkipWorldState
from mythril.laser.plugin.interface import LaserPlugin
from mythril.laser.plugin.builder import PluginBuilder
from mythril.laser.plugin.plugins.plugin_annotations import MutationAnnotation
from mythril.analysis import solver
from mythril.exceptions import UnsatError
from mythril.laser.ethereum.state.global_state import GlobalState
from mythril.laser.ethereum.svm import LaserEVM
from mythril.laser.smt import UGT, symbol_factory
from mythril.laser.ethereum.transaction.transaction_models import (
ContractCreationTransaction,
)
from mythril.analysis import solver
from mythril.exceptions import UnsatError
from mythril.laser.plugin.builder import PluginBuilder
from mythril.laser.plugin.interface import LaserPlugin
from mythril.laser.plugin.plugins.plugin_annotations import MutationAnnotation
from mythril.laser.plugin.signals import PluginSkipWorldState
from mythril.laser.smt import UGT, symbol_factory
class MutationPrunerBuilder(PluginBuilder):

@ -1,12 +1,12 @@
import logging
from copy import copy
from typing import Dict, List, Set
from mythril.laser.ethereum.state.annotation import (
StateAnnotation,
MergeableStateAnnotation,
StateAnnotation,
)
from copy import copy
from typing import Dict, List, Set
import logging
log = logging.getLogger(__name__)

@ -1,8 +1,9 @@
import logging
from mythril.laser.ethereum.cfg import Node
from mythril.laser.ethereum.state.world_state import WorldState
from mythril.laser.ethereum.state.account import Account
from mythril.laser.ethereum.state.constraints import Constraints
from mythril.laser.ethereum.state.world_state import WorldState
from mythril.laser.smt import Not
CONSTRAINT_DIFFERENCE_LIMIT = 15

@ -1,11 +1,12 @@
import logging
from typing import Tuple, cast
from mythril.laser.ethereum.cfg import Node
from typing import Tuple, cast
from mythril.laser.ethereum.state.world_state import WorldState
from mythril.laser.ethereum.state.account import Account, Storage
from mythril.laser.ethereum.state.constraints import Constraints
from mythril.laser.smt import symbol_factory, Array, If, Or, And, Not, SMTBool as Bool
from mythril.laser.ethereum.state.world_state import WorldState
from mythril.laser.smt import And, Array, If, Not, Or, symbol_factory
from mythril.laser.smt import SMTBool as Bool
log = logging.getLogger(__name__)

@ -1,12 +1,14 @@
import logging
from copy import copy
from typing import Set, List
from typing import List, Set
from mythril.laser.ethereum.state.annotation import StateAnnotation
from mythril.laser.ethereum.state.world_state import WorldState
from mythril.laser.ethereum.svm import LaserEVM
from mythril.laser.plugin.interface import LaserPlugin
from .merge_states import merge_states
from .check_mergeability import check_ws_merge_condition
from mythril.laser.ethereum.state.world_state import WorldState
from mythril.laser.ethereum.state.annotation import StateAnnotation
import logging
from .merge_states import merge_states
log = logging.getLogger(__name__)

@ -1,10 +1,11 @@
from mythril.laser.ethereum.state.annotation import StateAnnotation
from mythril.laser.ethereum.state.global_state import GlobalState
from mythril.laser.ethereum.state.environment import Environment
from mythril.laser.smt import SMTBool as Bool, BaseArray
from copy import deepcopy
from typing import List, Tuple
from copy import deepcopy
from mythril.laser.ethereum.state.annotation import StateAnnotation
from mythril.laser.ethereum.state.environment import Environment
from mythril.laser.ethereum.state.global_state import GlobalState
from mythril.laser.smt import BaseArray
from mythril.laser.smt import SMTBool as Bool
class SummaryTrackingAnnotation(StateAnnotation):

@ -1,41 +1,43 @@
from .summary import SymbolicSummary, substitute_exprs
from .annotations import SummaryTrackingAnnotation
import logging
from copy import copy, deepcopy
from typing import List, Optional, Set, Tuple
import z3
from mythril.analysis.issue_annotation import IssueAnnotation
from mythril.analysis.potential_issues import check_potential_issues
from mythril.analysis.solver import get_transaction_sequence
from mythril.exceptions import UnsatError
from mythril.laser.ethereum.svm import LaserEVM
from mythril.laser.plugin.builder import PluginBuilder
from mythril.laser.plugin.interface import LaserPlugin
from mythril.laser.plugin.signals import PluginSkipState
from mythril.laser.plugin.plugins.plugin_annotations import MutationAnnotation
from mythril.laser.ethereum.transaction.transaction_models import (
ContractCreationTransaction,
BaseTransaction,
)
from mythril.support.support_utils import get_code_hash
from mythril.laser.ethereum.function_managers import (
keccak_function_manager,
)
from mythril.laser.ethereum.state.global_state import GlobalState
from mythril.laser.ethereum.state.calldata import SymbolicCalldata
from mythril.laser.ethereum.state.constraints import Constraints
from mythril.laser.ethereum.state.environment import Environment
from mythril.laser.ethereum.state.calldata import SymbolicCalldata
from mythril.laser.ethereum.state.global_state import GlobalState
from mythril.laser.ethereum.svm import LaserEVM
from mythril.laser.ethereum.transaction.transaction_models import (
BaseTransaction,
ContractCreationTransaction,
)
from mythril.laser.plugin.builder import PluginBuilder
from mythril.laser.plugin.interface import LaserPlugin
from mythril.laser.plugin.plugins.plugin_annotations import MutationAnnotation
from mythril.laser.plugin.signals import PluginSkipState
from mythril.laser.smt import (
Array,
SMTBool as Bool,
Expression,
Solver,
symbol_factory,
Expression,
)
from mythril.laser.smt import (
SMTBool as Bool,
)
from mythril.support.support_args import args
import z3
from typing import Tuple, List, Optional, Set
from copy import copy, deepcopy
from mythril.support.support_utils import get_code_hash
import logging
from .annotations import SummaryTrackingAnnotation
from .summary import SymbolicSummary, substitute_exprs
log = logging.getLogger(__name__)

@ -1,12 +1,13 @@
from mythril.laser.smt import Array, Solver, symbol_factory
from mythril.support.support_args import args
from mythril.laser.ethereum.state.global_state import GlobalState
from mythril.laser.plugin.plugins.plugin_annotations import MutationAnnotation
import logging
from copy import deepcopy
import logging
import z3
from mythril.laser.ethereum.state.global_state import GlobalState
from mythril.laser.plugin.plugins.plugin_annotations import MutationAnnotation
from mythril.laser.smt import Array, Solver, symbol_factory
from mythril.support.support_args import args
log = logging.getLogger(__name__)

@ -1,8 +1,9 @@
from mythril.laser.plugin.interface import LaserPlugin
from mythril.laser.plugin.builder import PluginBuilder
from typing import List, Tuple
from mythril.laser.ethereum.state.global_state import GlobalState
from mythril.laser.ethereum.svm import LaserEVM
from typing import List, Tuple
from mythril.laser.plugin.builder import PluginBuilder
from mythril.laser.plugin.interface import LaserPlugin
class TraceFinderBuilder(PluginBuilder):

@ -1,32 +1,32 @@
from mythril.laser.smt.bitvec import BitVec
from typing import Any, Generic, Optional, Set, TypeVar, Union
import z3
from mythril.laser.smt.array import Array, BaseArray, K
from mythril.laser.smt.bitvec import BitVec
from mythril.laser.smt.bitvec_helper import (
If,
UGE,
UGT,
ULT,
ULE,
Concat,
Extract,
URem,
SRem,
UDiv,
UGE,
Sum,
ULT,
BVAddNoOverflow,
BVMulNoOverflow,
BVSubNoUnderflow,
Concat,
Extract,
If,
LShR,
SRem,
Sum,
UDiv,
URem,
)
from mythril.laser.smt.bool import And, Not, Or, is_false, is_true
from mythril.laser.smt.bool import Bool as SMTBool
from mythril.laser.smt.expression import Expression, simplify
from mythril.laser.smt.bool import Bool as SMTBool, is_true, is_false, Or, Not, And
from mythril.laser.smt.array import K, Array, BaseArray
from mythril.laser.smt.function import Function
from mythril.laser.smt.solver import Solver, Optimize, SolverStatistics
from mythril.laser.smt.model import Model
from typing import Union, Any, Optional, Set, TypeVar, Generic
import z3
from mythril.laser.smt.solver import Optimize, Solver, SolverStatistics
Annotations = Optional[Set[Any]]
T = TypeVar("T", bound=Union[SMTBool, z3.BoolRef])

@ -6,6 +6,7 @@ default values over a certain range.
"""
from typing import cast
import z3
from mythril.laser.smt.bitvec import BitVec

@ -1,7 +1,7 @@
"""This module provides classes for an SMT abstraction of bit vectors."""
from operator import lshift, rshift, ne, eq
from typing import Union, Set, cast, Any, Optional, Callable
from operator import eq, lshift, ne, rshift
from typing import Any, Callable, Optional, Set, Union, cast
import z3

@ -1,9 +1,10 @@
from typing import Union, overload, List, Set, cast, Any, Callable
from typing import Any, Callable, List, Set, Union, cast, overload
import z3
from mythril.laser.smt.bool import Bool, Or
from mythril.laser.smt.array import Array, BaseArray
from mythril.laser.smt.bitvec import BitVec
from mythril.laser.smt.array import BaseArray, Array
from mythril.laser.smt.bool import Bool, Or
Annotations = Set[Any]

@ -1,7 +1,7 @@
"""This module provides classes for an SMT abstraction of boolean
expressions."""
from typing import Union, cast, Set
from typing import Set, Union, cast
import z3

@ -1,8 +1,8 @@
"""This module contains the SMT abstraction for a basic symbol expression."""
from typing import Optional, Set, Any, TypeVar, Generic, cast
import z3
from typing import Any, Generic, Optional, Set, TypeVar, cast
import z3
Annotations = Set[Any]
T = TypeVar("T", bound=z3.ExprRef)

@ -1,4 +1,5 @@
from typing import cast, List, Any, Set
from typing import Any, List, Set, cast
import z3
from mythril.laser.smt.bitvec import BitVec

@ -1,6 +1,6 @@
import z3
from typing import List, Union
from typing import Union, List
import z3
class Model:

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save