Commit missing files

pull/730/head
Bernhard Mueller 6 years ago
parent 28326d6245
commit f7024dc7c2
  1. 4
      mythril/analysis/symbolic.py
  2. 2
      mythril/ethereum/evmcontract.py
  3. 4
      mythril/ethereum/interface/leveldb/client.py
  4. 8
      mythril/mythril.py
  5. 4
      mythril/solidity/soliditycontract.py
  6. 4
      mythril/support/truffle.py
  7. 8
      tests/evmcontract_test.py

@ -1,7 +1,7 @@
from mythril.analysis.security import get_detection_module_hooks
from mythril.laser.ethereum import svm
from mythril.laser.ethereum.state.account import Account
from mythril.solidity.soliditycontract import SolidityContract, ETHContract
from mythril.solidity.soliditycontract import SolidityContract, EVMContract
import copy
from .ops import get_variable, SStore, Call, VarType
from mythril.laser.ethereum.strategy.basic import (
@ -67,7 +67,7 @@ class SymExecWrapper:
self.laser.sym_exec(
creation_code=contract.creation_code, contract_name=contract.name
)
elif isinstance(contract, ETHContract) and contract.creation_code:
elif isinstance(contract, EVMContract) and contract.creation_code:
self.laser.sym_exec(
creation_code=contract.creation_code, contract_name=contract.name
)

@ -4,7 +4,7 @@ import persistent
import re
class ETHContract(persistent.Persistent):
class EVMContract(persistent.Persistent):
def __init__(
self, code="", creation_code="", name="Unknown", enable_online_lookup=False
):

@ -10,7 +10,7 @@ from ethereum import utils
from ethereum.block import BlockHeader, Block
from mythril.ethereum.interface.leveldb.state import State
from mythril.ethereum.interface.leveldb.eth_db import ETH_DB
from mythril.ethereum.ethcontract import ETHContract
from mythril.ethereum.evmcontract import EVMContract
from mythril.exceptions import AddressNotFoundError
# Per https://github.com/ethereum/go-ethereum/blob/master/core/rawdb/schema.go
@ -182,7 +182,7 @@ class EthLevelDB(object):
for account in self.reader._get_head_state().get_all_accounts():
if account.code is not None:
code = _encode_hex(account.code)
contract = ETHContract(code, enable_online_lookup=False)
contract = EVMContract(code, enable_online_lookup=False)
yield contract, account.address, account.balance

@ -18,7 +18,7 @@ from configparser import ConfigParser
import platform
from mythril.ethereum import util
from mythril.ethereum.ethcontract import ETHContract
from mythril.ethereum.evmcontract import EVMContract
from mythril.solidity.soliditycontract import SolidityContract, get_contracts_from_file
from mythril.ethereum.interface.rpc.client import EthJsonRpc
from mythril.ethereum.interface.rpc.exceptions import ConnectionError
@ -323,7 +323,7 @@ class Mythril(object):
address = util.get_indexed_address(0)
if bin_runtime:
self.contracts.append(
ETHContract(
EVMContract(
code=code,
name="MAIN",
enable_online_lookup=self.enable_online_lookup,
@ -331,7 +331,7 @@ class Mythril(object):
)
else:
self.contracts.append(
ETHContract(
EVMContract(
creation_code=code,
name="MAIN",
enable_online_lookup=self.enable_online_lookup,
@ -360,7 +360,7 @@ class Mythril(object):
)
else:
self.contracts.append(
ETHContract(
EVMContract(
code,
name=address,
enable_online_lookup=self.enable_online_lookup,

@ -1,5 +1,5 @@
import mythril.laser.ethereum.util as helper
from mythril.ethereum.ethcontract import ETHContract
from mythril.ethereum.evmcontract import EVMContract
from mythril.ethereum.util import get_solc_json
from mythril.exceptions import NoContractFoundError
@ -42,7 +42,7 @@ def get_contracts_from_file(input_file, solc_args=None, solc_binary="solc"):
raise NoContractFoundError
class SolidityContract(ETHContract):
class SolidityContract(EVMContract):
def __init__(self, input_file, name=None, solc_args=None, solc_binary="solc"):
data = get_solc_json(input_file, solc_args=solc_args, solc_binary=solc_binary)

@ -5,7 +5,7 @@ import sys
import json
import logging
from ethereum.utils import sha3
from mythril.ethereum.ethcontract import ETHContract
from mythril.ethereum.evmcontract import EVMContract
from mythril.solidity.soliditycontract import SourceMapping
from mythril.analysis.security import fire_lasers
from mythril.analysis.symbolic import SymExecWrapper
@ -43,7 +43,7 @@ def analyze_truffle_project(sigs, args):
continue
get_sigs_from_truffle(sigs, contractdata)
ethcontract = ETHContract(bytecode, name=name)
ethcontract = EVMContract(bytecode, name=name)
address = util.get_indexed_address(0)
sym = SymExecWrapper(

@ -2,13 +2,13 @@ import unittest
from mythril.ethereum.evmcontract import EVMContract
class ETHContractTestCase(unittest.TestCase):
class EVMContractTestCase(unittest.TestCase):
def setUp(self):
self.code = "0x60606040525b603c5b60006010603e565b9050593681016040523660008237602060003683856040603f5a0204f41560545760206000f35bfe5b50565b005b73c3b2ae46792547a96b9f84405e36d0e07edcd05c5b905600a165627a7a7230582062a884f947232ada573f95940cce9c8bfb7e4e14e21df5af4e884941afb55e590029"
self.creation_code = "0x60606040525b603c5b60006010603e565b9050593681016040523660008237602060003683856040603f5a0204f41560545760206000f35bfe5b50565b005b73c3b2ae46792547a96b9f84405e36d0e07edcd05c5b905600a165627a7a7230582062a884f947232ada573f95940cce9c8bfb7e4e14e21df5af4e884941afb55e590029"
class Getinstruction_listTestCase(ETHContractTestCase):
class Getinstruction_listTestCase(EVMContractTestCase):
def runTest(self):
contract = EVMContract(self.code, self.creation_code)
@ -21,7 +21,7 @@ class Getinstruction_listTestCase(ETHContractTestCase):
)
class GetEASMTestCase(ETHContractTestCase):
class GetEASMTestCase(EVMContractTestCase):
def runTest(self):
contract = EVMContract(self.code)
@ -33,7 +33,7 @@ class GetEASMTestCase(ETHContractTestCase):
)
class MatchesExpressionTestCase(ETHContractTestCase):
class MatchesExpressionTestCase(EVMContractTestCase):
def runTest(self):
contract = EVMContract(self.code)
Loading…
Cancel
Save