summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordusoleil <howcansocksbereal@gmail.com>2021-09-02 22:37:49 -0400
committerdusoleil <howcansocksbereal@gmail.com>2021-09-02 22:37:49 -0400
commit21f9fe88f4901801d71e12cf170b287d6d7c2c1f (patch)
tree67f75e8e9fabbc0ca5b0300ef8a2519783b1a2b6
parent51cd7258a88b29450735355a666df142a0c29069 (diff)
downloadlib-des-gnux-21f9fe88f4901801d71e12cf170b287d6d7c2c1f.tar.gz
lib-des-gnux-21f9fe88f4901801d71e12cf170b287d6d7c2c1f.zip
Add mem module for calculating memory offsets
Signed-off-by: dusoleil <howcansocksbereal@gmail.com>
-rw-r--r--tools/sploit/sploit/__init__.py2
-rw-r--r--tools/sploit/sploit/mem.py15
2 files changed, 16 insertions, 1 deletions
diff --git a/tools/sploit/sploit/__init__.py b/tools/sploit/sploit/__init__.py
index d9ea6b0..836bb30 100644
--- a/tools/sploit/sploit/__init__.py
+++ b/tools/sploit/sploit/__init__.py
@@ -1 +1 @@
-__all__ = ["log","comm","until","arch"]
+__all__ = ["log","comm","until","arch","mem"]
diff --git a/tools/sploit/sploit/mem.py b/tools/sploit/sploit/mem.py
new file mode 100644
index 0000000..6de32f8
--- /dev/null
+++ b/tools/sploit/sploit/mem.py
@@ -0,0 +1,15 @@
+class Symtbl:
+ def __init__(self, base=0, **kwargs):
+ self.__dict__ = {'base' : base, **kwargs}
+
+ def __getattribute__(self, sym):
+ a = object.__getattribute__(self, sym)
+ if sym in object.__getattribute__(self,'__dict__') and sym != 'base':
+ return self.base + a
+ else:
+ return a
+
+ def addr(self, sym, addr):
+ if sym == 'base' : self.base = addr
+ else: self.base = addr - object.__getattribute__(self, sym)
+