I found the following code to be used for brute forcing -
import itertools
def bruteforce(charset, length):
return (''.join(candidate)
for candidate in itertools.chain.from_iterable(itertools.product(charset, repeat=i)
for i in range(length, length + 1)))
for attempt in bruteforce('ab', 10):
# do something
But I would like to have it more smart - be able to pause and to start from the particular attempt.
I am reading the similar question and answers there - Using itertools.product and want to seed a value - but can not understand how to apply make_product
used there to my case.