summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordusoleil <howcansocksbereal@gmail.com>2022-03-10 19:52:50 -0500
committerdusoleil <howcansocksbereal@gmail.com>2022-03-10 19:52:50 -0500
commita1a1c6151dc23a32d9f19da8cd721ed82495b86e (patch)
tree75cc867e9c0111e7b75fd0826693f6609652c42d
parent5c104e5f9b66614d0e8bf9fc3339f0e97faf627a (diff)
downloadlib-des-gnux-a1a1c6151dc23a32d9f19da8cd721ed82495b86e.tar.gz
lib-des-gnux-a1a1c6151dc23a32d9f19da8cd721ed82495b86e.zip
Add adjust and rebase functions to mem module
Add the ability to shift all Symtbl offsets by a fixed amount with adjust(). Add the ability to shift all Symtbl offsets so that a designated symbol is now at offset 0 and all other symbols maintain their relative offsets to that symbol with rebase(). Signed-off-by: dusoleil <howcansocksbereal@gmail.com>
-rw-r--r--tools/sploit/sploit/mem.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/tools/sploit/sploit/mem.py b/tools/sploit/sploit/mem.py
index 58c3d3d..e257c03 100644
--- a/tools/sploit/sploit/mem.py
+++ b/tools/sploit/sploit/mem.py
@@ -33,3 +33,11 @@ class Memmap:
for sym,addr in sorted(self.__tbl__.__dict__.items(),key=lambda x:x[1]):
s += tbl_format.format(hex(addr+self.base),sym)
return s
+
+def adjust(tbl, off):
+ tbl.__dict__ = {k:v+off for k,v in tbl.__dict__.items()}
+
+def rebase(tbl, sym):
+ off = -getattr(tbl, sym)
+ adjust(tbl, off)
+