Ejemplo n.º 1
0
 def __iter__(self):
     count = ctypes.c_ulonglong()
     lines = core.BNGetFlowGraphNodeLines(self.handle, count)
     block = self.basic_block
     try:
         for i in range(0, count.value):
             addr = lines[i].addr
             if (lines[i].instrIndex != 0xffffffffffffffff) and (
                     block is not None) and hasattr(block, 'il_function'):
                 il_instr = block.il_function[lines[i].instrIndex]
             else:
                 il_instr = None
             tokens = []
             for j in range(0, lines[i].count):
                 token_type = InstructionTextTokenType(
                     lines[i].tokens[j].type)
                 text = lines[i].tokens[j].text
                 value = lines[i].tokens[j].value
                 size = lines[i].tokens[j].size
                 operand = lines[i].tokens[j].operand
                 context = lines[i].tokens[j].context
                 confidence = lines[i].tokens[j].confidence
                 address = lines[i].tokens[j].address
                 tokens.append(
                     function.InstructionTextToken(token_type, text, value,
                                                   size, operand, context,
                                                   address, confidence))
             yield function.DisassemblyTextLine(tokens, addr, il_instr)
     finally:
         core.BNFreeDisassemblyTextLines(lines, count.value)
Ejemplo n.º 2
0
 def lines(self):
     """Flow graph block list of text lines"""
     count = ctypes.c_ulonglong()
     lines = core.BNGetFlowGraphNodeLines(self.handle, count)
     block = self.basic_block
     result = []
     for i in range(0, count.value):
         addr = lines[i].addr
         if (lines[i].instrIndex != 0xffffffffffffffff) and (
                 block is not None) and hasattr(block, 'il_function'):
             il_instr = block.il_function[lines[i].instrIndex]
         else:
             il_instr = None
         color = highlight.HighlightColor._from_core_struct(
             lines[i].highlight)
         tokens = []
         for j in range(0, lines[i].count):
             token_type = InstructionTextTokenType(lines[i].tokens[j].type)
             text = lines[i].tokens[j].text
             value = lines[i].tokens[j].value
             size = lines[i].tokens[j].size
             operand = lines[i].tokens[j].operand
             context = lines[i].tokens[j].context
             confidence = lines[i].tokens[j].confidence
             address = lines[i].tokens[j].address
             tokens.append(
                 function.InstructionTextToken(token_type, text, value,
                                               size, operand, context,
                                               address, confidence))
         result.append(
             function.DisassemblyTextLine(tokens, addr, il_instr, color))
     core.BNFreeDisassemblyTextLines(lines, count.value)
     return result
Ejemplo n.º 3
0
	def __iter__(self):
		count = ctypes.c_ulonglong()
		lines = core.BNGetFlowGraphNodeLines(self.handle, count)
		block = self.basic_block
		try:
			for i in range(0, count.value):
				addr = lines[i].addr
				if (lines[i].instrIndex != 0xffffffffffffffff) and (block is not None) and hasattr(block, 'il_function'):
					il_instr = block.il_function[lines[i].instrIndex]
				else:
					il_instr = None
				tokens = function.InstructionTextToken.get_instruction_lines(lines[i].tokens, lines[i].count)
				yield function.DisassemblyTextLine(tokens, addr, il_instr)
		finally:
			core.BNFreeDisassemblyTextLines(lines, count.value)
Ejemplo n.º 4
0
	def lines(self):
		"""Flow graph block list of text lines"""
		count = ctypes.c_ulonglong()
		lines = core.BNGetFlowGraphNodeLines(self.handle, count)
		block = self.basic_block
		result = []
		for i in range(0, count.value):
			addr = lines[i].addr
			if (lines[i].instrIndex != 0xffffffffffffffff) and (block is not None) and hasattr(block, 'il_function'):
				il_instr = block.il_function[lines[i].instrIndex]
			else:
				il_instr = None
			color = highlight.HighlightColor._from_core_struct(lines[i].highlight)
			tokens = function.InstructionTextToken.get_instruction_lines(lines[i].tokens, lines[i].count)
			result.append(function.DisassemblyTextLine(tokens, addr, il_instr, color))
		core.BNFreeDisassemblyTextLines(lines, count.value)
		return result