# Creating a wordlist knowing parameters

I need to crack my own router 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. I know that the maximal length is 8 characters, and each character can be ([A-Za-z0-9]).

How can I do that?

Well, I don't see why you need to create a dictionary. You could just generate the letter combinations as the program runs. No need to generate all the combinations ahead of time.

As for generating every combination, your alphabet has 62 characters in it. So, the number of combinations up to 8 characters in length, having at least one character is:

``````62 + 62^2 + 62^3 + 62^4 + 62^5 + 62^6+ 62^7 + 62^8 = 221,919,451,578,090
``````

That is about 222 trillion combinations. So, you would need to buy about 200 terabyte hard drives to store your dictionary. Are you sure you want to do that?

Also, if you could generate and write to disk 1 billion combinations per second, then it would take 479 years to write all the combinations, so you would have to have your descendants continue the project after you had passed on.

• The question was to address the how not the complexity - the math! – Shritam Bhowmick Jan 22 '17 at 19:25
• Based on the op's question it would seem that he is unfamiliar with password cracking and thus unaware of why his approach is a bad idea from a performance perspective (disk vs memory speed) – wireghoul Jan 22 '17 at 19:51
• +1 I went ahead and wrote a program to do it without even thinking about how many permutations there would be. Doing this math first stops you from wasting time like I did. – Xiong Chiamiov Jan 23 '17 at 2:47
• About 222 trillion combinations but roughly 2 quadrillion bytes hence 2000 x 1TB disks. – dave_thompson_085 Jan 23 '17 at 12:38

It's fairly easy to program this yourself; here's an implementation in Python:

``````#!/usr/bin/env python3

import itertools
import string

candidate_characters = list(string.ascii_letters + string.digits)
``````

As Tyler Durden points out, however, doing this directly is infeasible due to the amount of disk space it will consume.

A better approach would be to not store a dictionary on disk, but try these candidate passwords as you generate them. However, it's still not a great one: if you have to go through all possible 222 trillion combinations, that's going to take a hell of a long time (say, 10 a second? That's a few times longer than the time since the last ice age).

If it's your own router, just hit the reset button.

There are plenty of approaches to this:

1. Programming to have a dictionary wordlist
2. Using existing tool to create a dictionary

For Approach one, I would recommend using Python (being it less time consuming). You can use itertools.permutation Here's a sample code:

``````import itertools
res = itertools.permutations('abc',3) # 3 is the length of your result.
for i in res:
print ''.join(i)
``````

For Approach two, you can use crunch to create the list as per needs:

Sample Code:

``````crunch 8 8 -f /usr/share/rainbowcrack/charset.txt mixalpha -o /root/alphawordlist.lst
``````

You can use `man crunch` in Kali Linux to opt for the syntax.

Later you can use Hydra to brute using the custom dictionary you needed.

• Notably, your python doesn't calculate passwords up to 3 characters long, and doesn't have the correct input set. – Xiong Chiamiov Jan 23 '17 at 2:50
• @XiongChiamiov it's noted in answer area to be a sample program. It was meant to be. The answer was needed to be how .. – Shritam Bhowmick Jan 23 '17 at 5:25