diff options
author | dusoleil <howcansocksbereal@gmail.com> | 2022-03-11 11:36:59 -0500 |
---|---|---|
committer | dusoleil <howcansocksbereal@gmail.com> | 2022-03-13 23:27:30 -0400 |
commit | 083ed374269e8a6be53d33eeddb396442205d925 (patch) | |
tree | 02ad06e29fecd7ed70dfb7c912e700a16fb43617 | |
parent | ae2b8e94ec5da005fd28233971a7b31256cdcf61 (diff) | |
download | lib-des-gnux-083ed374269e8a6be53d33eeddb396442205d925.tar.gz lib-des-gnux-083ed374269e8a6be53d33eeddb396442205d925.zip |
sploit: add the rest of r2 functions through elf
expose the rest of the rev.r2 capabilities through rev.elf
Signed-off-by: dusoleil <howcansocksbereal@gmail.com>
-rw-r--r-- | tools/sploit/sploit/rev/elf.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/tools/sploit/sploit/rev/elf.py b/tools/sploit/sploit/rev/elf.py index bdced0a..d9edd40 100644 --- a/tools/sploit/sploit/rev/elf.py +++ b/tools/sploit/sploit/rev/elf.py @@ -16,6 +16,7 @@ class __ELF__: self.sym = r2.get_elf_symbols(self.path) libs = ldd.get_libraries(self.path) self.libs = {lib.name:ELF(lib.path) for lib in libs.values() if lib.path} + self.locals = self.__LOCALS__(self) def __str__(self): s = 'ELF: ' @@ -30,3 +31,22 @@ class __ELF__: for name,lib in self.libs.items(): s += '\n' + str(name) + ' => ' + str(lib.path) return s + + class __LOCALS__: + def __init__(self,elf): + self.elf = elf + def __getattribute__(self, sym): + if(sym=='elf'):return object.__getattribute__(self,sym) + return r2.get_locals(self.elf.path, getattr(self.elf.sym, sym)) + + def retaddr(self, caller, callee): + return [c.ret_addr for c in r2.get_call_returns(self.path, caller, callee)] + + def retgad(self): + return r2.ret_gadget(self.path) + + def gad(self, gad): + return [g.addr for g in r2.rop_gadget(self.path, gad)] + + def egad(self, gad): + return r2.rop_gadget_exact(self.path, gad).addr |