+ 1
How can I generate a wordlist like Crunch using Python?
I would like to generate a wordlist like the ones generated by the Linux app "Crunch" where all the characters in the wordlist are from a character set (eg. "[a-zA-Z0-9]) and ranges from one character word up to n (n is user's input). Example: $ python3 words.py "abc" 3 # words.py is the script, "abc" is the character set, 3 is max character for each word (i.e. n) Expected Output: a aa ab ac aaa aab aac aba abb abc [...] b ba bb bc baa bab bac bba bbb [...] And so on up to 'ccc'....
3 ответов
+ 3
import itertools
print(list(map("".join, itertools.product('abc', repeat=3))))
+ 1
Thanks. This will do fine Marking it as best answer. One more thing... any idea how to implement this in C?
0
Sorry man, got 0 experience in C but surely if you search on Google you'll find an answer.