PACK - Password Analysis & Cracking Kit

PACK (Password Analysis and Cracking Toolkit) is a collection of utilities developed to aid in analysis of password lists in order to enhance password cracking through pattern detection of masks, rules, character-sets and other password characteristics. The toolkit generates valid input files for Hashcat family of password crackers.

NOTE: The toolkit itself is not able to crack passwords, but instead designed to make operation of password crackers more efficient.

The most basic analysis that you can perform is simply obtaining most common length, character-set and other characteristics of passwords in the provided list. In the example below, we will use 'rockyou.txt' containing approximately 14 million passwords. Launch with the following command line:
$ python rockyou.txt

Using filters
Let's see how RockYou users tend to select their passwords using the "stringdigit" simple mask (a string followed by numbers):
$ python ../PACK-0.0.3/archive/rockyou.txt --simplemask stringdigit -q --hiderare

Saving advanced masks
While the "Advanced Mask" section only displays patterns matching greater than 1% of all passwords, you can obtain and save a full list of password masks matching a given dictionary by using the following command:
$ python rockyou.txt -o rockyou.masks

MaskGen allows you to craft pattern-based mask attacks for input into Hashcat family of password crackers. The tool uses output produced by statsgen above with the '-o' flag in order to produce the most optimal mask attack sorted by mask complexity, mask occurrence or ratio of the two (optimal index).
Let's run MaskGen with only StatGen's output as an argument:
$ python rockyou.masks

Specifying target time
Since you are usually limited in time to perform and craft attacks, maskgen allows you to specify how much time you have to perform mask attacks and will generate the most optimal collection of masks based on the sorting mode. Let's play a bit with different sorting modes and target times:
$ python rockyou.masks --targettime 600 --optindex -q

Specifying mask filters
You can further optimize your generated mask attacks by using filters. For example, you may have sufficiently powerful hardware where you can simple bruteforce all of the passwords up to 8 characters. In this case, you can generate masks only greater than 8 characters using the --minlength flag as follows:
$ python rockyou.masks --targettime 43200 --optindex -q --minlength 8

Saving generated masks
Once you are satisfied with the above generated masks, you can save them using the -o flag:
$ python rockyou.masks --targettime 43200 --optindex -q -o rockyou.hcmask

Checking mask coverage
It is often useful to see how well generated masks perform against already cracked lists. Maskgen can compare a collection of masks against others to see how well they would perform if masks from one password list would be attempted against another. Let's compare how well masks generated from RockYou list will perform against another compromised list such as Gawker:
$ python ../PACK-0.0.3/archive/gawker.dic -o gawker.masks
$ python gawker.masks --checkmasksfile rockyou.hcmask -q

Specifying speed
Depending on your exact hardware specs and target hash you may want to increase or decrease keys/sec speed used during calculations using the '--pps' parameter:
$ python rockyou.masks --targettime 43200 --pps 50000000 -q

A lot of the mask and dictionary attacks will fail in the corporate environment with minimum password complexity requirements. Instead of resorting to a pure bruteforcing attack, we can leverage known or guessed password complexity rules to avoid trying password candidates that are not compliant with the policy or inversely only audit for noncompliant passwords. Using PolicyGen, you will be able to generate a collection of masks following the password complexity in order to significantly reduce the cracking time.
Below is a sample session where we generate all valid password masks for an environment requiring at least one digit, one upper, and one special characters.
$ python --minlength 8 --maxlength 8 --minlower 1 --minupper 1 --mindigit 1 --minspecial 1 -o complexity.hcmask

Specifying maximum complexity
It is also possible to specify maximum password complexity using --maxlower, --maxupper, --maxdigit and --maxspecial flags in order to fine-tune you attack. For example, below is a sample site which enforces password policy but does not allow any special characters:
$ python --minlength 8 --maxlength 8 --minlower 1 --minupper 1 --mindigit 1 --maxspecial 0 -o maxcomplexity.hcmask -q

Rules Analysis implements password analysis and rule generation for the Hashcat password cracker as described in the Automatic Password Rule Analysis and Generation paper. Please review this document for detailed discussion on the theory of rule analysis and generation.

Analyzing a Single Password
The most basic use of involves analysis of a single password to automatically detect rules. Let's detect rules and potential source word used to generate a sample password P@55w0rd123:
$ python --verbose --password P@55w0rd123

Spell-checking provider
Notice that we are using the aspell Enchant module for source word detection. The exact spell-checking engine can be changed using the --provider flag as follows:
$ python --verbose --provider myspell --password P@55w0rd123 -q

Forcing source word
The use of the source word detection engine can be completely disabled by specifying a source word with the --word flag:
$ python -q --verbose --word word --password P@55w0rd123

Defining Custom Dictionary
Inevitably you will come across a point where generating rules using the standard spelling-engine wordlist is no longer sufficient. You can specify a custom wordlist using the --wordlist flag. This is particularly useful when reusing source words from a previous analysis session:
$ python -q --verbose --wordlist rockyou.txt --password 1pa55w0rd1

Generating Suboptimal Rules and Words
While attempts to generate and record only the best source words and passwords, there may be cases when you are interested in more results. Use --morewords and --morerules flags to generate words and rules which may exceed optimal edit distance:
$ python -q --verbose --password '$m0n3y$' --morerules --morewords

Disabling Advanced Engines includes a number of advanced engines to generate better quality words and rules. It is possible to disable them to observe the difference (or if they are causing issues) using --simplewords and --simplerules flags. Let's observe how both source words and rules change with these flags on:
$ python -q --verbose --password '$m0n3y$' --simplewords --simplerules

Processing password lists
Now that you have mastered all of the different flags and switches, we can attempt to generate words and rules for a collection of passwords. Let's generate a text file korelogic.txt containing the following fairly complex test passwords:

Now let's observe analysis by simply specifying the password file as the first argument:
$ python korelogic.txt -q

Specifying output basename
As previously mentioned saves output files using the 'analysis' basename by default. You can change file basename with the --basename or -b flag as follows:
$ python korelogic.txt -q -b korelogic