Add xrefs command line option

pull/2/head
Bernhard Mueller 7 years ago
parent b9bf04be9a
commit fec1c4421d
  1. 7
      mythril/ether/contractstorage.py
  2. 7
      mythril/mythril
  3. 2
      setup.py
  4. BIN
      ~mythril/contractstorage.fs
  5. 1
      ~mythril/contractstorage.fs.index
  6. 1
      ~mythril/contractstorage.fs.lock
  7. BIN
      ~mythril/contractstorage.fs.tmp

@ -1,5 +1,5 @@
from mythril.rpc.client import EthJsonRpc from mythril.rpc.client import EthJsonRpc
from mythril.ether.ethcontract import ETHContract, InstanceList from .mythril.ether.ethcontract import ETHContract, InstanceList
import hashlib import hashlib
import os import os
import persistent import persistent
@ -37,6 +37,11 @@ class ContractStorage(persistent.Persistent):
self.instance_lists= BTree() self.instance_lists= BTree()
self.last_block = 0 self.last_block = 0
def get_contract_by_hash(self, contract_hash):
return self.contracts[contract_hash]
def initialize(self, rpchost, rpcport, sync_all): def initialize(self, rpchost, rpcport, sync_all):
eth = EthJsonRpc(rpchost, rpcport) eth = EthJsonRpc(rpchost, rpcport)

@ -35,6 +35,7 @@ parser.add_argument('-a', '--address', default='0x0123456789ABCDEF0123456789ABCD
parser.add_argument('-o', '--outfile') parser.add_argument('-o', '--outfile')
parser.add_argument('--data', help='message call input data for tracing') parser.add_argument('--data', help='message call input data for tracing')
parser.add_argument('--search', help='search the contract database') parser.add_argument('--search', help='search the contract database')
parser.add_argument('--xrefs', help='get xrefs from contract in database', metavar='CONTRACT_HASH')
parser.add_argument('--hash', help='calculate function signature hash', metavar='SIGNATURE') parser.add_argument('--hash', help='calculate function signature hash', metavar='SIGNATURE')
parser.add_argument('--init-db', action='store_true', help='Initialize the contract database') parser.add_argument('--init-db', action='store_true', help='Initialize the contract database')
parser.add_argument('--sync-all', action='store_true', help='Also sync contracts with zero balance') parser.add_argument('--sync-all', action='store_true', help='Also sync contracts with zero balance')
@ -110,6 +111,12 @@ elif (args.search):
contract_storage.search(args.search, searchCallback) contract_storage.search(args.search, searchCallback)
elif (args.xrefs):
contract_hash = bytes.fromhex(args.xrefs)
contract = contract_storage.get_contract_by_hash(contract_hash)
print("\n".join(contract.get_xrefs()))
elif (args.init_db): elif (args.init_db):
contract_storage.initialize(args.rpchost, args.rpcport, args.sync_all) contract_storage.initialize(args.rpchost, args.rpcport, args.sync_all)

@ -9,7 +9,7 @@ long_description = '''
setup( setup(
name='mythril', name='mythril',
version='0.2.7', version='0.2.8',
description='A bug hunting tool framework for the Ethereum blockchain', description='A bug hunting tool framework for the Ethereum blockchain',
long_description=long_description, long_description=long_description,

Binary file not shown.

@ -0,0 +1 @@
<EFBFBD>K.<EFBFBD>N.

Binary file not shown.
Loading…
Cancel
Save