I want to perform a dictionary attack and for that I need word lists. How to generate word list from given characters of specific length ( or word length from min length to
from itertools import product
def allwords(chars, length):
for letters in product(chars, repeat=length):
yield ''.join(letters)
def main():
letters = "abc"
for wordlen in range(3, 5):
for word in allwords(letters, wordlen):
print(word)
if __name__=="__main__":
main()
returns
aaa
aab
aac
aba
abb
...
ccbc
ccca
cccb
cccc