예제 #1
0
    def method98TwoTimes(self, tries, gets):
        ret = self.doMethodTwoTimes(tries, gets, self.password)
        if not ret:
            ret = self.doMethodTwoTimes(tries, gets, str2uni(self.password), True)
            if ret:
                self.algorithm.append("unicode")

        return ret
예제 #2
0
    def method99SaltInHash(self, tries, gets):
        ret = self.doMethodSaltInHash(tries, gets, self.password)
        if not ret:
            ret = self.doMethodSaltInHash(tries, gets, str2uni(self.password), True)
            if ret:
                self.algorithm.append("unicode")

        return ret
예제 #3
0
    def method00Plain(self, tries, gets):
        ret = self.doMethodPlain(tries, gets, self.password)
        if not ret:
            ret = self.doMethodPlain(tries, gets, str2uni(self.password), True)
            if ret:
                self.algorithm.append("unicode")

        return ret
예제 #4
0
    def method99SaltInHash(self, tries, gets):
        ret = self.doMethodSaltInHash(tries, gets, self.password)
        if not ret:
            ret = self.doMethodSaltInHash(tries, gets, str2uni(self.password),
                                          True)
            if ret:
                self.algorithm.append("unicode")

        return ret
예제 #5
0
    def doMethodTwoTimes(self, tries, gets, password, isUnicode = False):
        for property in tries:
            fGet = eval("self." + property.replace("try", "get"))
            
            if isUnicode:
                if not self.supportUnicode(property):
                    continue

            tmp = fGet(password)

            # Encrypt the hash with every hash algorithm
            for get in tries:
                if isUnicode:
                    if not self.supportUnicode(get):
                        continue

                fGet = eval("self." + get)
                ret = fGet(tmp)

                if ret == 0:
                    self.printMsg(ret, property[3:].upper())
                    self.algorithm.append(property[3:])
                    self.algorithm.append(get[3:])
                    self.algorithm.reverse()
                    return True
                elif ret == 1:
                    self.printMsg(ret, property[3:].upper())
                    pass

            #FIXME: Fixme immediately!!!!!!!!
            fGet = eval("self." + property.replace("try", "get"))
            isUnicode = True
            tmp = fGet(str2uni(password))

            # Encrypt the hash with every hash algorithm (uses Unicode)
            for get in tries:
                fGet = eval("self." + get)
                ret = fGet(tmp)

                if ret == 0:
                    self.printMsg(ret, property[3:].upper())
                    self.algorithm.append(property[3:])
                    self.algorithm.append("unicode")
                    self.algorithm.append(get[3:])
                    self.algorithm.reverse()
                    return True
                elif ret == 1:
                    self.printMsg(ret, property[3:].upper())
                    pass
예제 #6
0
    def doMethodTwoTimes(self, tries, gets, password, isUnicode=False):
        for property in tries:
            fGet = eval("self." + property.replace("try", "get"))

            if isUnicode:
                if not self.supportUnicode(property):
                    continue

            tmp = fGet(password)

            # Encrypt the hash with every hash algorithm
            for get in tries:
                if isUnicode:
                    if not self.supportUnicode(get):
                        continue

                fGet = eval("self." + get)
                ret = fGet(tmp)

                if ret == 0:
                    self.printMsg(ret, property[3:].upper())
                    self.algorithm.append(property[3:])
                    self.algorithm.append(get[3:])
                    self.algorithm.reverse()
                    return True
                elif ret == 1:
                    self.printMsg(ret, property[3:].upper())
                    pass

            #FIXME: Fixme immediately!!!!!!!!
            fGet = eval("self." + property.replace("try", "get"))
            isUnicode = True
            tmp = fGet(str2uni(password))

            # Encrypt the hash with every hash algorithm (uses Unicode)
            for get in tries:
                fGet = eval("self." + get)
                ret = fGet(tmp)

                if ret == 0:
                    self.printMsg(ret, property[3:].upper())
                    self.algorithm.append(property[3:])
                    self.algorithm.append("unicode")
                    self.algorithm.append(get[3:])
                    self.algorithm.reverse()
                    return True
                elif ret == 1:
                    self.printMsg(ret, property[3:].upper())
                    pass
예제 #7
0
    def encrypt(self, passwd):
        # Convert the password to an unicode string
        mPasswd = str2uni(passwd)
        # Append the random stuff (the key)
        mPasswd += str(self._key)
        # Get the first hash (normal)
        baseHash = hashlib.sha1(mPasswd).hexdigest().upper()
        # Get the upper case hash
        upperHash = hashlib.sha1(mPasswd.upper()).hexdigest().upper()

        # Generate the password
        buf  = "0x"
        buf += str(self._header)
        buf += str(self._key)
        buf += baseHash
        buf += upperHash

        return buf
예제 #8
0
    def encrypt(self, passwd):
        # Convert the password to an unicode string
        mPasswd = str2uni(passwd)
        # Append the random stuff (the key)
        mPasswd += str(self._key)
        # Get the first hash (normal)
        baseHash = hashlib.sha1(mPasswd).hexdigest().upper()
        # Get the upper case hash
        upperHash = hashlib.sha1(mPasswd.upper()).hexdigest().upper()

        # Generate the password
        buf = "0x"
        buf += str(self._header)
        buf += str(self._key)
        buf += baseHash
        buf += upperHash

        return buf
예제 #9
0
    def doMethodSaltInHash(self, tries, gets, password, isUnicode = False):
        # Plain text salt
        for i in range(0, len(self.hash)):
            salt = self.hash[0:i]
            self.salt = salt
            ret = self.doMethodPlain(tries, gets, password + salt, True)
            if not ret:
                # Unicode text salt
                ret = self.doMethodPlain(tries, gets, str2uni(password + self.hash[0:i]), True)
                if ret:
                    self.algorithm.append("unicode")
                    self.algorithm.append("salt = (hash[0:%d)" % i)
                    return ret
            else:
                self.algorithm.append("salt = (hash[0:%d)" % i)
                return ret

        # Reverse search
        for i in range(0, len(self.hash)):
            salt = self.hash[len(self.hash)-i:]
            self.salt = salt
            ret = self.doMethodPlain(tries, gets, password + salt, True)
            if not ret:
                ret = self.doMethodPlain(tries, gets, str2uni(salt), True)
                if ret:
                    self.algorithm.append("unicode")
                    self.algorithm.append("salt = (unicode(hash[len(hash)-%d:len(hash)]))" % i)
                    return ret
            else:
                self.algorithm.append("salt = (hash[len(hash)-%d:])" % i)
                return ret

        # FIXME: Fixme immediately!!!!!!
        for i in range(0, len(self.hash)):
            salt = self.hash[len(self.hash)-i:]
            self.salt = salt
            try:
                salt = binascii.unhexlify(salt)
            except:
                continue

            ret = self.doMethodPlain(tries, gets, password + salt, True)
            if not ret:
                try:
                    ret = self.doMethodPlain(tries, gets, str2uni(password + binascii.unhexlify(self.hash[0:i])), True)
                    if ret:
                        self.algorithm.append("unicode")
                        self.algorithm.append("salt = (hex2bin(hash[0:%d]))" % i)
                        return ret
                except:
                    if str(sys.exc_info()[1]) == "Non-hexadecimal digit found":
                        pass # Just ignore
                    else:
                        raise
            else:
                self.algorithm.append("salt = (hex2bin(hash[0:%d]))" % i)
                return ret

        # Reverse search
        for i in range(0, len(self.hash)):
            salt = self.hash[len(self.hash)-i:]
            self.salt = salt
            try:
                salt = binascii.unhexlify(salt)
            except:
                continue

            ret = self.doMethodPlain(tries, gets, password + salt, True)
            if not ret:
                ret = self.doMethodPlain(tries, gets, str2uni(password + self.hash[0:i]), True)
            else:
                return ret
        
        self.salt = ""
예제 #10
0
    def doMethodSaltInHash(self, tries, gets, password, isUnicode=False):
        # Plain text salt
        for i in range(0, len(self.hash)):
            salt = self.hash[0:i]
            self.salt = salt
            ret = self.doMethodPlain(tries, gets, password + salt, True)
            if not ret:
                # Unicode text salt
                ret = self.doMethodPlain(tries, gets,
                                         str2uni(password + self.hash[0:i]),
                                         True)
                if ret:
                    self.algorithm.append("unicode")
                    self.algorithm.append("salt = (hash[0:%d)" % i)
                    return ret
            else:
                self.algorithm.append("salt = (hash[0:%d)" % i)
                return ret

        # Reverse search
        for i in range(0, len(self.hash)):
            salt = self.hash[len(self.hash) - i:]
            self.salt = salt
            ret = self.doMethodPlain(tries, gets, password + salt, True)
            if not ret:
                ret = self.doMethodPlain(tries, gets, str2uni(salt), True)
                if ret:
                    self.algorithm.append("unicode")
                    self.algorithm.append(
                        "salt = (unicode(hash[len(hash)-%d:len(hash)]))" % i)
                    return ret
            else:
                self.algorithm.append("salt = (hash[len(hash)-%d:])" % i)
                return ret

        # FIXME: Fixme immediately!!!!!!
        for i in range(0, len(self.hash)):
            salt = self.hash[len(self.hash) - i:]
            self.salt = salt
            try:
                salt = binascii.unhexlify(salt)
            except:
                continue

            ret = self.doMethodPlain(tries, gets, password + salt, True)
            if not ret:
                try:
                    ret = self.doMethodPlain(
                        tries, gets,
                        str2uni(password + binascii.unhexlify(self.hash[0:i])),
                        True)
                    if ret:
                        self.algorithm.append("unicode")
                        self.algorithm.append("salt = (hex2bin(hash[0:%d]))" %
                                              i)
                        return ret
                except:
                    if str(sys.exc_info()[1]) == "Non-hexadecimal digit found":
                        pass  # Just ignore
                    else:
                        raise
            else:
                self.algorithm.append("salt = (hex2bin(hash[0:%d]))" % i)
                return ret

        # Reverse search
        for i in range(0, len(self.hash)):
            salt = self.hash[len(self.hash) - i:]
            self.salt = salt
            try:
                salt = binascii.unhexlify(salt)
            except:
                continue

            ret = self.doMethodPlain(tries, gets, password + salt, True)
            if not ret:
                ret = self.doMethodPlain(tries, gets,
                                         str2uni(password + self.hash[0:i]),
                                         True)
            else:
                return ret

        self.salt = ""