summaryrefslogtreecommitdiffstats
path: root/sploit/mem.py
blob: 6de32f8a54b87d564c20657edb506edf47e6bf94 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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)