summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authordusoleil <howcansocksbereal@gmail.com>2022-03-12 18:39:53 -0500
committerdusoleil <howcansocksbereal@gmail.com>2022-03-12 18:39:53 -0500
commitb8b16e8e94e555c3a735079cbe1ba92813c85685 (patch)
tree795da24ad8e65a15a71a960645bda621fb8b1a5f /tools
parentf0147dda4339b8d67af03a682acbaba607cc0b30 (diff)
downloadlib-des-gnux-b8b16e8e94e555c3a735079cbe1ba92813c85685.tar.gz
lib-des-gnux-b8b16e8e94e555c3a735079cbe1ba92813c85685.zip
sploit: add len func to mem
len() will calculate the length of the symtbl in bytes rather than the number of symbols Signed-off-by: dusoleil <howcansocksbereal@gmail.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/sploit/sploit/mem.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/tools/sploit/sploit/mem.py b/tools/sploit/sploit/mem.py
index 0392fa9..f0b93fd 100644
--- a/tools/sploit/sploit/mem.py
+++ b/tools/sploit/sploit/mem.py
@@ -8,6 +8,14 @@ class Symtbl:
def rebase(self, sym):
self.adjust(-sym)
+ def __len__(self):
+ vals = self.__dict__.values()
+ if len(vals)<1:
+ return 0
+ hi = max(max(vals),0)
+ lo = min(min(vals),0)
+ return hi-lo
+
def __str__(self):
tbl_format = '\n{:<20} {:<20}'
s = 'len: ' + str(len(self.__dict__))
@@ -31,6 +39,9 @@ class Memmap:
def __setattr__(self, k, v):
raise TypeError('Memmaps are Read-Only! Modify offsets with Symtbl instead!')
+ def __len__(self):
+ return len(self.__tbl__)
+
def __str__(self):
tbl_format = '\n{:<20} {:<20}'
s = 'len: ' + str(len(self.__tbl__.__dict__)+1)