Correctly process multiple input files

pull/22/head
Bernhard Mueller 7 years ago
parent cf62c49ff5
commit d3d2322da9
  1. 3
      myth
  2. 9
      mythril/ether/ethcontract.py
  3. 4
      tests/ethcontract_test.py

@ -121,7 +121,7 @@ if (args.address or args.infiles):
except Exception as e:
exitWithError("Error establishing RPC connection: " + str(e))
# Load code
# Load contract(s) code
contracts = []
@ -145,6 +145,7 @@ else:
exitWithError("No input bytecode. Please provide EVM code via -c BYTECODE, -a ADDRESS, or -i SOLIDITY_FILES")
logging.info("Loaded " + str(len(contracts)) + " contracts")
print(contracts)
# Process commands

@ -1,4 +1,5 @@
from mythril.ether import asm, util
from mythril.ether import util
from mythril.disassembler.disassembly import Disassembly
import re
import persistent
from ethereum import utils
@ -14,7 +15,7 @@ class ETHContract(persistent.Persistent):
def get_xrefs(self):
instruction_list = asm.disassemble(util.safe_decode(self.code))
instruction_list = Disassembly(self.code).instruction_list
xrefs = []
@ -32,12 +33,12 @@ class ETHContract(persistent.Persistent):
def get_disassembly(self):
return asm.disassemble(util.safe_decode(self.code))
return Disassembly(self.code)
def get_easm(self):
return asm.instruction_list_to_easm(asm.disassemble(util.safe_decode(self.code)))
return Disassembly(self.code).get_easm()
def matches_expression(self, expression):

@ -14,9 +14,9 @@ class Getinstruction_listTestCase(ETHContractTestCase):
contract = ETHContract(self.code, self.creation_code)
instruction_list = contract.get_disassembly()
disassembly = contract.get_disassembly()
self.assertEqual(len(instruction_list), 71, 'Error disassembling code using ETHContract.get_instruction_list()')
self.assertEqual(len(disassembly.instruction_list), 71, 'Error disassembling code using ETHContract.get_instruction_list()')
class GetEASMTestCase(ETHContractTestCase):

Loading…
Cancel
Save