markov-passwords

module
v0.0.0-...-93fb3a7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 10, 2021 License: MIT

README

Markov-chain passwords generator

Go Reference Go Report Card GitHub

The Markov-chain password generator is one of the password guessing methods. The trained model represents the probability of transition between specific characters. Password guessing attacks using n-grams (i.e., substrings of length n appearing in a training set) have been originally proposed by Narayanan and Shmatikov.

There is another implementation by brannondorsey here. It has written in Python, and It is very slow for experimentation purposes. This implementation is written in Go and is much faster.

License

markov-passwords is licensed under the MIT license.

Tests

Speed

Trained on Top304Thousand-probable-v2 password list.

The pv results:

./bin/mkpass -sample top304K.json -m 100000000 | pv -lta > /dev/null
00:30 [1.44M/s]

Python implementation:

python sample.py | pv -lta > /dev/null
00:30 [5.30k/s]
Unique Passwords

The sort results:

./bin/mkpass -sample top304K.json -m 1000000 | sort -u | wc -l
786577

Python implementation:

python sample.py | head -1000000 | sort -u | wc -l
541842

Usage

Get and Build
go get github.com/bujimuji/markov-passwords/...
cd $GOPATH/src/github.com/bujimuji/markov-passwords
make
Train and Generate Passwords
Usage of ./bin/mkpass:
  -infile string
    	read training password list from file (- for stdin)
  -j int
    	number of channels for fan-out (default 64)
  -m uint
    	the amount of passwords created (default 1000000)
  -ngram int
    	number of ngrams to train markov model (default 3)
  -sample string
    	model path for generating new passwords
  -train string
    	model path for saving trained model in json format and exit

Example:

./bin/mkpass -infile assets/Top304Thousand-probable-v2.txt -m 100
Only Train

Example:

./bin/mkpass -infile assets/Top304Thousand-probable-v2.txt -train top304k.json
Only Generate

Example:

./bin/mkpass -sample top304K.json -m 1000

Directories

Path Synopsis
cmd
pkg

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL