示例#1
0
    def Accurate(self):
        """
        Counter that will try to determine the password accurately by
        bruteforcing every char with the complete charset
        """

        if self.length < 0:
            warning("no length specified - guessing")
            self.length = self.get_pass_length()
            if self.length < 0:
                return None

        begin_with = ''
        for i in range(0, self.length):

            # The character is one of the known ones
            if self.fixed_chars[i] != '`':
                begin_with = begin_with + self.fixed_chars[i]
                success("char fixed:   {0} -> {1}".format(
                    self.fixed_chars[i], begin_with))
                continue

            bf = Bruteforce(self.charset,
                            final_length=self.length,
                            begin_with=begin_with,
                            max_iterations=len(self.charset))

            last = -1
            diff = 0
            max_c = -1
            for bruted in bf.generate():
                self.clean_temp()
                self.run_pin(bruted)

                with open(self.OUTPUT_FILE, "r") as f:
                    count = f.read()
                    count = count[len(self.PIN_STRING_BEGIN):]
                    count = int(count)
                    debug('testing {0} ({1} - max diff: {2})'.format(
                        bruted.rstrip(), count, diff))
                    if last < 0:
                        last = count
                    else:
                        if self.stop_at == StopAt.FIRST_CHANGE:
                            if count != last:
                                max_c = bruted[i]
                                debug("! New max")
                                break
                        else:
                            if abs(count - last) > diff:
                                max_c = bruted[i]
                                diff = abs(count - last)
                                debug("! New max")

            begin_with = begin_with + max_c
            success("char guessed: {0} -> {1}".format(max_c, begin_with))

        success("pass found: {0}".format(begin_with))
        return begin_with
示例#2
0
    def Accurate(self):
        """
        Counter that will try to determine the password accurately by
        bruteforcing every char with the complete charset
        """

        if self.length < 0:
            warning("no length specified - guessing")
            self.length = self.get_pass_length()
            if self.length < 0:
                return None

        begin_with = ''
        for i in range(0, self.length):
            bf = Bruteforce(self.charset,
                            final_length=self.length,
                            begin_with=begin_with,
                            max_iterations=len(self.charset))

            last = -1
            diff = 0
            max_c = -1
            for bruted in bf.generate():
                self.clean_temp()
                self.run_pin(bruted)

                with open(self.OUTPUT_FILE, "r") as f:
                    count = f.read()
                    count = count[len(self.PIN_STRING_BEGIN):]
                    count = int(count)
                    if last < 0:
                        last = count
                    else:
                        if count - last > diff:
                            max_c = bruted[i]
                            diff = count - last
                            debug("! New max")
                    debug('testing {0} ({1} - max diff: {2})'.format(
                        bruted.rstrip(), count, diff))

            success("char guessed: {0}".format(max_c))
            begin_with = begin_with + max_c

        success("pass found: {0}".format(begin_with))
        return begin_with
示例#3
0
    def Fast(self):
        """
        Counter that will try to determine the password by checking the first
        count change. Faster, but often mistaking
        """

        if self.length < 0:
            warning("no length specified - guessing")
            self.length = self.get_pass_length()
            if self.length < 0:
                return None

        begin_with = ''
        for i in range(0, self.length):
            found = False
            bf = Bruteforce(self.charset,
                            final_length=self.length,
                            begin_with=begin_with,
                            max_iterations=len(self.charset))

            iterations = -1
            for bruted in bf.generate():
                self.clean_temp()
                debug('testing {0}'.format(bruted.rstrip()))
                self.run_pin(bruted)

                with open(self.OUTPUT_FILE, "r") as f:
                    count = f.read()
                    count = count[len(self.PIN_STRING_BEGIN):]
                    count = int(count)
                    if iterations < 0:
                        iterations = count
                    else:
                        if iterations < count:
                            success("char found: {0}".format(bruted[i]))
                            begin_with = begin_with + bruted[i]
                            found = True
                            break
            if not found:
                fail("char not found")
                return begin_with

        success("pass found: {0}".format(begin_with))
        return begin_with
示例#4
0
    def Fast(self):
        """
        Counter that will try to determine the password by checking the first
        count change. Faster, but often mistaking
        """

        if self.length < 0:
            warning("no length specified - guessing")
            self.length = self.get_pass_length()
            if self.length < 0:
                return None

        begin_with = ''
        for i in range(0, self.length):
            found = False
            bf = Bruteforce(self.charset,
                            final_length=self.length,
                            begin_with=begin_with,
                            max_iterations=len(self.charset))

            iterations = -1
            for bruted in bf.generate():
                self.clean_temp()
                debug('testing {0}'.format(bruted.rstrip()))
                self.run_pin(bruted)

                with open(self.OUTPUT_FILE, "r") as f:
                    count = f.read()
                    count = count[len(self.PIN_STRING_BEGIN):]
                    count = int(count)
                    if iterations < 0:
                        iterations = count
                    else:
                        if iterations < count:
                            success("char found: {0}".format(bruted[i]))
                            begin_with = begin_with + bruted[i]
                            found = True
                            break
            if not found:
                fail("char not found")
                return begin_with

        success("pass found: {0}".format(begin_with))
        return begin_with
示例#5
0
    def Accurate(self):
        """
        Counter that will try to determine the password accurately by
        bruteforcing every char with the complete charset
        """

        if self.length < 0:
            warning("no length specified - guessing")
            self.length = self.get_pass_length()
            if self.length < 0:
                return None

        begin_with = ''
        for i in range(0, self.length):
            bf = Bruteforce(self.charset,
                            final_length=self.length,
                            begin_with=begin_with,
                            max_iterations=len(self.charset))

            last = -1
            diff = 0
            max_c = -1
            for bruted in bf.generate():
                self.clean_temp()
                debug('testing {0}'.format(bruted.rstrip()))
                self.run_pin(bruted)

                with open(self.OUTPUT_FILE, "r") as f:
                    count = f.read()
                    count = count[len(self.PIN_STRING_BEGIN):]
                    count = int(count)
                    if last < 0:
                        last = count
                    else:
                        if count - last > diff:
                            max_c = bruted[i]
                            diff = count - last

            success("char guessed: {0}".format(max_c))
            begin_with = begin_with + max_c

        success("pass found: {0}".format(begin_with))
        return begin_with
示例#6
0
    def Accurate(self):
        """
        Counter that will try to determine the password accurately by
        bruteforcing every char with the complete charset
        """

        if self.length < 0:
            warning("no length specified - guessing")
            self.length = self.get_pass_length()
            if self.length < 0:
                return None

        begin_with = ''
        for i in range(0, self.length):

            # The character is one of the known ones
            if self.fixed_chars[i] != '`':
                begin_with = begin_with + self.fixed_chars[i]
                success("char fixed:   {0} -> {1}".format(self.fixed_chars[i],
                    begin_with))
                continue

            bf = Bruteforce(self.charset,
                            final_length=self.length,
                            begin_with=begin_with,
                            max_iterations=len(self.charset))

            last = -1
            diff = 0
            max_c = -1
            for bruted in bf.generate():
                self.clean_temp()
                self.run_pin(bruted)

                with open(self.OUTPUT_FILE, "r") as f:
                    count = f.read()
                    count = count[len(self.PIN_STRING_BEGIN):]
                    count = int(count)
                    debug('testing {0} ({1} - max diff: {2})'.format(
                        bruted.rstrip(),
                        count,
                        diff))
                    if last < 0:
                        last = count
                    else:
                        if self.stop_at == StopAt.FIRST_CHANGE:
                            if count != last:
                                max_c = bruted[i]
                                debug("! New max")
                                break
                        else:
                            if abs(count - last) > diff:
                                max_c = bruted[i]
                                diff = abs(count - last)
                                debug("! New max")

            begin_with = begin_with + max_c
            success("char guessed: {0} -> {1}".format(max_c, begin_with))

        success("pass found: {0}".format(begin_with))
        return begin_with