Coder Social home page Coder Social logo

raspberryaether / dwpwg Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 1.0 163 KB

Utility for creating high-security passphrases using randomized Diceware codebooks.

License: GNU General Public License v2.0

Python 100.00%
keyphrases encryption diceware encryption-key cryptocurrency passwords password-generator diceware-passphrase-generator

dwpwg's Introduction

Introduction

dwpwg, the diceware password generator...

...is a Diceware-inspired passphrase/keyphrase construction utility.

TL;DR

If you don't quite understand this section, skip to the next section, and read the whole page. More detailed instructions follow.

You will need at least one d20. Run:

sudo pip install dwpwg
dwpwg --help

Do not use fewer than 4 words for anything. Do not use fewer than 8 words for an encryption key. Do not use fewer than 12 words for anything involving cryptocurrency. NEVER LOSE A CRYPTOGRAPHIC KEYPHRASE, or everything will be gone forever. You have been warned.

Why?

First, read: https://xkcd.com/936/

It is easy for humans to think up terrible passwords. As a matter of fact, it is reasonable to assume that humans are incredibly lousy at thinking up anything that is meant to be random and unguessable. Because of an illogical yet near universal misconception that "hard to remember == hard to guess", we use weaker passwords than we should, and to add insult to injury, we forget them.

Diceware is a method invented by one Arnold G. Reinhold for generating easy-to-remember passwords which are also extremely difficult for even a powerful supercomputing cluster to guess.

More required reading: http://world.std.com/~reinhold/diceware.html

About

Despite its name, this program is not intended to generate random passwords. It is designed, instead, to generate random word lists, and create passwords from a very small, randomised subset of those wordlists using entropy generated using 20-sided dice normally used for tabletop gaming.

Note that in this modern age, it no longer makes (and maybe never did make) you a crazy person to believe that you may be being watched. In such a case, from a security perspective, dwpwg does as good or only slightly better than an ordinary random password generator; all of its utility will manifest in the easy-to-remember passwords it will help you generate.

dwpwg thrives, however, in the art of cryptographic keyphrase generation. In a case where an adversary has purposefully debilitated the pseudorandom number generating software on your computer, they can theoretically weaken any encryption keys generated therewith. However, assuming that:

  • your machine is offline and/or free of keyloggers/rootkits, and
  • dwpwg itself is intact, and
  • the Python interpreter on your machine, its operating system, or the machine itself has not been compromised in a way more or less specifically targeting dwpwg,

an attacker would have to compromise both your computer's pseudorandom number generation routines AND your dice in order to effectively mount a reduced keyspace attack against you.

A "super paranoid" mode is in development to tackle the remaining concerns above by allowing a list to be printed and used offline (albeit with much of the convenience understandably lost). This mode is superior to simply using an already-constructed wordlist because an attacker necessarily must compromise both your dice and your list in order to have an easier time guessing your passphrase. Using a publicly-available list hands them half of the puzzle for free.

Installing

Prerequisites:

  • Python 2.7.x
  • pip
  • an Internet connection

dwpwg is available from PyPI using pip install dwpwg. Depending on your environment, you will probably need to be root (on GNU/Linux) or running as Administrator (on Windows). Run:

pip install dwpwg

If you prefer to run the development version of dwpwg, or to run it in-place rather than installing, that is possible too:

git clone https://github.com/raspberryaether/dwpwg.git
cd dwpwg
python -m dwpwg --help

It is also possible to manually create and install the dwpwg package locally. Perform the steps above to get the development version, then, as root or Administrator:

python setup.py install

Detailed usage instructions

This is a command-line utility. If you are this concerned with security, we will assume you have at least general knowledge of how to execute one. If you do not, we strongly suggest you get familiar with it. In today's political climate, things are only going to get worse for those who rely on cushy UIs for everything.

You'll need to have at least one 20-sided die, though the more you can roll at once, the faster entropy generation will go. Using a dice cup will improve your speed (faster rolls), convenience (no "cleanup" or "runaways"), and security (smaller viewing angle for eavesdroppers and an arguably harder-to-analyse acoustic profile). Just be sure to actually shake the dice, not just swirl them around.

You followed the installation instructions above, right? Good. Run the following:

dwpwg "{.} {.} {.} {.}"

replacing the given pattern with a custom one of your choice if desired.

Patterns are constructed as follows:

  • {.} is replaced by a lowercase word.
  • {+} is replaced by a Capitalized word.
  • {@} is replaced by an ALL-CAPS word.
  • {%} is replaced by the numerical value of one dice roll.
  • {#42} is replaced by a number no higher than 42.
  • {{ is replaced by { as soon as it is encountered.
  • }} is replaced by } if there is no currently open brace.
  • any other character is treated as a literal (kept unchanged).

For example, the pattern: {{octothorpe_{@}.{%}-{#1000}[{+}{.}]}}

may output the passphrase: {octothorpe_RAZOR.12-254[Applynougat]}

Follow onscreen instructions. Press ENTER after entering each individual die roll.

Your password will be displayed in plaintext on the last line. Physically secure your device as necessary. When in doubt, close your shades, lock your door, wear a tinfoil hat (that one is a joke, but we are sure it won't hurt anything if you insist), and do it all over again.

Do not use fewer than 4 words for anything. Do not use fewer than 8 words for an encryption key. Do not user fewer than 12 words for anything involving cryptocurrency. NEVER LOSE A CRYPTOGRAPHIC KEYPHRASE, or everything will be gone forever.

DO NOT LOSE YOUR PASSWORD; ESPECIALLY IF IT IS FOR ENCRYPTION OR CRYPTOCURRENCY. If in doubt, write it down and put it somewhere safe from prying eyes, fire, and flood alike. Make an hourly habit of reciting your passphrase inside your head.

REMEMBER: If you lose an encryption or cryptocurrency keyphrase, all your data and/or money will be gone forever. There's only so many times we can warn you. DO NOT LOSE YOUR KEYPHRASE.

Legal

dwpwg

dwpwg - (d)ice(w)are (p)ass(w)ord (g)enerator Copyright (C) 2017 Raspberry Aether

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

Word lists

Though the copyright status of word lists is dubious at best, the author of the wordlists used by dwpwg releases it under the terms of the GNU GPLv2, and we do not wish to ruffle any feathers. Therefore, to simplify things, we released this application, and the heavily-modified wordlists within, under the same licence.

Copyright information for the word source(s):

Copyright (c) Frank Richter <[email protected]> 1995-2016
GNU General Public License, see COPYING for details
It comes with ABSOLUTELY NO WARRANTY.

At the time of this writing, the master word list was available at:

<http://ftp.tu-chemnitz.de/pub/Local/urz/ding/de-en/>

Note that the master word list is a German-to-English translation dictionary and, therefore, had to be processed beyond recognition in order to create the wordlists distributed with this application. Of course, you may use our modified lists under the terms of the same licence as the source material.

Support us

We accept donations in cryptocurrency.

Currency Address QR
Monero 45DmoRGs9wLUXNBvHo7pS6Wg1VuVQJHsg1
eCRrNCgGxSf6n6oep1daE2eo3wNUZAoyDz
y94HNFRUogn2oAVup7WCAqDJmHp
Monero QR
Bitcoin 144PQPFa2sVm7mGHdSayk8VjzFVzSbBMCM Bitcoin QR

Thank you for your generosity.

dwpwg's People

Contributors

raspberryaether avatar

Stargazers

 avatar  avatar

Watchers

 avatar

dwpwg's Issues

output printable codebook

dwpwg currently offers a middle ground between security and convenience. However, we should add the ability to simply generate a new printable code book; that way passwords could be generated offline.

Acceptance criteria:

  • A command line option is present which outputs a printable PDF file (or, optionally, a raw text file) of the generated codebook
  • README is updated with new method

wordlist audit mode

Implement an "audit" mode to provide the ability to swap out undesirable (vulgar and/or hard to remember or spell) words.

A suggested mode of implementation:

  1. The word is printed, upon which the user is prompted "(K)eep? (D)iscard? (B)ack? ".
    a. Keep will result in the current word being added to the revised wordlist and the next word being shown.
    b. Discard will show the next word. The current word will not be added.
    c. Back will remove the previous word added to the revised wordlist and present it again for decision.
  2. The user is prompted for a filename in which to save the revised wordlist.

Acceptance Criteria:

  • A wordlist audit mode such as the one described above is implemented.
  • A mechanism is present to use the customized wordlists.
  • The readme is updated with an explanation of the new mode.

more user friendly i/o

Currently input is somewhat inconvenient as input is rather unconstrained and may cause undefined behavior. Output is also unnecessarily verbose and cryptic.

We should change this. Currently after a newline is used to lock in a roll, a new prompt shows the number of rolls remaining. There is no way to revise prior rolls. We should instead use the following state-based model:

  • Rearrange output to a grid structure, with N columns where N is the number of rolls per word.
  • When N cells are confirmed, the corresponding word is printed at the end of the line and the cursor moves to the first cell on the next line.
  • In any cell:
    • Numeric input is only accepted if it would result in a valid roll. Otherwise, an alert bell is emitted.
  • In an empty cell:
    • [Backspace] or [-] moves the cursor to the end of the previous cell or emits an alarm bell if this is not possible.
    • [Enter] or [.] emits an alarm bell.
  • In a non-empty cell:
    • [Backspace] or [-] removes the most recently entered digit and puts the cursor in its place.
    • [Enter] or [.] locks in the roll and moves the cursor to the next cell.

Acceptance criteria:

  • Input and output follows the new scheme detailed above.
  • Behavior is tested both with a terminal emulator and a Windows command prompt.

take format string instead of only the number of words

In addition to a number of words, we should also accept a format string which allows a password to be generated entirely programmatically if a user wishes to insert other characters between/after the words.

For example, the command: $ python -m dwpwg {@}-{+}-{.}-{.}-{#100}
Might output the password: CORRECT-Horse-battery-staple-42

Acceptance criteria:

  • a format string scheme is implemented as described above
  • README documents new scheme

create package and submit to PyPI

Package should be submitted to PyPI to simplify the install process.

Acceptance criteria:

  • Nice installable package using setuptools
  • A proper entry point is registered such that installation results in a "dwpwg" command in path
  • README reflects new installation method
  • Submitted to PyPI

wordlist is not shuffled by default

The wordlist is currently not shuffled before being indexed by the dice throws.

Reproduction instructions:

  1. Run python -m dwpwg 1
  2. Input 1 three times.
  3. Generated word will be aachen, every time.

support different types of dice

The "classic" Diceware algorithm calls for 7776 unique words in a list, indexed by all possible permutations of 5 six-sided dice. Using 20-sided dice, @ospalh was able to reduce the number of dice needed to index these words to three.

Unfortunately, not everyone has multiple d20s lying around. More unfortunately yet, not everyone has a d20 at all. And still more unfortunate than that is the fact that probably a great number of humans do not know what a d20 is.

Six-sided dice, however, are everywhere. Therefore, dwpwg should be extended to support dice with 6 faces.

Acceptance criteria:

  • Generation of wordlists and passphrases using dice with 6 faces is supported.
  • The readme is updated to mention 6-sided dice.

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.