summaryrefslogtreecommitdiffstats
path: root/tools
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
commit5c104e5f9b66614d0e8bf9fc3339f0e97faf627a (patch)
treefa69396c3de6841696056d607af44eb801207d9b /tools
parent2624c2961ec043c6a2b08f7923602a784e392c10 (diff)
downloadlib-des-gnux-5c104e5f9b66614d0e8bf9fc3339f0e97faf627a.tar.gz
lib-des-gnux-5c104e5f9b66614d0e8bf9fc3339f0e97faf627a.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>
Diffstat (limited to 'tools')
-rw-r--r--tools/sploit/sploit/mem.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/tools/sploit/sploit/mem.py b/tools/sploit/sploit/mem.py
index 1149e99..58c3d3d 100644
--- a/tools/sploit/sploit/mem.py
+++ b/tools/sploit/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