Skip to content

ubuntupodcast/Phrase

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Generate a phrase

Forked from Pass-phrase by Aaron Bassett which was inspired by the 'Password Strength' comic by xkcd.

What it does

Phrases are 3 words; adjective, adjective, noun. I find this pattern produces suitable phrases.

Usage

From the command line

$ ./phrase.py -C
Cool Skillful Title

In your own scripts

There is no easy way to use it in your own scripts at the moment. But if you really must use it right this second in your own scripts then you can do:

>>> from phrase import generate_wordlist, passphrase
>>> adjectives = generate_wordlist("adjectives.txt")
>>> nouns = generate_wordlist("nouns.txt")
>>> phrase(adjectives, adjectives, nouns, " ")
'rare mere reward'

Word files

The script expects 2 different word files, I've included examples of these in the repo:

  • adjectives.txt
  • nouns.txt

It will check for the existence of these files in the current directory or in ~/.phrase/

If you want to use other files, or relocate them, use the command line options.

$ ./phrase.py --adjectives="/usr/share/dict/adjectives" --nouns="/usr/share/dict/nouns" --verbs="/usr/share/dict/verbs"

Command line options

Options:
  -h, --help            show this help message and exit
  --adjectives=ADJECTIVES
                        List of valid adjectives for passphrase
  --nouns=NOUNS         List of valid nouns for passphrase
  -s SEPARATOR, --separator=SEPARATOR
                        Separator to add between words
  -n NUM, --num=NUM     Number of passphrases to generate
  --min=MIN_LENGTH      Minimum length of a valid word to use in passphrase
  --max=MAX_LENGTH      Maximum length of a valid word to use in passphrase
  --valid_chars=VALID_CHARS
                        Valid chars, using regexp style (e.g. '[a-z]')
  -U, --uppercase       Force passphrase into uppercase
  -L, --lowercase       Force passphrase into lowercase
  -C, --capitalise, --capitalize
                        Force passphrase to capitalise each word
  -V, --verbose         Report various metrics for given options

License

MIT: http://aaron.mit-license.org

Releases

No releases published

Packages

No packages published

Languages