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
commit5cfb73d21b91552074c137d53f2ce86f80acdbac (patch)
tree58dda219d54469ccc8806c7574cb4e6ef999fe56
parent456ba40339d6208748778855278b4fd3b883cb43 (diff)
downloadsploit-5cfb73d21b91552074c137d53f2ce86f80acdbac.tar.gz
sploit-5cfb73d21b91552074c137d53f2ce86f80acdbac.zip
Add mem module for calculating memory offsets
Signed-off-by: dusoleil <howcansocksbereal@gmail.com>
-rw-r--r--sploit/__init__.py2
-rw-r--r--sploit/mem.py15
2 files changed, 16 insertions, 1 deletions
diff --git a/sploit/__init__.py b/sploit/__init__.py
index d9ea6b0..836bb30 100644
--- a/sploit/__init__.py
+++ b/sploit/__init__.py
@@ -1 +1 @@
-__all__ = ["log","comm","until","arch"]
+__all__ = ["log","comm","until","arch","mem"]
diff --git a/sploit/mem.py b/sploit/mem.py
new file mode 100644
index 0000000..6de32f8
--- /dev/null
+++ b/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)
+