How to use the reil.x86.translator.translate function in reil

To help you get started, we’ve selected a few reil examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github enjhnsn2 / reilex / loader.py View on Github external
def lift(self):
		"""
		Lifts executable code to REIL
		Output: generator of REIL instructions
		"""
		with open(self.filename,"r") as f:
			f.seek(self.text_start)
			content = f.read(self.text_size)
			if self.get_class() == 1:
				return lift.translate(content,0)
			else:
				return lift.translate(content,0,x86_64 = True)
github c01db33f / concolica / emulator.py View on Github external
def fetch_instruction(s, x86_64=False):
    ip = s.ip
    s.trace.append(ip)

    if ip not in _translation_cache:
        bs = []

        for i in range(0, 128):
            try:
                bs.append(s.memory.read_byte(s, ip + i))
            except IndexError():
                break

        bs = ''.join(map(lambda x: chr(x.value), bs))
        for i in x86.translate(bs, ip, x86_64):
            _translation_cache[i.address] = i

    if ip not in _translation_cache:
        raise InvalidExecution(s, ip)

    i = _translation_cache[ip]
    s.ip += i.size

    if x86_64:
        s.registers['rip'] = bv.Constant(64, s.ip)

    return i
github enjhnsn2 / reilex / loader.py View on Github external
def lift(self):
		"""
		Lifts executable code to REIL
		Output: generator of REIL instructions
		"""
		with open(self.filename,"r") as f:
			f.seek(self.text_start)
			content = f.read(self.text_size)
			if self.get_class() == 1:
				return lift.translate(content,0)
			else:
				return lift.translate(content,0,x86_64 = True)