def Chunks(start): """ Get a list of function chunks @param start: address of the function @return: list of funcion chunks (tuples of the form (start_ea, end_ea)) belonging to the function """ func_iter = idaapi.func_tail_iterator_t(idaapi.get_func(start)) status = func_iter.main() while status: chunk = func_iter.chunk() yield (chunk.startEA, chunk.endEA) status = func_iter.next()
def Chunks(start): """ Get a list of function chunks @param start: address of the function @return: list of funcion chunks (tuples of the form (start_ea, end_ea)) belonging to the function """ func_iter = idaapi.func_tail_iterator_t( idaapi.get_func( start ) ) status = func_iter.main() while status: chunk = func_iter.chunk() yield (chunk.startEA, chunk.endEA) status = func_iter.next()
def chunks(key=None): '''enumerates all chunks in a function ''' if key is None: fn = ui.current.function() if fn is None: raise LookupError, "function.chunks(%r):Not currently positioned within a function"% key else: fn = by(key) fci = idaapi.func_tail_iterator_t(fn, fn.startEA) if not fci.main(): raise ValueError, "function.chunks(%r):Unable to create a func_tail_iterator_t"% key while True: ch = fci.chunk() yield ch.startEA, ch.endEA if not fci.next(): break return
def get_function_chunks(funcea): chunks = list() func = idaapi.get_func(funcea) fci = idaapi.func_tail_iterator_t(func, funcea) if fci.main(): ch = fci.chunk() ea_start = ch.startEA ea_end = ch.endEA chunks.append((ea_start, ea_end)) while fci.next(): ch = fci.chunk() chunks.append((ch.startEA, ch.endEA)) else: logger.error("No function chunk found at address 0x%08X" % funcea) return chunks
def is_func_chunked(func_addr): """ Check if a function is divided into chunks. """ logger.debug('is_func_chunked {}'.format(func_addr)) # Idea for this code is from: # http://code.google.com/p/idapython/source/browse/trunk/python/idautils.py?r=344 num_chunks = 0 func_iter = idaapi.func_tail_iterator_t(idaapi.get_func(func_addr)) status = func_iter.main() while status: chunk = func_iter.chunk() num_chunks += 1 # yield (chunk.startEA, chunk.endEA) status = func_iter.next() return (num_chunks > 1)
def _is_func_chunked(func_addr): """ Check if a function is divided into chunks. """ logger.debug('is_func_chunked {}'.format(func_addr)) # Idea for this code is from: # http://code.google.com/p/idapython/source/browse/trunk/python/idautils.py?r=344 num_chunks = 0 func_iter = idaapi.func_tail_iterator_t(idaapi.get_func(func_addr)) status = func_iter.main() while status: chunk = func_iter.chunk() num_chunks += 1 # yield (chunk.startEA, chunk.endEA) status = func_iter.next() return (num_chunks > 1)
def get_chunks(ea): function_chunks = [] #Get the tail iterator func_iter = idaapi.func_tail_iterator_t(idaapi.get_func(ea)) # While the iterator's status is valid status = func_iter.main() while status: # Get the chunk chunk = func_iter.chunk() # Store its start and ending address as a tuple function_chunks.append((chunk.startEA, chunk.endEA)) # Get the last status status = func_iter.next() return function_chunks