How to generate dictionary for a dictionary attack?
I need to crack my own password. Advantage is that I know possible characters and maximum length.
What I need is to create a dictionary. The dictionary should contain all the combos of characters that I choose (for example I don't need word list which contain character T, because I didn't used T in my password).
How can I do that?
Just a note on terminology, this is a "Dictionary attack", not a "Brute force attack". The more information you know, the better your dictionary can be; *likely* lengths, patterns such as *starts with capital, ends with number*, *two words joined plus a number*, *l33t speak*, etc. Even if you're not sure about something it can be used to order the dictionary. But don't put the information here or anyone will be able to use it.
1. Can you program? 2. What is the password for, i.e. how will you know when you have found the correct one?
So you could use python to generate all possible combinations using
import itertools res = itertools.permutations('abc',3) # 3 is the length of your result. for i in res: print ''.join(i)
'abc'is a string of possible characters. Note that a and A are not the same!
This will output:
abc acb bac bca cab cba
Edit (thanks to @buherator):
If you want repeated letters (e.g. aaa, etc), you need to use
itertools.productinstead. For instance,
import itertools res = itertools.product('abc', repeat=3) # 3 is the length of your result. for i in res: print ''.join(i)
This will output:
aaa aab aac aba abb abc aca acb acc baa bab bac bba bbb bbc bca bcb bcc caa cab cac cba cbb cbc cca ccb ccc
This won't give you all possible passwords with a given charset (aaa is missing for example). `itertools.combinations_with_replacement()` can be more useful.
Sorry `itertools.combinations_with_replacement()` is neither the right choice, you should use `itertools.product()`.