Skip to content
Advertisement

Python – Brute force generator

I’ve made a brute force password cracker which works, but I also made a string combining generator which would be better as the brute force string generator; however I can’t figure out how to combine the two.

Brute force code:

JavaScript

Character generator code:

JavaScript

I would like to replace the “Generating” section from the brute force code with the improved generator code but I can’t do this. Please help.

Advertisement

Answer

I changed your code to use itertools and to iterate through the possible passwords using a generator so you aren’t computing more than needed.

JavaScript

A generator computes the guesses one by one as opposed to computing in advance.

Advertisement