mythril.analysis.module package¶
Subpackages¶
- mythril.analysis.module.modules package
- Submodules
- mythril.analysis.module.modules.arbitrary_jump module
- mythril.analysis.module.modules.arbitrary_write module
- mythril.analysis.module.modules.delegatecall module
- mythril.analysis.module.modules.dependence_on_origin module
- mythril.analysis.module.modules.dependence_on_predictable_vars module
- mythril.analysis.module.modules.ether_thief module
- mythril.analysis.module.modules.exceptions module
- mythril.analysis.module.modules.external_calls module
- mythril.analysis.module.modules.integer module
- mythril.analysis.module.modules.multiple_sends module
- mythril.analysis.module.modules.state_change_external_calls module
- mythril.analysis.module.modules.suicide module
- mythril.analysis.module.modules.unchecked_retval module
- mythril.analysis.module.modules.user_assertions module
- Module contents
Submodules¶
mythril.analysis.module.base module¶
Mythril Detection Modules
This module includes an definition of the DetectionModule interface. DetectionModules implement different analysis rules to find weaknesses and vulnerabilities.
-
class
mythril.analysis.module.base.
DetectionModule
[source]¶ Bases:
abc.ABC
The base detection module.
All custom-built detection modules must inherit from this class.
There are several class properties that expose information about the detection modules
Parameters: - name – The name of the detection module
- swc_id – The SWC ID associated with the weakness that the module detects
- description – A description of the detection module, and what it detects
- entry_point – Mythril can run callback style detection modules, or modules that search the statespace. [IMPORTANT] POST entry points severely slow down the analysis, try to always use callback style modules
- pre_hooks – A list of instructions to hook the laser vm for (pre execution of the instruction)
- post_hooks – A list of instructions to hook the laser vm for (post execution of the instruction)
-
description
= 'Detection module description'¶
-
entry_point
= 2¶
-
execute
(target: mythril.laser.ethereum.state.global_state.GlobalState) → Optional[List[mythril.analysis.report.Issue]][source]¶ The entry point for execution, which is being called by Mythril.
Parameters: target – The target of the analysis, either a global state (callback) or the entire statespace (post) Returns: List of encountered issues
-
name
= 'Detection Module Name / Title'¶
-
post_hooks
= []¶
-
pre_hooks
= []¶
-
swc_id
= 'SWC-000'¶
mythril.analysis.module.loader module¶
-
class
mythril.analysis.module.loader.
ModuleLoader
[source]¶ Bases:
object
The module loader class implements a singleton loader for detection modules.
By default it will load the detection modules in the mythril package. Additional detection modules can be loaded using the register_module function call implemented by the ModuleLoader
-
get_detection_modules
(entry_point: Optional[mythril.analysis.module.base.EntryPoint] = None, white_list: Optional[List[str]] = None) → List[mythril.analysis.module.base.DetectionModule][source]¶ Gets registered detection modules
Parameters: - entry_point – If specified: only return detection modules with this entry point
- white_list – If specified: only return whitelisted detection modules
Returns: The selected detection modules
-
mythril.analysis.module.module_helpers module¶
mythril.analysis.module.util module¶
-
mythril.analysis.module.util.
get_detection_module_hooks
(modules: List[mythril.analysis.module.base.DetectionModule], hook_type='pre') → Dict[str, List[Callable]][source]¶ Gets a dictionary with the hooks for the passed detection modules
Parameters: - modules – The modules for which to retrieve hooks
- hook_type – The type of hooks to retrieve (default: “pre”)
Returns: Dictionary with discovered hooks