From 21f9fe88f4901801d71e12cf170b287d6d7c2c1f Mon Sep 17 00:00:00 2001 From: dusoleil Date: Thu, 2 Sep 2021 22:37:49 -0400 Subject: Add mem module for calculating memory offsets Signed-off-by: dusoleil --- tools/sploit/sploit/__init__.py | 2 +- tools/sploit/sploit/mem.py | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 tools/sploit/sploit/mem.py 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) + -- cgit v1.2.3