How to use the manticore.ethereum.ABI function in manticore

To help you get started, we’ve selected a few manticore examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github trailofbits / manticore-examples / polyswarm_challenge / solution.py View on Github external
address=0x2E4D2A597A2FCBDF6CC55EB5C973E76AA19AC410,
)

# Allow cashmoney_contract to call logWinner() on winnerlog_contract
m.transaction(
    caller=owner_account,
    address=winnerlog_contract,
    data=binascii.unhexlify(
        b"c3e8512400000000000000000000000064ba926175bc69ba757ef53a6d5ef616889c9999"
    ),
    value=0,
)

# Prepare symbolic buffer and call logWinner() with that symbolic buffer
symbolic_data = m.make_symbolic_buffer(64)
calldata = ABI.function_call("logWinner(address,uint256,bytes)", attacker_account, 0, symbolic_data)
m.transaction(
    caller=cashmoney_contract, address=winnerlog_contract, data=calldata, value=0, gas=10000000
)

# Look for a running state that is not reverted
for state in m.running_states:
    world = state.platform
    result = state.solve_one(symbolic_data)
    print("[+] FOUND: {}".format(binascii.hexlify(result)))
    break