def extract_function_loop(f): edges = [] # construct control flow graph for b in f.blocks: for c in b.calls: edges.append((b.addr_start, c)) if loops.has_loop(edges): yield Characteristic("loop"), f.addr_start
def extract_function_loop(f): """ parse if a function has a loop """ edges = [] for bb_from, bb_tos in f.blockrefs.items(): for bb_to in bb_tos: edges.append((bb_from, bb_to)) if edges and loops.has_loop(edges): yield Characteristic("loop"), f.offset
def extract_function_loop(f): """ parse if a function has a loop """ edges = [] for bb in f.basic_blocks: if len(bb.instructions) > 0: for bva, bflags in bb.instructions[-1].getBranches(): if bflags & vivisect.envi.BR_COND or bflags & vivisect.envi.BR_FALL or bflags & vivisect.envi.BR_TABLE: edges.append((bb.va, bva)) if edges and loops.has_loop(edges): yield Characteristic("loop"), f.va
def extract_function_loop(f): """ extract loop indicators from a function args: f (IDA func_t) """ edges = [] # construct control flow graph for bb in idaapi.FlowChart(f): for succ in bb.succs(): edges.append((bb.start_ea, succ.start_ea)) if loops.has_loop(edges): yield Characteristic("loop"), f.start_ea
def extract_function_loop(f): """ parse if a function has a loop """ edges = [] for bb in f.basic_blocks: if len(bb.instructions) > 0: for bva, bflags in bb.instructions[-1].getBranches(): # vivisect does not set branch flags for non-conditional jmp so add explicit check if (bflags & envi.BR_COND or bflags & envi.BR_FALL or bflags & envi.BR_TABLE or bb.instructions[-1].mnem == "jmp"): edges.append((bb.va, bva)) if edges and loops.has_loop(edges): yield Characteristic("loop"), f.va