Security analysis tool for EVM bytecode. Supports smart contracts built for Ethereum, Hedera, Quorum, Vechain, Roostock, Tron and other EVM-compatible blockchains.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
mythril/README.md

67 lines
1.7 KiB

7 years ago
# Mythril
7 years ago
Mythril is an assembler and disassembler for Ethereum VM bytecode. It was created for low-level testing/fuzzing of EVM implementations.
7 years ago
## Installation
Clone the git repo:
```bash
$ git clone https://github.com/b-mueller/mythril/
$ pip install -r requirements.txt
```
## Usage
To disassemble a piece of bytecode, pass it on the command line:
```bash
$ ./mythril.py -d -c "0x606060405050"
PUSH1 0x60
PUSH1 0x40
POP
POP
```
### Modifying and re-assembling code
7 years ago
Mythril can assemble code from input files that contain one instruction per line. To start from an existing contract, save the disassembly to a text file:
7 years ago
7 years ago
```bash
$ ./mythril.py -d -c "0x606060405050" -o code.easm
```
Edit the instructions in a text editor. For example, we can change the two `PUSH` instruction from the original example:
7 years ago
7 years ago
```
PUSH2 0x4050
PUSH4 0x60708090
POP
POP
```
Save the file and run Mythril with the `-a` flag to re-assemble:
```
$ ./mythril.py -a code.easm
0x61405063607080905050
```
7 years ago
The virtual machine language is described in the [Ethereum Yellowpaper](http://gavwood.com/paper.pdf).
7 years ago
### Loading a contract from the Ethereum blockchain
7 years ago
You can also load code from an existing contract in the Ethereum blockchain. For this, you need to have a full node running, and the RPC debug interface must be activated. For example, when running `geth` you can do this as follows:
```bash
$ geth --syncmode full --rpc --rpcapi eth,debug
```
To load contract code from your node, pass the TxID of the transaction that created the contract:
```bash
./mythril.py -d -t 0xbf7518b40ab1242af74229512592f77736569157faffbf373cc1b4f5d499b967
```
7 years ago
Note: If you want to get code from the Ethereum mainnet, it is easier to download it from [Etherscan](https://etherscan.io).