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
commita8879dba9b1cd0570c096de4786706c2faea6922 (patch)
tree546367c96347d3d2a258dac73dfd9f55976ae07b
parentbf2161bc5f60bdd8c086685250ec1e6796e4daea (diff)
downloadsploit-a8879dba9b1cd0570c096de4786706c2faea6922.tar.gz
sploit-a8879dba9b1cd0570c096de4786706c2faea6922.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--sploit/mem.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/sploit/mem.py b/sploit/mem.py
index 58c3d3d..e257c03 100644
--- a/sploit/mem.py
+++ b/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)
+