Example #1
0
 def test_make_leet(self):
     self.assertEqual(make_leet('adminstradores'), ['admin57radore5',
                                                    '4dm1nstr4d0r3s',
                                                    '4dm1n57r4d0r35'])
     
     self.assertEqual(make_leet('pepepito'), ['pepepi7o', 'p3p3p170',
                                              'p3p3p1t0'])
     
     self.assertEqual(make_leet('sS '), ['55 '])
Example #2
0
    def _getPassword( self, user ):
        '''
        Get a password from the password file.
        '''
        passwd = None
        
        if self._eofPasswords:
            # The file with passwords is now over, here i'll add the "special" passwords
            self._specialPassIndex += 1
            
            if len( self._specialPasswords ) > self._specialPassIndex:
                passwd = self._specialPasswords[ self._specialPassIndex ]
            else:
                passwd = user
                self._specialPassIndex = -1
                self._eofPasswords = False
                self._nextUser = True
            
        else:
            
            if self._leeted_passwords and self._l337_p4sswd:
                # return a leet version of the password that was read from the file a couple
                # of lines after this one:
                passwd = self._leeted_passwords.pop()
            
            else:
                passwd = self._passwordsFD.readline().strip()
                # here we create the leet passwords from the file
                self._leeted_passwords.extend( make_leet(passwd) )
                
                if passwd == '' :
                    self._passwordsFD.seek(0)
                    self._eofPasswords = True

        return passwd
Example #3
0
    def generator(self):
        '''
        TODO: I need a way to calculate the __len__ of this generator in order
              to avoid the "iterable = list(iterable)" in pool.py
        '''
        pwd_chain = chain(self._special_passwords(), self._read_pwd_file())

        for pwd in unique_everseen(pwd_chain):
            yield pwd

            if self.l337_p4sswd:
                for pwd in unique_everseen(make_leet(pwd)):
                    yield pwd
Example #4
0
    def generator(self):
        '''
        TODO: I need a way to calculate the __len__ of this generator in order
              to avoid the "iterable = list(iterable)" in pool.py
        '''
        pwd_chain = chain(self._special_passwords(),
                          self._read_pwd_file())

        for pwd in unique_everseen(pwd_chain):
            yield pwd

            if self.l337_p4sswd:
                for pwd in unique_everseen(make_leet(pwd)):
                    yield pwd
Example #5
0
 def _genSpecialPasswords( self ):
     '''
     Generate special passwords from URL, password profiling, etc.
     '''
     self._specialPassIndex = -1
     self._specialPasswords = []
     self._specialPasswords.append( self._url.getDomain() )
     self._specialPasswords.append( self._url.getRootDomain() )
     if self._useProfiling:
         self._specialPasswords.extend( self._getProfilingResults() )
     
     # Handle the leet passwords:
     if self._l337_p4sswd:
         leet_passwds = []
         for pwd in self._specialPasswords:
             leet_passwds.extend( make_leet(pwd) )
         self._specialPasswords.extend( leet_passwds )
     
     # uniq
     self._specialPasswords = list(set(self._specialPasswords))