primitive password cracker

Bischoop Bischoop at vimart.net
Sun Jan 10 10:39:56 EST 2021


On 2021-01-08, Stefan Ram <ram at zedat.fu-berlin.de> wrote:
> Bischoop <Bischoop at vimart.net> writes:
>>What I want to learn is if I need get for example four combinations, so
>>how to get in a loop first letter 'a',then another step'a' and again 'a'
>>and 'a', to have 'aaaa' later on'abaa' etc.
>
>   I can only guess what you want, maybe something like
>
> word = []
> p = 0
>
> def inc_at( position ):
>     word[ position ]= chr( ord( word[ position ])+ 1 )
>
> while True:
>     if len( word )< p + 1:
>         word =[ "a" ]+ word
>     print( "".join( word ))
>     p = 0
>     o = len( word )- 1 - p
>     inc_at( o )
>     while p < len( word ) and word[ o ]== '{':
>         word[ o ]= "a"
>         p += 1
>         o -= 1
>         if p < len( word ): inc_at( o )
>
>   ?
>
>


Yes, it must generate 4 characters long all combination of alphabet,
equivalent to: s = list(''.join(seq) for seq initertools.product(string.ascii_lowercase, repeat=4)).
I must say that's quite coding you've done.

--
Thanks




More information about the Python-list mailing list