๐ŸทReverse Engineering Bytecode

Ethereum Bytecode Reverse engineering

Below code can be used to get the hex encoding in a proper format

from web3 import Web3

INFURA = 'https://mainnet.infura.io/v3/<API KEY>'

# Connect to Blockchain

web3 = Web3(Web3.HTTPProvider(INFURA))
print(f'Connected: {web3.is_connected()}')


# Connect to contract

target_address = web3.to_checksum_address("0x514910771AF9Ca656af840dff83E8264EcF986CA")

print(web3.from_wei(web3.eth.get_balance(target_address), 'ether'))

print(web3.to_hex(web3.eth.get_code(target_address)))

Automated Disassembly

Python EVM Bytecode Function Bruteforce Application

Python EVM Bytecode Function Reversing from Assembly

This code is slightly more enhanced version from the previous reversing code. Here, we are first getting the assembly function signatures from the bytecode and then matching those function signatures against our database. It takes less amount of time to complete the process of bruteforcing since we are not matching every signatures in our database with the bytecode signatures.

REFRENCES

Last updated

Was this helpful?