|
| 1 | +### Ethereum scanner |
| 2 | + |
| 3 | +The ethereum scanner is a free and open-source tool for contract exploration and discovery. The scanner supports regular expression queries that allow discovery of smart contracts with complex EVM patterns. |
| 4 | + |
| 5 | +### Known issues |
| 6 | + |
| 7 | +If using an ethereum client that does not run in full sync mode, there are some things you should be aware of: |
| 8 | +- the current block number of the network might be 0 (provider.getBlockNumber() method returns zero); |
| 9 | +- the contract balances displayed might not be accurate (provider.getBalance(contractAddress) returns zero); |
| 10 | + |
| 11 | +Hence, the --block-end implicit value (the network block number) is not a valid block number, and the scan will fail. \ |
| 12 | +Also, the --balance option will filter out contracts that might have a non-zero balance. |
| 13 | + |
| 14 | +### Command line examples for hex |
| 15 | + |
| 16 | +The hex utility can be easily used to generate a function signature. |
| 17 | + |
| 18 | +``` |
| 19 | +$ ./hex --input 'transferFrom(address,address,uint256)' |
| 20 | +hex 0x23b872dd7302113369cda2901243429419bec145408fa8b352b3dd92b66c680b |
| 21 | +$ ./hex --input 'transferFrom(address,address,uint256)' --signature |
| 22 | +hex 0x23b872dd |
| 23 | +``` |
| 24 | + |
| 25 | +### Command line examples for sc4nn3r |
| 26 | + |
| 27 | +The --help option displays the available scan options. |
| 28 | +``` |
| 29 | +$ ./scanner --help |
| 30 | +Usage: scanner [options] |
| 31 | +
|
| 32 | +Options: |
| 33 | + -V, --version output the version number |
| 34 | + --client <client> ethereum client (default: "localhost") |
| 35 | + --port <port> ethereum client rpc port |
| 36 | + --block-start <block> block number scan start |
| 37 | + --block-end <block> block number scan end |
| 38 | + --query <query> query to execute |
| 39 | + --query-file <file> file with query to execute |
| 40 | + --search-creation search the data on the creation transaction |
| 41 | + --search-runtime search the contract bytecode |
| 42 | + --balance search only for contracts with non-zero balance |
| 43 | + --output-file <file> file with list of contracts that matched the search criteria |
| 44 | + --status displays status info during the scan |
| 45 | + --verbose displays contract data during the scan |
| 46 | + --summary displays summary at the end of the scan |
| 47 | + -h, --help output usage information |
| 48 | +``` |
| 49 | +Simple scan using a function signature in the query. |
| 50 | +``` |
| 51 | +$ ./scanner --port 8545 --block-start 1 --block-end 1000 --query '<<transfer(address,uint256)>>' |
| 52 | +``` |
| 53 | +Simple scan using a hexadecimal string in the query. Please note, the hexadecimal query supports regular expressions. |
| 54 | +``` |
| 55 | +$ ./scanner --port 8545 --block-start 1 --block-end 1000 --query '<<0x21[0-9]{4}3131>>' |
| 56 | +``` |
| 57 | +Scan with a function signature and a hexadecimal string. |
| 58 | +``` |
| 59 | +$ ./scanner --port 8545 --block-start 1 --block-end 1000 --query '<<transfer(address,uint256)>> && ! <<0x21[0-9]{4}3131>>' |
| 60 | +``` |
| 61 | +Scan and display a summary. |
| 62 | +``` |
| 63 | +$ ./scanner --port 8545 --block-start 1 --block-end 1000 --output-file 'scan-output.json' --summary --query '<<transfer(address,uint256)>>' |
| 64 | +``` |
| 65 | +Example of a simple scan output. |
| 66 | +``` |
| 67 | +$ ./scanner --port 14545 --block-start 7264275 --block-end 7264290 --query '<<transfer(address,uint256)>>' --output-file './scan-outputs/scan-20190227-2318.json' --status --summary --search-creation |
| 68 | +
|
| 69 | +
|
| 70 | +client localhost |
| 71 | +port 14545 |
| 72 | +block start 7264275 |
| 73 | +block end 7264290 |
| 74 | +query <<transfer(address,uint256)>> |
| 75 | +search creation bytecode true |
| 76 | +search runtime bytecode false |
| 77 | +displays status during scan |
| 78 | +displays summary at the end of the scan |
| 79 | +
|
| 80 | +
|
| 81 | +signer no password provided |
| 82 | +
|
| 83 | +
|
| 84 | +network homestead |
| 85 | +chain id 1 |
| 86 | +block# 0 |
| 87 | +
|
| 88 | +
|
| 89 | +start block 7264275 |
| 90 | +end block 7264290 |
| 91 | +query <<transfer(address,uint256)>> |
| 92 | +hexaized query <a9059cbb> |
| 93 | +
|
| 94 | +
|
| 95 | +current block 7264275 |
| 96 | +current block 7264276 |
| 97 | +current block 7264277 |
| 98 | +current block 7264278 |
| 99 | +current block 7264279 |
| 100 | +current block 7264280 |
| 101 | +current block 7264281 |
| 102 | +current block 7264282 |
| 103 | +current block 7264283 |
| 104 | +current block 7264284 |
| 105 | +
|
| 106 | +
|
| 107 | +match --------------------------------------- |
| 108 | +block number 7264284 |
| 109 | +transaction hash 0xc9a3f0b1d777fff614ace40881f8b111673b913f463b53cd04bc193a372eff98 |
| 110 | +contract address 0x5Bac8421aa6426B8B6A53C0cff5f198236484406 |
| 111 | +owner address 0x6d1803F1E66d923253A7457fC03d23F5a8e20763 |
| 112 | +transaction nonce 0 |
| 113 | +transaction value 0 |
| 114 | +contract balance 0 |
| 115 | +current block 7264285 |
| 116 | +current block 7264286 |
| 117 | +current block 7264287 |
| 118 | +
|
| 119 | +
|
| 120 | +match --------------------------------------- |
| 121 | +block number 7264287 |
| 122 | +transaction hash 0x130214070b523ebd81e09da4d17511956d3ac42131da12b7c799c7be480bfae9 |
| 123 | +contract address 0x89511Af1116384E096A9f0BD7175A627B839529C |
| 124 | +owner address 0xcDd37Ada79F589c15bD4f8fD2083dc88E34A2af2 |
| 125 | +transaction nonce 1278 |
| 126 | +transaction value 0 |
| 127 | +contract balance 0 |
| 128 | +current block 7264288 |
| 129 | +current block 7264289 |
| 130 | +current block 7264290 |
| 131 | +
|
| 132 | +
|
| 133 | +scan summary -------------------------------- |
| 134 | +
|
| 135 | +
|
| 136 | +contract 0x5Bac8421aa6426B8B6A53C0cff5f198236484406 |
| 137 | +owner 0x6d1803F1E66d923253A7457fC03d23F5a8e20763 |
| 138 | +block number 7264284 |
| 139 | +transaction hash 0xc9a3f0b1d777fff614ace40881f8b111673b913f463b53cd04bc193a372eff98 |
| 140 | +balance 0 |
| 141 | +
|
| 142 | +
|
| 143 | +contract 0x89511Af1116384E096A9f0BD7175A627B839529C |
| 144 | +owner 0xcDd37Ada79F589c15bD4f8fD2083dc88E34A2af2 |
| 145 | +block number 7264287 |
| 146 | +transaction hash 0x130214070b523ebd81e09da4d17511956d3ac42131da12b7c799c7be480bfae9 |
| 147 | +balance 0 |
| 148 | +
|
| 149 | +
|
| 150 | +done. |
| 151 | +scan: 17260.040ms |
| 152 | +
|
| 153 | +``` |
0 commit comments