Python idc 模块,FUNCATTR_END 实例源码

我们从Python开源项目中,提取了以下6个代码示例,用于说明如何使用idc.FUNCATTR_END

项目:WinHeap-Explorer    作者:WinHeapExplorer    | 项目源码 | 文件源码
def enumerate_function_chunks(f_start):
    """
    The function gets a list of chunks for the function.
    @f_start - first address of the function
    @return - list of chunks
    """
    # Enumerate all chunks in the function
    chunks = list()
    first_chunk = idc.FirstFuncFchunk(f_start)
    chunks.append((first_chunk, idc.GetFchunkAttr(first_chunk, idc.FUNCATTR_END)))
    next_chunk = first_chunk
    while next_chunk != 0xffffffffL:
        next_chunk = idc.NextFuncFchunk(f_start, next_chunk)
        if next_chunk != 0xffffffffL:
            chunks.append((next_chunk, idc.GetFchunkAttr(next_chunk, idc.FUNCATTR_END)))
    return chunks
项目:WinHeap-Explorer    作者:WinHeapExplorer    | 项目源码 | 文件源码
def enumerate_function_chunks(f_start):
    '''
    The function gets a list of chunks for the function.
    @f_start - first address of the function
    @return - list of chunks
    '''
    # Enumerate all chunks in the function
    chunks = list()
    first_chunk = idc.FirstFuncFchunk(f_start)
    chunks.append((first_chunk, idc.GetFchunkAttr(first_chunk, idc.FUNCATTR_END)))
    next_chunk = first_chunk
    while next_chunk != 0xffffffffL:
        next_chunk = idc.NextFuncFchunk(f_start, next_chunk)
        if next_chunk != 0xffffffffL:
            chunks.append((next_chunk, idc.GetFchunkAttr(next_chunk, idc.FUNCATTR_END)))
    return chunks
项目:functions-plus    作者:ax330d    | 项目源码 | 文件源码
def __init__(self):
        self.addr = None
        self.flags = None
        self.names = [
            'Function name', 'Address', 'Segment', 'Length', 'Locals',
            'Arguments', 'R', 'F', 'L', 'S', 'B', 'T', '='
        ]
        self.handlers = {
            0: lambda: None,
            1: lambda: self.ptr().format(self.addr),
            2: lambda: '{}'.format(idc.SegName(self.addr)),
            3: lambda: self.halfptr().format(idc.GetFunctionAttr(
                self.addr, idc.FUNCATTR_END) - self.addr),
            4: lambda: self.set_if_true(idc.GetFunctionAttr(
                self.addr, idc.FUNCATTR_FRSIZE)),
            5: lambda: self.set_if_true(idc.GetFunctionAttr(
                self.addr, idc.FUNCATTR_ARGSIZE)),
            6: lambda: self.is_true(not self.flags & idc.FUNC_NORET, 'R'),
            7: lambda: self.is_true(self.flags & idc.FUNC_FAR, 'F'),
            8: lambda: self.is_true(self.flags & idc.FUNC_LIB, 'L'),
            9: lambda: self.is_true(self.flags & idc.FUNC_STATIC, 'S'),
            10: lambda: self.is_true(self.flags & idc.FUNC_FRAME, 'B'),
            11: lambda: self.is_true(idc.GetType(self.addr), 'T'),
            12: lambda: self.is_true(self.flags & idc.FUNC_BOTTOMBP, '=')
        }
项目:bap-ida-python    作者:BinaryAnalysisPlatform    | 项目源码 | 文件源码
def output_symbols(out):
    """Dump symbols."""
    try:
        from idaapi import get_func_name2 as get_func_name
        # Since get_func_name is deprecated (at least from IDA 6.9)
    except ImportError:
        from idaapi import get_func_name
        # Older versions of IDA don't have get_func_name2
        # so we just use the older name get_func_name

    def func_name_propagate_thunk(ea):
        current_name = get_func_name(ea)
        if current_name[0].isalpha():
            return current_name
        func = idaapi.get_func(ea)
        temp_ptr = idaapi.ea_pointer()
        ea_new = idaapi.BADADDR
        if func.flags & idaapi.FUNC_THUNK == idaapi.FUNC_THUNK:
            ea_new = idaapi.calc_thunk_func_target(func, temp_ptr.cast())
        if ea_new != idaapi.BADADDR:
            ea = ea_new
        propagated_name = get_func_name(ea) or ''  # Ensure it is not `None`
        if len(current_name) > len(propagated_name) > 0:
            return propagated_name
        else:
            return current_name
            # Fallback to non-propagated name for weird times that IDA gives
            #     a 0 length name, or finds a longer import name

    for ea in idautils.Segments():
        fs = idautils.Functions(idc.SegStart(ea), idc.SegEnd(ea))
        for f in fs:
            out.write('("%s" 0x%x 0x%x)\n' % (
                func_name_propagate_thunk(f),
                idc.GetFunctionAttr(f, idc.FUNCATTR_START),
                idc.GetFunctionAttr(f, idc.FUNCATTR_END)))
项目:idascripts    作者:ctfhacker    | 项目源码 | 文件源码
def getMinorDispatchTableAddress(ea):
    """find address of last lea in function"""
    start = idc.GetFunctionAttr(ea, idc.FUNCATTR_START)
    end = idc.PrevHead( idc.GetFunctionAttr(ea, idc.FUNCATTR_END), start)
    res = prevMnemonic(end, 'lea', start)
    assert res != idc.BADADDR
    return idc.GetOperandValue(res, 1)
项目:idascripts    作者:ctfhacker    | 项目源码 | 文件源码
def getMajorDispatchTableAddress():
    """find quicktime major dispatch table"""
    res = idc.LocByName('theQuickTimeDispatcher')
    res = nextMnemonic(res, 'lea', idc.GetFunctionAttr(res, idc.FUNCATTR_END))
    assert res != idc.BADADDR
    return idc.GetOperandValue(res, 1)