From 85c599d83265a0c8556b71b5a13ad54a0514d29c Mon Sep 17 00:00:00 2001 From: Nikhil Parasaram Date: Thu, 6 Jun 2019 14:32:40 +0530 Subject: [PATCH] Add a check for analysis modules run (#1064) --- mythril/analysis/symbolic.py | 18 ++++++++++-------- mythril/mythril/mythril_analyzer.py | 2 ++ 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/mythril/analysis/symbolic.py b/mythril/analysis/symbolic.py index cdcb9070..e84939bf 100644 --- a/mythril/analysis/symbolic.py +++ b/mythril/analysis/symbolic.py @@ -42,6 +42,7 @@ class SymExecWrapper: modules=(), compulsory_statespace=True, enable_iprof=False, + run_analysis_modules=True, ): """ @@ -90,14 +91,15 @@ class SymExecWrapper: plugin_loader.load(PluginFactory.build_mutation_pruner_plugin()) plugin_loader.load(PluginFactory.build_instruction_coverage_plugin()) - self.laser.register_hooks( - hook_type="pre", - hook_dict=get_detection_module_hooks(modules, hook_type="pre"), - ) - self.laser.register_hooks( - hook_type="post", - hook_dict=get_detection_module_hooks(modules, hook_type="post"), - ) + if run_analysis_modules: + self.laser.register_hooks( + hook_type="pre", + hook_dict=get_detection_module_hooks(modules, hook_type="pre"), + ) + self.laser.register_hooks( + hook_type="post", + hook_dict=get_detection_module_hooks(modules, hook_type="post"), + ) if isinstance(contract, SolidityContract): self.laser.sym_exec( diff --git a/mythril/mythril/mythril_analyzer.py b/mythril/mythril/mythril_analyzer.py index 5d0596e2..d4d4cd5b 100644 --- a/mythril/mythril/mythril_analyzer.py +++ b/mythril/mythril/mythril_analyzer.py @@ -75,6 +75,7 @@ class MythrilAnalyzer: execution_timeout=self.execution_timeout, create_timeout=self.create_timeout, enable_iprof=self.enable_iprof, + run_analysis_modules=False, ) return get_serializable_statespace(sym) @@ -108,6 +109,7 @@ class MythrilAnalyzer: transaction_count=transaction_count, create_timeout=self.create_timeout, enable_iprof=self.enable_iprof, + run_analysis_modules=False, ) return generate_graph(sym, physics=enable_physics, phrackify=phrackify)