primitive password cracker

Bischoop Bischoop at vimart.net
Thu Jan 7 09:05:51 EST 2021


On 2021-01-07, Chris Angelico <rosuav at gmail.com> wrote:
>
> I'd recommend having just a string, rather than a list; it'll behave
> identically for what you're doing, and it'll be a lot easier to see
> when you have all the right letters.
>

Yes that's definitely better, I've done so.
>> mineset= set()
>> for a in letters:
>>     for b in letters:
>>         for c in letters:
>>             for d in letters:
>>                 s = a + b + c + b
>
> Why is b at the end? :) That's why "zulu" could be found, but "pass" couldn't.
>

ha, that's typo I was working so long on it that got mixed up.
and yes with 'd' it works :-)

>> k = sorted(mineset)
>> print(k)
>> for i in k:
>>     if i == passe:
>>         print('got it: ', i )
>> print(passe in k)
>> --------------------------------------
>> It works in someway but the problems are:
>> Not all combination are made, I change password to: 'pass' and that combination is not in results.
>> Another thing is, I had to made a set from list because combinations
>> were repeated.
>
> Yep. I'd recommend looking at the original list rather than setting
> and sorting, and you might notice patterns that hint at problems.
>
The problem was with that 'b' at the end, now it solved.


>> for x in range(4):          
>>     for y in letters:
>>         combin +=y
>>         lista.append(combin)
>>     combin=''
>
> Not entirely sure what your intended logic is here, but I'd advise
> planning things out in pseudocode and knowing what you're actually
> building.
>
Well :-) I tried to do shorter version of the previous code to do not do
for loop for every character, range
supposed to be for how long the password is, in this case four
characters, once the 4character combination is made add it to the list,
similarly to the previous code but.... my logic is wrong here.
I don't have clue hot to tell: get a letter for 1 get for 2 get for 3
and get for 4.




> Debugging code can be very hard, especially if you don't know what
> it's doing. Fortunately, Python comes with a number of tools to help
> you figure out your code; the simplest is the print function - just
> add a few useful print calls to your code and trace through things
> that way. You can also look at the pdb module, and various other
> techniques. Explore your code, get to know how it works at each point,
> and you should be able to figure things out.
>
> Good luck, have fun! And remember IIDPIO: If In Doubt, Print It Out!
>

For me is even not debbuging code is important but to do
what I want and in that case is that what I mention earlier four
letters picked and add them to the list, and today again I seat on it
and just nothing lol.

--
Thanks


More information about the Python-list mailing list