How to use the ropgadget.binary.Binary function in ROPGadget

To help you get started, we’ve selected a few ROPGadget examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github JonathanSalwan / ROPgadget / ropgadget / core.py View on Github external
try:
            self.__offset = int(self.__options.offset, 16) if self.__options.offset else 0
        except ValueError:
            print("[Error] The offset must be in hexadecimal")
            return False

        if self.__options.console:
            if self.__options.binary:
                self.__binary = Binary(self.__options)
                if self.__checksBeforeManipulations() == False:
                    return False
            self.cmdloop()
            return True

        self.__binary = Binary(self.__options)
        if self.__checksBeforeManipulations() == False:
            return False

        if   self.__options.string:   return self.__lookingForAString(self.__options.string)
        elif self.__options.opcode:   return self.__lookingForOpcodes(self.__options.opcode)
        elif self.__options.memstr:   return self.__lookingForMemStr(self.__options.memstr)
        else:
            self.__getGadgets()
            self.__lookingForGadgets()
            if self.__options.ropchain:
                ROPMaker(self.__binary, self.__gadgets, self.__offset)
            return True
github JonathanSalwan / ROPgadget / ropgadget / core.py View on Github external
def analyze(self):

        try:
            self.__offset = int(self.__options.offset, 16) if self.__options.offset else 0
        except ValueError:
            print("[Error] The offset must be in hexadecimal")
            return False

        if self.__options.console:
            if self.__options.binary:
                self.__binary = Binary(self.__options)
                if self.__checksBeforeManipulations() == False:
                    return False
            self.cmdloop()
            return True

        self.__binary = Binary(self.__options)
        if self.__checksBeforeManipulations() == False:
            return False

        if   self.__options.string:   return self.__lookingForAString(self.__options.string)
        elif self.__options.opcode:   return self.__lookingForOpcodes(self.__options.opcode)
        elif self.__options.memstr:   return self.__lookingForMemStr(self.__options.memstr)
        else:
            self.__getGadgets()
            self.__lookingForGadgets()
            if self.__options.ropchain:
github ww9210 / Linux_kernel_exploits / fuze / kernelrop / __init__.py View on Github external
self.c._Core__binary = Binary(self.c._Core__options)

            if self.c._Core__checksBeforeManipulations() == False:
                return False

            print '[+] loading rop core from disk'
            with open('rop_core.cache','rb') as f:
                self.c._Core__gadgets = pickle.load(f)
        else:
            try:
                self.c._Core__offset = int(self.c._Core__options.offset, 16) if self.c._Core__options.offset else 0
            except ValueError:
                print("[Error] The offset must be in hexadecimal")
                return Fa

            self.c._Core__binary = Binary(self.c._Core__options)

            if self.c._Core__checksBeforeManipulations() == False:
                return False
            else:
                print 'getting all gadgets'
                self.c._Core__getAllgadgets()
                print '[+] dumping rop core to disk'
                with open('rop_core.cache','wb') as f:
                    for agadget in self.c.gadgets():
                        agadget['decodes'] = None
                    pickle.dump(self.c.gadgets(), f, -1)
github JonathanSalwan / ROPgadget / ropgadget / core.py View on Github external
def do_binary(self, s, silent=False):
        # Do not split the filename with spaces since it might contain
        # whitespaces
        if len(s) == 0:
            if not silent:
                return self.help_binary()
            return False

        binary = s

        self.__options.binary = binary
        self.__binary = Binary(self.__options)
        if self.__checksBeforeManipulations() == False:
            return False

        if not silent:
            print("[+] Binary loaded")