Replies: 1 comment
-
Try registering any plugin before the first transaction. That is before the creation of the contract in your case. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Codes are as the following:
from manticore.core.plugin import Plugin
from manticore.ethereum import ManticoreEVM
m = ManticoreEVM()
f_out = open("out2.txt","w")
with open("./example.sol") as f:
source_code = f.read()
targetline = "a = a+3;"
user_account = m.create_account(balance=1000)
contract_account = m.solidity_create_contract(source_code, owner=user_account)
contract_metdata = m.get_metadata(contract_account)
class EVMIns(Plugin):
def did_evm_execute_instruction_callback(self, state, address, offset, value):
try:
m = self.manticore
world = state.platform
tx = world.all_transactions[-1]
md = m.get_metadata(tx.address)
tmp = md.get_source_for(world.current_vm.instruction.pc)
print(tmp, file=f_out)
if tmp in targetline:
with self.locked_context("state_trace", dict) as state_trace:
state_trace[instruction.pc] = state
except Exception as e:
print(e, file=f_out)
raise
'''
i=i+1
print(i,file=f_out)
print(instruction.pc, file=f_out)
print(state, file=f_out)
print("*************",file=f_out)
'''
p = EVMIns()
m.register_plugin(p)
print("line42", file=f_out)
symbolic_value = m.make_symbolic_value()
symbolic_data = m.make_symbolic_buffer(320)
symbolic_value = m.make_symbolic_value()
m.transaction(
caller=user_account, address=contract_account, value=symbolic_value, data=symbolic_data
)
#contract_account.f(symbolic_value)
for key,value in p.context["state_trace"]:
print("key--->",key,file=f_out)
print("value->",value,file=f_out)
m.finalize()
Beta Was this translation helpful? Give feedback.
All reactions