Ejemplo n.º 1
0
    def _searchOpcode(self, opcode):
        r = Ropper(self._binaries[0])
        gadgets = []
        for section in self._binaries[0].executableSections:
            vaddr = section.virtualAddress
            gadgets.extend(r.searchOpcode(section.bytes, opcode.decode("hex"), section.offset, True, section=section))

        if len(gadgets) > 0:
            return gadgets[0]
        else:
            raise RopChainError("Cannot create gadget for opcode: %x" % opcode)
Ejemplo n.º 2
0
    def _createOpcode(self, opcode):
        r = Ropper(self._binary.arch)
        gadgets = []
        for section in self._binary.executableSections:
            vaddr = section.virtualAddress
            gadgets.extend(
                r.searchOpcode(section.bytes, opcode.decode('hex'), section.offset, True))

        if len(gadgets) > 0:
            return self._printRopInstruction(gadgets[0])
        else:
            raise RopChainError('Cannot create gadget for opcode: %x' % opcode)
Ejemplo n.º 3
0
    def _searchOpcode(self, opcode):
        r = Ropper(self._binaries[0])
        gadgets = []
        for section in self._binaries[0].executableSections:
            vaddr = section.virtualAddress
            gadgets.extend(
                r.searchOpcode(section.bytes, opcode.decode('hex'), section.offset, True, section=section))

        if len(gadgets) > 0:
            return gadgets[0]
        else:
            raise RopChainError('Cannot create gadget for opcode: %x' % opcode)
Ejemplo n.º 4
0
    def __searchOpcode(self, opcode):
        r = Ropper(self.__binary.arch)
        gadgets = {}
        for section in self.__binary.executableSections:
            gadgets[section]=(
                r.searchOpcode(section.bytes, unhexlify(opcode.encode('ascii')), 0x0, badbytes=unhexlify(self.__options.badbytes)))

        self.__printer.printTableHeader('Opcode')
        counter = 0
        for section, gadget in gadgets.items():
            for g in gadget:
                vaddr = self.__options.I + section.offset if self.__options.I != None else section.virtualAddress
                g.imageBase = vaddr
                print(g.simpleString())
                counter += 1
        print('')
        print('%d times opcode found' % counter)
Ejemplo n.º 5
0
    def __searchOpcode(self, opcode):
        r = Ropper(self.__binary.arch)
        gadgets = {}
        for section in self.__binary.executableSections:
            gadgets[section] = (r.searchOpcode(
                section.bytes,
                unhexlify(opcode.encode('ascii')),
                0x0,
                badbytes=unhexlify(self.__options.badbytes)))

        self.__printer.printTableHeader('Opcode')
        counter = 0
        for section, gadget in gadgets.items():
            for g in gadget:
                vaddr = self.__options.I + section.offset if self.__options.I != None else section.virtualAddress
                g.imageBase = vaddr
                print(g.simpleString())
                counter += 1
        print('')
        print('%d times opcode found' % counter)