From 8dcb41a838f80a9c78f5c237045589712047d3c1 Mon Sep 17 00:00:00 2001 From: Roman Hergenreder Date: Thu, 6 Aug 2020 18:38:40 +0200 Subject: [PATCH] setRegisters --- util.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/util.py b/util.py index 54239ab..2f43c57 100644 --- a/util.py +++ b/util.py @@ -70,9 +70,8 @@ class Stack: return addr -def genSyscall(elf, syscall, registers): +def setRegisters(elf, registers): rop = ROP(elf) - registers["rax"] = syscall for t in rop.setRegisters(registers): value = t[0] gadget = t[1] @@ -83,7 +82,11 @@ def genSyscall(elf, syscall, registers): rop.raw(registers[reg]) else: rop.raw(0) + return rop +def genSyscall(elf, syscall, registers): + registers["rax"] = syscall + rop = setRegisters(elf, registers) syscall_gadget = "syscall" if elf.arch == "amd64" else "int 0x80" rop.raw(rop.find_gadget([syscall_gadget]).address) return rop