Update README.md

pull/2/head
Bernhard Mueller 7 years ago committed by GitHub
parent 974c04ba27
commit 0dd4d52c63
  1. 20
      README.md

@ -45,16 +45,16 @@ The default behavior is to only sync contracts with a non-zero balance. You can
## Command line usage
The `mythril` command line tool allows you to conveniently access some of Mythril's functionality.
The Mythril command line tool (aptly named `myth`) allows you to conveniently access some of Mythril's functionality.
### Searching the database
The search feature allows you to find contract instances that contain specific function calls and opcode sequences. It supports simple boolean expressions, such as:
```bash
$ mythril --search "func#changeMultisig(address)#"
$ mythril --search "code#PUSH1 0x50,POP#"
$ mythril --search "func#changeMultisig(address)# and code#PUSH1 0x50#"
$ myth --search "func#changeMultisig(address)#"
$ myth --search "code#PUSH1 0x50,POP#"
$ myth --search "func#changeMultisig(address)# and code#PUSH1 0x50#"
```
### Disassembler
@ -62,11 +62,11 @@ $ mythril --search "func#changeMultisig(address)# and code#PUSH1 0x50#"
You can also disassemble and trace code using the `-d` and `-t` flags, respectively. When tracing, the code is run in the PyEthereum virtual machine with the (optional) input data passed via the `--data` flag.
```
$ mythril -d -a "0x3665f2bf19ee5e207645f3e635bf0f4961d661c0"
$ myth -d -a "0x3665f2bf19ee5e207645f3e635bf0f4961d661c0"
PUSH1 0x60
PUSH1 0x40
(...)
$ mythril -t -a "0x3665f2bf19ee5e207645f3e635bf0f4961d661c0"
$ myth -t -a "0x3665f2bf19ee5e207645f3e635bf0f4961d661c0"
vm storage={'storage': {}, 'nonce': '0', 'balance': '0', 'code': '0x'} gas=b'21000' stack=[] address=b'6e\xf2\xbf\x19\xee^ vE\xf3\xe65\xbf\x0fIa\xd6a\xc0' depth=0 steps=0 inst=96 pushvalue=96 pc=b'0' op=PUSH1
vm op=PUSH1 gas=b'20997' stack=[b'96'] depth=0 steps=1 inst=96 pushvalue=64 pc=b'2'
vm op=MSTORE gas=b'20994' stack=[b'96', b'64'] depth=0 steps=2 inst=82 pc=b'4'
@ -79,9 +79,7 @@ Do note however that the disassembly / debugging functionality is still quite ba
It is often useful to find other contracts referenced by a particular contract. Let's assume you want to search for contracts that fulfill conditions similar to the [Parity Multisig Wallet Bug](http://hackingdistributed.com/2017/07/22/deep-dive-parity-bug/). First, you want to find a list of contracts that use the `DELEGATECALL` opcode:
```
$ mythril --search "code#DELEGATECALL#"
Matched contract with code hash 05e8f07600bd384d82a71aaccaf4b3d3
Address: 0x432f96e95d249351391583cef9cbda38f26238c8, balance: 1000000000000000
$ myth --search "code#DELEGATECALL#"
Matched contract with code hash 07459966443977122e639cbf7804c446
Address: 0x76799f77587738bfeef09452df215b63d2cfb08a, balance: 1000000000000000
Address: 0x3582d2a3b67d63ed10f1ecaef0dca71b9283b543, balance: 92000000000000000000
@ -90,10 +88,12 @@ Address: 0x156d5687a201affb3f1e632dcfb9fde4b0128211, balance: 295000000000000000
(...)
```
Note that "code hash" in the above output refers to the contract's index in the database. The following lines starting with "Address" list the addresses of contract instances in the Ethereum blockchain (all with the same code).
You can then use the `--xrefs` flag to find the addresses of other contracts referenced:
```
$ mythril/mythril --xrefs 07459966443977122e639cbf7804c446
$ myth --xrefs 07459966443977122e639cbf7804c446
5b9e8728e316bbeb692d22daaab74f6cbf2c4691
```

Loading…
Cancel
Save