Package: dolabra
dolabraDolabra is a semantic analysis tool for EVM bytecode based onMythrilandIthildin. By using symbolic execution and taint analysis, it aims at detecting functions that are instances of given patterns. It is primarily written in Python and contains several modules and loaders to facilitate the analysis of Solidity contracts.Table of ContentsFeaturesInstallationUsageModulesContract LoadersFeaturesAnalysis of Solidity contracts.Symbolic analysis of contracts.Multiple contract loaders to load contracts from different sources.Modular architecture to facilitate the addition of new analysis modules.CLI for easy interaction.InstallationClone the repository and install the required dependencies.$pipinstalldolabraUsageDolabra can analyze contracts provided in one of the following formats. Run dolabra --help to see all arguments that the program accepts.Deployed contracts using RPCThe following command analyzes the contract bytecode at the given target address. You'll have to supply the RPC endpoint using the--rpcargument, unless you are using geth, in which case the default endpointhttp://localhost:8545is used.$dolabraanalyze--address0x45e650d1AcE4d63541b80793510D585AceA9C37BSpecify solc compilerThis command will use the solc compiler that is currently installed on your system if --solc is not specified. Older compilers can be downloaded from theethereum/solc-binrepository (make sure you make them executable).$dolabraanalyze--soltest.sol--solc./solc-linux-amd64-v0.8.4+commit.c7e474f2Creation BytecodeProvide a file containing the EVM (creation) bytecode in one line.$dolabraanalyze--bin./creation_bytecode_example.binRuntime BytecodeProvide a file containing the runtime bytecode in one line.$dolabraanalyze--bin-runtime./runtime_bytecode_example.binModulesDolabra contains several analysis modules located in thedolabra/analysis/module/modulesdirectory. Each module is designed to perform a specific type of analysis on Solidity contracts. The available modules are:Getter: Analyzes getter functions in contracts.Payable: Analyzes payable functions in contracts, needs a more abstract approach.Setter: Analyzes setter functions in contracts.StorageCallerCheck: Checks storage caller in contracts.The followings serve as a basis for the modules (providing extendability):BaseModule: The base module from which other modules are derived.Loader: Loads contracts for analysis.Taints: Taint classes for taint analysis.Utils: Provides utility functions for modules.Contract LoadersDolabra provides several contract loaders located in thedolabra/contract_loadersdirectory to load contracts from different sources such as files, JSON-RPC, and Solidity sources. The available contract loaders are:BinaryLoader: Loads binary contracts.ContractLoader: The base loader from which other loaders are derived.FileLoader: Loads contracts from files.JsonrpcLoader: Loads contracts using JSON-RPC.Loader: Provides a generic loader interface.SolidityLoader: Loads Solidity contracts.Pitfallscargo/rust should be installed because of mythrilThere is currently a known incompatibility between rust and blake2b-pyGitHub Issue, using a nightly build of rust resolved it.Development SetupInstall all the requirements inside a virtual environment or globally. For development and testing purposes, there is the possibility to whitelist modules insymbolic.pyInstalling Dolabra Inside a Virtual Environment (Recommended)$cd<dolabra-root>
$python3-mvenv.venv
$source.venv/bin/activate
$pip3install-e.Installing Dolabra Globally$$pipinstalldolabra