From bf39cf44462d84d26c0408ba71ab8ce9701f1f0e Mon Sep 17 00:00:00 2001 From: Bernhard Mueller Date: Mon, 18 Sep 2017 11:45:04 +0700 Subject: [PATCH 1/5] Create README.md --- README.md | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 00000000..87373fd7 --- /dev/null +++ b/README.md @@ -0,0 +1,43 @@ +# Mythril + +Mythril is a simple assembler and disassembler for Ethereum VM bytecode. It is useful for low-level testing/fuzzing of EVM implementations. + +## 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 + +-- TODO -- + +### Loading a contract from the Ethereum blockchain + + +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 +``` From 7a04ce3c113a70a5547a520dce6a5a54780b5a7e Mon Sep 17 00:00:00 2001 From: Bernhard Mueller Date: Mon, 18 Sep 2017 11:54:11 +0700 Subject: [PATCH 2/5] Update README.md --- README.md | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 87373fd7..57279c7e 100644 --- a/README.md +++ b/README.md @@ -25,10 +25,31 @@ POP ### Modifying and re-assembling code --- TODO -- +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: -### Loading a contract from the Ethereum blockchain +```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: +``` +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 +``` + +The virtual machine language is described in the [Ethereum Yellowpaper](http://gavwood.com/paper.pdf) + +### Loading a contract from the Ethereum blockchain 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: From 477763fbcf2ef19e1d5b8881eacb3b4f152c7fb8 Mon Sep 17 00:00:00 2001 From: Bernhard Mueller Date: Mon, 18 Sep 2017 11:54:34 +0700 Subject: [PATCH 3/5] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 57279c7e..73363913 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Mythril -Mythril is a simple assembler and disassembler for Ethereum VM bytecode. It is useful for low-level testing/fuzzing of EVM implementations. +Mythril is an assembler and disassembler for Ethereum VM bytecode. It is useful for low-level testing/fuzzing of EVM implementations. ## Installation From b62b4a90a856e34fee080df3c96361674bd38c3e Mon Sep 17 00:00:00 2001 From: Bernhard Mueller Date: Mon, 18 Sep 2017 11:57:10 +0700 Subject: [PATCH 4/5] Update README.md --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 73363913..39f8a57b 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ $ ./mythril.py -a code.easm 0x61405063607080905050 ``` -The virtual machine language is described in the [Ethereum Yellowpaper](http://gavwood.com/paper.pdf) +The virtual machine language is described in the [Ethereum Yellowpaper](http://gavwood.com/paper.pdf). ### Loading a contract from the Ethereum blockchain @@ -62,3 +62,5 @@ To load contract code from your node, pass the TxID of the transaction that crea ```bash ./mythril.py -d -t 0xbf7518b40ab1242af74229512592f77736569157faffbf373cc1b4f5d499b967 ``` + +Note: If you want to get code from the Ethereum mainnet, it is easier to download it from [Etherscan](https://etherscan.io). From fe354ead979cb670a0cce0189c330a96418d266d Mon Sep 17 00:00:00 2001 From: Bernhard Mueller Date: Mon, 18 Sep 2017 12:05:13 +0700 Subject: [PATCH 5/5] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 39f8a57b..484685ff 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Mythril -Mythril is an assembler and disassembler for Ethereum VM bytecode. It is useful for low-level testing/fuzzing of EVM implementations. +Mythril is an assembler and disassembler for Ethereum VM bytecode. It was created for low-level testing/fuzzing of EVM implementations. ## Installation