Building a Huge Dictionary, for Dictionary Attacks in Hacking

For Wifi Hack: Crack WPA2 Or WPA Password, we generally use a dictionary attack, a brute force type attack in Kali Linux. It has to certain some complex computations and processings but by the end of it it still needs a good word dictionary to actually be able to attack and be successful.

I have just made an attempt to be able to create an exhaustive word list, via permutation and combination of all possible characters based on a US-English Keyboard.

Below is the code for the same:

package in.techutils.wordlist.generator;

import java.util.ArrayList;
import java.util.List;

public class Tester {

    public static List combos = new ArrayList();
    public static int fileIndex = 0;
    public static final String PATH = "C:/Projects/ set";

    static void printAllKLength(char set[], int k) {
        int n = set.length;
        printAllKLengthRec(set, "", n, k);

    static void printAllKLengthRec(char set[], String prefix, int n, int k) {

        if (k == 0) {
            if (combos.size() == 999999) {
                System.out.println("Writing to File..." + (++fileIndex));
        for (int i = 0; i < n; ++i) { String newPrefix = prefix + set[i]; printAllKLengthRec(set, newPrefix, n, k - 1); } } public static void main(String[] args) { char set1[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890 !`~:;_@#$%^&*(){}[]-_=+|?".toCharArray(); int k = 8; printAllKLength(set1, k); } public static void fileDump() { PrintWriter out = null; try { out = new PrintWriter(PATH +" "+ fileIndex + ".txt"); StringBuffer sb = new StringBuffer(""); for (String comb : combos) { sb.append(comb).append("\n"); } out.println(sb); } catch (Exception e) { System.out.println("error for file: " + PATH +" "+ fileIndex + "--->"
                    + e);
        } finally {
            if (out != null) {



The Algorithm stores 999999 keys per file leading upto 8MB per file.

Also this process is for 8 key characters only. It will be more time taking in 8->16 characters.
The above code is lengthy approach but I think it must be extensive enough. I had to kill the process midway(1 hr into the execution) and ended up with 74.5 GB.

If anyone can run this and get it completed, i think we will be having the complete dictionary attack set….:)

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.