m = ManticoreEVM() m.verbosity(3) #And now make the contract account to analyze source_code = file('coverage.sol').read() user_account = m.create_account(balance=1000) bytecode = m.compile(source_code) #Initialize contract contract_account = m.create_contract(owner=user_account, balance=0, init=bytecode) m.transaction( caller=user_account, address=contract_account, value=None, data=m.SByte(164), ) #Up to here we get only ~30% coverage. #We need 2 transactions to fully explore the contract m.transaction( caller=user_account, address=contract_account, value=None, data=m.SByte(164), ) print "[+] There are %d reverted states now" % len(m.final_state_ids) print "[+] There are %d alive states now" % len(m.running_state_ids) for state_id in m.running_state_ids:
function() payable { if (msg.data[0] == 'A') { Log("Got an A"); } else{ Log("Got something else"); } } } ''' user_account = m.create_account(balance=1000) print "[+] Creating a user account", user_account contract_account = m.solidity_create_contract(source_code, owner=user_account) print "[+] Creating a contract account", contract_account print "[+] Source code:" print source_code print "[+] Now the symbolic values" symbolic_data = m.make_symbolic_buffer(320) symbolic_value = None m.transaction(caller=user_account, address=contract_account, data=symbolic_data, value=symbolic_value) #Let seth know we are not sending more transactions m.finalize() print "[+] Look for results in %s" % m.workspace