Beispiel #1
0
    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:
                ROPMaker(self.__binary, self.__gadgets, self.__offset)
            return True
Beispiel #2
0
    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()
            if (self.__options.microgadgets):
                self.__checkingForClasses()
        #    print self.__options
            else:
                self.__lookingForGadgets()
            if self.__options.ropchain:
                ROPMaker(self.__binary, self.__gadgets, self.__offset)
            elif self.__options.fns:
                arch = self.__binary.getArchMode()
                if arch != CS_MODE_32:
                    self.functions().show()
                else:
                    print("Not implemented on 32 bit yet.")
            elif self.__options.fns2map:
                arch = self.__binary.getArchMode()
                if arch != CS_MODE_32:
                    self.functions().map()
                else:
                    print("Not implemented on 32 bit yet.")
            elif self.__options.fns2list:
                arch = self.__binary.getArchMode()
                if arch != CS_MODE_32:
                    self.functions().list()
                else:
                    print("Not implemented on 32 bit yet.")
            elif self.__options.fns2lines:
                arch = self.__binary.getArchMode()
                if arch != CS_MODE_32:
                    self.functions().lines()
                else:
                    print("Not implemented on 32 bit yet.")
            return True