summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordusoleil <howcansocksbereal@gmail.com>2022-03-10 19:37:36 -0500
committerdusoleil <howcansocksbereal@gmail.com>2022-03-10 19:37:36 -0500
commitbf2161bc5f60bdd8c086685250ec1e6796e4daea (patch)
tree4508db2b3e6bdea7d80069154ea7752947097cb9
parentb55d899d328c21cb0bb5994463340c8b64bf4a9f (diff)
downloadsploit-bf2161bc5f60bdd8c086685250ec1e6796e4daea.tar.gz
sploit-bf2161bc5f60bdd8c086685250ec1e6796e4daea.zip
sploit: Add string cast for Symtbl and Memmap
Add string cast to mem module types so that they can be printed out in a human readable format. Signed-off-by: dusoleil <howcansocksbereal@gmail.com>
-rw-r--r--sploit/mem.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/sploit/mem.py b/sploit/mem.py
index 1149e99..58c3d3d 100644
--- a/sploit/mem.py
+++ b/sploit/mem.py
@@ -2,6 +2,13 @@ class Symtbl:
def __init__(self, **kwargs):
self.__dict__ = {**kwargs}
+ def __str__(self):
+ tbl_format = '\n{:<20} {:<20}'
+ s = 'len: ' + str(len(self.__dict__))
+ s += tbl_format.format('ADDRESS', 'SYMBOL')
+ for sym,addr in sorted(self.__dict__.items(),key=lambda x:x[1]):
+ s += tbl_format.format(hex(addr),sym)
+ return s
class Memmap:
def __init__(self, tbl, sym, addr):
@@ -17,3 +24,12 @@ class Memmap:
def __setattr__(self, k, v):
raise TypeError('Memmaps are Read-Only! Modify offsets with Symtbl instead!')
+
+ def __str__(self):
+ tbl_format = '\n{:<20} {:<20}'
+ s = 'len: ' + str(len(self.__tbl__.__dict__)+1)
+ s += tbl_format.format('ADDRESS', 'SYMBOL')
+ s += tbl_format.format(hex(self.base),'base')
+ 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