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)
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)
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)
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)
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)