Fill in ropchain padding automatically

Co-authored-by: Chris Gora <34940205+ChrisGora@users.noreply.github.com>
Co-authored-by: jack bond-preston <jackbondpreston@outlook.com>
This commit is contained in:
Liam Dalgarno
2020-11-25 18:55:01 +00:00
parent 99cb451194
commit 1bc6bc2cda
10 changed files with 157 additions and 120 deletions

View File

@ -11,10 +11,11 @@ from ropgadget.ropchain.arch.ropmakerx86 import *
from ropgadget.ropchain.arch.ropmakerx64 import *
class ROPMaker(object):
def __init__(self, binary, gadgets, offset):
self.__binary = binary
self.__gadgets = gadgets
self.__offset = offset
def __init__(self, binary, gadgets, paddingLen, offset):
self.__binary = binary
self.__gadgets = gadgets
self.paddingLen = paddingLen
self.__offset = offset
self.__handlerArch()
@ -23,12 +24,12 @@ class ROPMaker(object):
if self.__binary.getArch() == CS_ARCH_X86 \
and self.__binary.getArchMode() == CS_MODE_32 \
and self.__binary.getFormat() == "ELF":
ROPMakerX86(self.__binary, self.__gadgets, self.__offset)
ROPMakerX86(self.__binary, self.__gadgets, self.paddingLen, self.__offset)
elif self.__binary.getArch() == CS_ARCH_X86 \
and self.__binary.getArchMode() == CS_MODE_64 \
and self.__binary.getFormat() == "ELF":
ROPMakerX64(self.__binary, self.__gadgets, self.__offset)
ROPMakerX64(self.__binary, self.__gadgets, self.paddingLen, self.__offset)
else:
print("\n[Error] ROPMaker.__handlerArch - Arch not supported yet for the rop chain generation")