summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordusoleil <howcansocksbereal@gmail.com>2022-03-12 18:39:03 -0500
committerdusoleil <howcansocksbereal@gmail.com>2022-03-12 18:39:03 -0500
commit3fd9022b61d1ccc54e207e1edef69ea48d132edd (patch)
tree298e8cd804edb49884c37cf35e6327226241ed55
parenta8879dba9b1cd0570c096de4786706c2faea6922 (diff)
downloadsploit-3fd9022b61d1ccc54e207e1edef69ea48d132edd.tar.gz
sploit-3fd9022b61d1ccc54e207e1edef69ea48d132edd.zip
sploit: move adjust and rebase into member funcs
Signed-off-by: dusoleil <howcansocksbereal@gmail.com>
-rw-r--r--sploit/mem.py13
1 files changed, 6 insertions, 7 deletions
diff --git a/sploit/mem.py b/sploit/mem.py
index e257c03..0392fa9 100644
--- a/sploit/mem.py
+++ b/sploit/mem.py
@@ -2,6 +2,12 @@ class Symtbl:
def __init__(self, **kwargs):
self.__dict__ = {**kwargs}
+ def adjust(self, off):
+ self.__dict__ = {k:v+off for k,v in self.__dict__.items()}
+
+ def rebase(self, sym):
+ self.adjust(-sym)
+
def __str__(self):
tbl_format = '\n{:<20} {:<20}'
s = 'len: ' + str(len(self.__dict__))
@@ -34,10 +40,3 @@ class Memmap:
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)
-