mythril.support package

Submodules

mythril.support.loader module

This module contains the dynamic loader logic to get on-chain storage data and dependencies.

class mythril.support.loader.DynLoader(eth: Optional[mythril.ethereum.interface.rpc.client.EthJsonRpc], active=True)[source]

Bases: object

The dynamic loader class.

dynld[source]
Parameters:dependency_address
Returns:
read_balance[source]
Parameters:address
Returns:
read_storage[source]
Parameters:
  • contract_address
  • index
Returns:

mythril.support.lock module

class mythril.support.lock.LockFile(file_name, timeout=100, delay=0.05)[source]

Bases: object

Locks files.

acquire()[source]

Acquires a lock when possible.

release()[source]

Releases the lock

exception mythril.support.lock.LockFileException[source]

Bases: Exception

mythril.support.model module

mythril.support.model.get_model[source]

Returns a model based on given constraints as a tuple :param constraints: Tuple of constraints :param minimize: Tuple of minimization conditions :param maximize: Tuple of maximization conditions :param enforce_execution_time: Bool variable which enforces –execution-timeout’s time :return:

mythril.support.opcodes module

mythril.support.signatures module

The Mythril function signature database.

class mythril.support.signatures.SQLiteDB(path)[source]

Bases: object

Simple context manager for sqlite3 databases.

Commits everything at exit.

class mythril.support.signatures.SignatureDB(enable_online_lookup: bool = False, path: str = None)[source]

Bases: object

add(byte_sig: str, text_sig: str) → None[source]

Adds a new byte - text signature pair to the database. :param byte_sig: 4-byte signature string :param text_sig: resolved text signature :return:

get(byte_sig: str, online_timeout: int = 2) → List[str][source]

Get a function text signature for a byte signature 1) try local cache 2) try online lookup (if enabled; if not flagged as unavailable)

Parameters:
  • byte_sig – function signature hash as hexstr
  • online_timeout – online lookup timeout
Returns:

list of matching function text signatures

import_solidity_file(file_path: str, solc_binary: str = 'solc', solc_settings_json: str = None)[source]

Import Function Signatures from solidity source files.

Parameters:
  • solc_binary
  • solc_settings_json
  • file_path – solidity source code file path
Returns:

static lookup_online(byte_sig: str, timeout: int, proxies=None) → List[str][source]

Lookup function signatures from 4byte.directory.

Parameters:
  • byte_sig – function signature hash as hexstr
  • timeout – optional timeout for online lookup
  • proxies – optional proxy servers for online lookup
Returns:

a list of matching function signatures for this hash

class mythril.support.signatures.Singleton[source]

Bases: type

A metaclass type implementing the singleton pattern.

mythril.support.signatures.synchronized(sync_lock)[source]

A decorator synchronizing multi-process access to a resource.

mythril.support.source_support module

class mythril.support.source_support.Source(source_type=None, source_format=None, source_list=None)[source]

Bases: object

Class to handle to source data

get_source_from_contracts_list(contracts)[source]

get the source data from the contracts list :param contracts: the list of contracts :return:

get_source_index(bytecode_hash: str) → int[source]

Find the contract index in the list :param bytecode_hash: The contract hash :return: The index of the contract in the _source_hash list

mythril.support.start_time module

class mythril.support.start_time.StartTime[source]

Bases: object

Maintains the start time of the current contract in execution

mythril.support.support_args module

class mythril.support.support_args.Args[source]

Bases: object

This module helps in preventing args being sent through multiple of classes to reach any analysis/laser module

mythril.support.support_utils module

This module contains utility functions for the Mythril support package.

class mythril.support.support_utils.Singleton[source]

Bases: type

A metaclass type implementing the singleton pattern.

mythril.support.support_utils.get_code_hash[source]
Parameters:code – bytecode
Returns:Returns hash of the given bytecode
mythril.support.support_utils.rzpad(value, total_length)[source]

Right zero pad value x at least to length l.

mythril.support.support_utils.sha3(value)[source]
mythril.support.support_utils.zpad(x, l)[source]

Left zero pad value x at least to length l.

Module contents