zelos.api.regs_api module

class zelos.api.regs_api.RegsApi(zelos)

Bases: object

Allows accessing registers directly by their name.

Methods also exist for accessing registers that hold the instruction, stack, and frame pointers in a platform agnostic way, as well as functions for manipulating the stack.

from zelos import Zelos, HookType

# 32 bit x86 binary
z = Zelos("binary_to_emulate")

# Increment the starting address by 2
z.regs.eip = z.regs.eip + 2

# A platform agnostic way of adjusting the Instruction Pointer
z.regs.setIP(z.regs.getIP() + 2)
getIP() → int
setIP(new_ip: int) → None
getSP() → int
setSP(new_sp: int) → None
getFP() → int
setFP(new_fp: int) → None
getstack(offset: int) → int

Returns data that is offset * word_size bytes from the top of the stack.

setstack(offset: int, val: int) → None

Sets data that is offset * word_size bytes from the top of the stack.

popstack() → int
pushstack(data: int) → None