コード例 #1
0
def analyze(processed_evm_file, disasm_file, source_map=None):
    '''Runs the symbolic execution.

        Parameters
    ----------
    processed_evm_file : File descriptor of EVM bytecode file on which "removeSwarmHash" has been removed  TODO: Why not remove this argument and process disasm_file as necessary within analyze()? This way, the function makes implicit assumptions about the relation between those two arguments.
    disasm_file: File descriptor of the original EVM asm file
    source_map: SourceMap of compiled contracts
    '''
    disasm_out = ""

    # Check if processed_evm_file can be disassembled
    # TODO: Why this check? The result is not used anyway and it is not said that processed_evm_file is related to disasm_file.
    try:
        disasm_p = subprocess.Popen(["evm", "disasm", processed_evm_file],
                                    stdout=subprocess.PIPE)
        disasm_out = disasm_p.communicate()[0]
    except:
        logging.critical("Disassembly failed.")
        exit()

    with open(disasm_file, 'w') as of:
        of.write(disasm_out)

    # Run symExec
    if source_map is not None:
        symExec.main(disasm_file, args.source, source_map)
    else:
        symExec.main(disasm_file, args.source)
コード例 #2
0
def analyze(processed_evm_file, disasm_file):
    disasm_out = ""
    try:
        disasm_p = subprocess.Popen(["evm", "disasm", processed_evm_file],
                                    stdout=subprocess.PIPE)
        disasm_out = disasm_p.communicate()[0]
    except:
        logging.critical("Disassembly failed.")
        exit()

    with open(disasm_file, 'w') as of:
        of.write(disasm_out)

    # Run symExec
    symExec.main(disasm_file)
コード例 #3
0
def analyze(processed_evm_file, disasm_file, source_map = None):
    disasm_out = ""

    try:
        disasm_p = subprocess.Popen(
            ["evm", "disasm", processed_evm_file], stdout=subprocess.PIPE)
        disasm_out = disasm_p.communicate()[0]
    except:
        logging.critical("Disassembly failed.")
        exit()

    with open(disasm_file, 'w') as of:
        of.write(disasm_out)

    if source_map is not None:
        symExec.main(disasm_file, args.source, source_map)
    else:
        symExec.main(disasm_file, args.source)
コード例 #4
0
def analyze(processed_evm_file, disasm_file, is_bytecode):
    disasm_out = ""
    try:
        disasm_p = subprocess.Popen(["evm", "disasm", processed_evm_file],
                                    stdout=subprocess.PIPE)
        disasm_out = disasm_p.communicate()[0]
    except:
        logging.critical("Disassembly failed.")
        exit()

    with open(disasm_file, 'w') as of:
        of.write(disasm_out)

    # Run symExec
    if is_bytecode:
        symExec.main(disasm_file, args.source)
    else:
        symExec.main(disasm_file, args.source, SourceMapping)
コード例 #5
0
ファイル: oyente.py プロジェクト: travs/oyente
def run_source_code_analysis(contract, source_map):
    tmp_files = get_temporary_files(contract)
    return symExec.main(tmp_files["disasm"], args.source, source_map)
コード例 #6
0
ファイル: oyente.py プロジェクト: travs/oyente
def run_bytecode_analysis(contract):
    tmp_files = get_temporary_files(contract)
    return symExec.main(tmp_files["disasm"], contract)
コード例 #7
0
ファイル: oyente_orig.py プロジェクト: njaliu/ethereum-clone
def analyze_source_code(disasm_file, source_map):
    return symExec.main(disasm_file, args.source, source_map)