GithubHelp home page GithubHelp logo

gitter-badger / xkcd-password-generator Goto Github PK

View Code? Open in Web Editor NEW

This project forked from redacted/xkcd-password-generator

0.0 1.0 0.0 863 KB

Generate secure multiword passwords/passphrases, inspired by XKCD

License: Other

Python 81.08% Groff 18.92%

xkcd-password-generator's Introduction

xkcdpass

A flexible and scriptable password generator which generates strong passphrases, inspired by XKCD 936:

$ xkcdpass
> correct horse battery staple

http://imgs.xkcd.com/comics/password_strength.png

Install

xkcdpass can be easily installed using pip:

pip install xkcdpass

or manually:

python setup.py install

Source

The latest development version can be found on github: https://github.com/redacted/XKCD-password-generator

Contributions welcome and gratefully appreciated!

Requirements

Python 2.4+ (Python 3.x compatible)

Running xkcdpass

xkcdpass can be called with no arguments:

$ xkcdpass
> pinball previous deprive militancy bereaved numeric

which returns a single password, using the default dictionary and default settings. Or you can mix whatever arguments you want:

$ xkcdpass --count=5 --acrostic='chaos' --delimiter='|' --min=5 --max=6 --valid_chars='[a-z]'
> collar|highly|asset|ovoid|sultan
> caper|hangup|addle|oboist|scroll
> couple|honcho|abbot|obtain|simple
> cutler|hotly|aortae|outset|stool
> cradle|helot|axial|ordure|shale

which returns

  • --count=5 5 passwords to choose from
  • --acrostic='chaos' the first letters of which spell 'chaos'
  • --delimiter='|' joined using '|'
  • --min=5 --max=6 with words between 5 and 6 characters long
  • --valid_chars='[a-z]' using only lower-case letters (via regex).

A concise overview of the available xkcdpass options can be accessed via:

xkcdpass --help

Usage: xkcdpass [options]

Options:
    -h, --help
                                show this help message and exit
    -w WORDFILE, --wordfile=WORDFILE
                                List of valid words for password
    --min=MIN_LENGTH
                                Minimum length of words to make password
    --max=MAX_LENGTH
                                Maximum length of words to make password
    -n NUMWORDS, --numwords=NUMWORDS
                                Number of words to make password
    -i, --interactive
                                Interactively select a password
    -v VALID_CHARS, --valid_chars=VALID_CHARS
                                Valid chars, using regexp style (e.g. '[a-z]')
    -V, --verbose
                                Report various metrics for given options
    -a ACROSTIC, --acrostic=ACROSTIC
                                Acrostic to constrain word choices
    -c COUNT, --count=COUNT
                                number of passwords to generate
    -d DELIM, --delimiter=DELIM
                                separator character between words

A large wordlist is provided for convenience, but the generator can be used with any word file of the correct format: a file containing one 'word' per line. The default word file can be found in xkcdpass/static/default.txt.

The default word list is derived mechanically from 12Dicts by Alan Beale. It is the understanding of the author of xkcdpass that purely mechanical transformation does not imbue copyright in the resulting work. The documentation for the 12Dicts project at http://wordlist.aspell.net/12dicts/ contains the following dedication:

The 12dicts lists were compiled by Alan Beale. I explicitly release them to the public domain, but request acknowledgment of their use.

Advanced Usage

The built-in functionality of xkcdpass can be extended by importing the module into custom python scripts. An example of this usage is provided in example_import.py, which randomly capitalises the letters in a generated password.

A simple use of import:

import xkcdpass.xkcd_password as xp

## create a wordlist from the default wordfile
## use words between 5 and 8 letters long
wordfile = xp.locate_wordfile()
mywords = xp.generate_wordlist(wordfile=wordfile, min_length=5, max_length=8)

## create a password with the acrostic "face"
print(xp.generate_xkcdpassword(mywords, acrostic="face"))

License

This is free software: you may copy, modify, and/or distribute this work under the terms of the BSD 3-Clause license. See the file LICENSE.BSD for details. -

xkcd-password-generator's People

Contributors

dbeecham avatar dmbaturin avatar olivia5k avatar redacted avatar robla avatar svisser avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.