diff options
author | dusoleil <howcansocksbereal@gmail.com> | 2022-03-12 18:39:03 -0500 |
---|---|---|
committer | dusoleil <howcansocksbereal@gmail.com> | 2022-03-12 18:39:03 -0500 |
commit | 3fd9022b61d1ccc54e207e1edef69ea48d132edd (patch) | |
tree | 298e8cd804edb49884c37cf35e6327226241ed55 | |
parent | a8879dba9b1cd0570c096de4786706c2faea6922 (diff) | |
download | sploit-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.py | 13 |
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) - |