diff options
author | dusoleil <howcansocksbereal@gmail.com> | 2022-03-12 18:39:53 -0500 |
---|---|---|
committer | dusoleil <howcansocksbereal@gmail.com> | 2022-03-12 18:39:53 -0500 |
commit | d70453b4bf231044e9c58ebc1cf1c550b6e38ac4 (patch) | |
tree | 10ffdf4589b310caa3694a09969674c2128a0696 | |
parent | 3fd9022b61d1ccc54e207e1edef69ea48d132edd (diff) | |
download | sploit-d70453b4bf231044e9c58ebc1cf1c550b6e38ac4.tar.gz sploit-d70453b4bf231044e9c58ebc1cf1c550b6e38ac4.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>
-rw-r--r-- | sploit/mem.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/sploit/mem.py b/sploit/mem.py index 0392fa9..f0b93fd 100644 --- a/sploit/mem.py +++ b/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) |