Ejemplo n.º 1
0
    def __init__(self, path, garbage = 0xdeadbeef):
        if isinstance(path, pwn.ELF):
            self.elf = path
        else:
            self.elf = pwn.elf.load(path)

        self.garbage = pwn.tuplify(garbage)

        # bring segments, sections, symbols, plt and got to this object
        self.segments = self.elf.segments
        self.sections = dict()
        for k, v in self.elf.sections.items():
            self.sections[k] = v['addr']
        self.symbols = dict()
        for k, v in self.elf.symbols.items():
            self.symbols[k] = v['addr']
        self.plt = self.elf.plt
        self.got = self.elf.got

        self._chain = []
        self._gadgets = {}
        self._gadget_cache = {}
        self._load_addr = None
        self._next_load_addr = None
        self._load_gadgets()
Ejemplo n.º 2
0
    def __init__(self, path, garbage=0xdeadbeef):
        if isinstance(path, pwn.ELF):
            self.elf = path
        else:
            self.elf = pwn.elf.load(path)

        self.garbage = pwn.tuplify(garbage)

        # bring segments, sections, symbols, plt and got to this object
        self.segments = self.elf.segments
        self.sections = dict()
        for k, v in self.elf.sections.items():
            self.sections[k] = v['addr']
        self.symbols = dict()
        for k, v in self.elf.symbols.items():
            self.symbols[k] = v['addr']
        self.plt = self.elf.plt
        self.got = self.elf.got

        self._chain = []
        self._gadgets = {}
        self._gadget_cache = {}
        self._load_addr = None
        self._next_load_addr = None
        self._load_gadgets()
Ejemplo n.º 3
0
    def __init__(self, file, garbage = 0xdeadbeef):
        global _currently_loaded
        if isinstance(file, ELF):
            self.elf = file
        else:
            self.elf = ELF(file)

        self.garbage = tuplify(garbage)

        # bring addresses of sections, symbols, plt and got to this object
        self.sections = dict()
        for k, v in self.elf.sections.items():
            self.sections[k] = v['addr']
        self.symbols = dict()
        for k, v in self.elf.symbols.items():
            self.symbols[k] = v['addr']
        self.plt = self.elf.plt
        self.got = self.elf.got

        # promote to top-level
        g = globals()
        g['sections'] = self.sections
        g['symbols'] = self.symbols
        g['plt'] = self.plt
        g['got'] = self.got

        self._chain = []
        self._gadgets = {}
        self._load_gadgets()

        _currently_loaded = self
Ejemplo n.º 4
0
 def call(self, target, args = (), pivot = None):
     '''Irrelevant arguments should be marked by a None'''
     target_addr = self._resolve(target)
     if not target_addr:
         pwn.die('symbol {} not found'.format(target))
     self._chain.append(('call', (target_addr, pivot, pwn.tuplify(args))))
     return self
Ejemplo n.º 5
0
    def __init__(self, file, garbage=0xdeadbeef):
        global _currently_loaded
        if isinstance(file, ELF):
            self.elf = file
        else:
            self.elf = ELF(file)

        self.garbage = tuplify(garbage)

        # bring addresses of sections, symbols, plt and got to this object
        self.sections = dict()
        for k, v in self.elf.sections.items():
            self.sections[k] = v['addr']
        self.symbols = dict()
        for k, v in self.elf.symbols.items():
            self.symbols[k] = v['addr']
        self.plt = self.elf.plt
        self.got = self.elf.got

        # promote to top-level
        g = globals()
        g['sections'] = self.sections
        g['symbols'] = self.symbols
        g['plt'] = self.plt
        g['got'] = self.got

        self._chain = []
        self._gadgets = {}
        self._load_gadgets()

        _currently_loaded = self
Ejemplo n.º 6
0
 def call(self, target, args = (), pivot = None):
     '''Irrelevant arguments should be marked by a None'''
     target = self._resolve(target)
     self._chain.append(('call', (target, pivot, pwn.tuplify(args))))
     return self
Ejemplo n.º 7
0
 def call(self, target, args=(), pivot=None):
     '''Irrelevant arguments should be marked by a None'''
     target = self._resolve(target)
     self._chain.append(('call', (target, pivot, pwn.tuplify(args))))
     return self