|
|
@ -1,5 +1,6 @@ |
|
|
|
import re |
|
|
|
import re |
|
|
|
from mythril.analysis.ops import VarType |
|
|
|
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.report import Issue |
|
|
|
from mythril.analysis.call_helpers import get_call_from_state |
|
|
|
from mythril.analysis.call_helpers import get_call_from_state |
|
|
@ -25,10 +26,10 @@ class PredictableDependenceModule(DetectionModule): |
|
|
|
self._issues = [] |
|
|
|
self._issues = [] |
|
|
|
|
|
|
|
|
|
|
|
@property |
|
|
|
@property |
|
|
|
def issues(self): |
|
|
|
def issues(self) -> list: |
|
|
|
return self._issues |
|
|
|
return self._issues |
|
|
|
|
|
|
|
|
|
|
|
def execute(self, state): |
|
|
|
def execute(self, state: GlobalState) -> list: |
|
|
|
self._issues.extend(_analyze_states(state)) |
|
|
|
self._issues.extend(_analyze_states(state)) |
|
|
|
return self.issues |
|
|
|
return self.issues |
|
|
|
|
|
|
|
|
|
|
@ -36,7 +37,7 @@ class PredictableDependenceModule(DetectionModule): |
|
|
|
detector = PredictableDependenceModule() |
|
|
|
detector = PredictableDependenceModule() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _analyze_states(state): |
|
|
|
def _analyze_states(state: GlobalState) -> list: |
|
|
|
issues = [] |
|
|
|
issues = [] |
|
|
|
call = get_call_from_state(state) |
|
|
|
call = get_call_from_state(state) |
|
|
|
if call is None: |
|
|
|
if call is None: |
|
|
@ -177,7 +178,7 @@ def _analyze_states(state): |
|
|
|
return issues |
|
|
|
return issues |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def solve(call): |
|
|
|
def solve(call: Call) -> bool: |
|
|
|
try: |
|
|
|
try: |
|
|
|
model = solver.get_model(call.node.constraints) |
|
|
|
model = solver.get_model(call.node.constraints) |
|
|
|
logging.debug("[DEPENDENCE_ON_PREDICTABLE_VARS] MODEL: " + str(model)) |
|
|
|
logging.debug("[DEPENDENCE_ON_PREDICTABLE_VARS] MODEL: " + str(model)) |
|
|
|