diff --git a/README.md b/README.md index c62d86e..c95542f 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # Dicekey -Dicekey is a [Diceware](http://diceware.com) password generator that aims to -be user friendly and encourage the adoption of strong random passwords. +Dicekey is a [Diceware](http://diceware.com) passphrase generator that aims +to be user friendly and encourage the adoption of strong random passphrases. ## Quick Start diff --git a/dicekey/core.py b/dicekey/core.py deleted file mode 100644 index 518171c..0000000 --- a/dicekey/core.py +++ /dev/null @@ -1,53 +0,0 @@ -# Dicekey. A Diceware password generator. -# Copyright (C) 2016 Kris Lamoureux -# -# 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, version 3 of the License. -# -# 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, see . - -# Built-in -import sys -import Tkinter as tk - -# Local -import diceware - - -class GUI: - - def __init__(self, master): - - frame = tk.Frame(master, padx=50, pady=50) - frame.pack() - - msgtxt = "Here is a strong random passphrase for you!" - msg = tk.Label(frame, pady=15, font=("Arial", 16), text=msgtxt) - msg.pack() - - pwgen = diceware.gen() - if pwgen.loadlist("dicekey/wordlist.asc"): - passwd = ' '.join(pwgen.wordgen(7)) - text = tk.Label(frame, font=("FreeMono", 16), text=passwd) - text.pack() - - -def main(): - - root = tk.Tk() - root.wm_title("Dicekey – Passphrase Generator") - interface = GUI(root) - - root.mainloop() - sys.exit(0) - - -if __name__ == "dicekey.core": - main() diff --git a/dicekey/dicekey b/dicekey/dicekey old mode 100755 new mode 100644 index d1b491a..993c8b6 --- a/dicekey/dicekey +++ b/dicekey/dicekey @@ -1,6 +1,6 @@ #!/usr/bin/env python -# Dicekey. A Diceware password generator. +# Dicekey. A Diceware passphrase generator. # Copyright (C) 2016 Kris Lamoureux # # This program is free software: you can redistribute it and/or modify @@ -16,21 +16,40 @@ # along with this program. If not, see . # Built-in -import traceback import sys +import Tkinter as tk -try: - import dicekey.core +# Local +from dicekey import diceware -except KeyboardInterrupt: - print "\nGoodbye!" + +class App: + + def __init__(self, master): + + frame = tk.Frame(master, padx=50, pady=50) + frame.pack() + + msgtxt = "Here is a strong random passphrase for you!" + msg = tk.Label(frame, pady=15, font=("Arial", 16), text=msgtxt) + msg.pack() + + pwgen = diceware.Gen() + if pwgen.loadlist("dicekey/wordlist.asc"): + passwd = ' '.join(pwgen.wordgen(7)) + text = tk.Label(frame, font=("FreeMono", 16), text=passwd) + text.pack() + + +def main(): + + root = tk.Tk() + root.wm_title("Dicekey - Passphrase Generator") + app = App(root) + + root.mainloop() sys.exit(0) -except SystemExit: - raise -except: - # Print error then wait to be closed. - traceback.print_exc() - raw_input() - sys.exit(0) +if __name__ == "__main__": + main() diff --git a/dicekey/diceware.py b/dicekey/diceware.py index 6015f90..d3ab1ce 100644 --- a/dicekey/diceware.py +++ b/dicekey/diceware.py @@ -1,4 +1,4 @@ -# Dicekey. A Diceware password generator. +# Dicekey. A Diceware passphrase generator. # Copyright (C) 2016 Kris Lamoureux # # This program is free software: you can redistribute it and/or modify @@ -18,21 +18,21 @@ import random import re -class gen: +class Gen: - wordlist = {} + def __init__(self): + self.wordlist = {} + self.PRNG = random.SystemRandom() # Generate Diceware numbers def numgen(self, length=1): numlist = [] - PRNG = random.SystemRandom() - for _ in range(length): number = "" for _ in range(5): - digit = PRNG.randint(1, 6) + digit = self.PRNG.randint(1, 6) number = number + str(digit) numlist.append(number) @@ -55,13 +55,13 @@ class gen: # Ensure the list is complete if len(self.wordlist) == 7776: - return True + return self.wordlist else: - self.wordlist = {} - return False + self.wordlist = None + return None - # Generate password + # Generate passphrase def wordgen(self, length): words = [] diff --git a/setup.py b/setup.py index b7b0056..6fd978b 100644 --- a/setup.py +++ b/setup.py @@ -1,4 +1,4 @@ -# Dicekey. A Diceware password generator. +# Dicekey. A Diceware passphrase generator. # Copyright (C) 2016 Kris Lamoureux # # This program is free software: you can redistribute it and/or modify @@ -17,11 +17,11 @@ from distutils.core import setup NAME = "Dicekey" -VERSION = "2.0.0-prealpha" +VERSION = "3.0.0-prealpha" AUTHOR = "Kris Lamoureux" AUTHOR_EMAIL = "KrisPublicEmail@gmail.com" URL = "https://github.com/Kris619/Dicekey/" -DESCRIPTION = "A Diceware password generator" +DESCRIPTION = "A Diceware passphrase generator" setup( name=NAME, @@ -32,6 +32,6 @@ setup( license="GNU GPLv3", url=URL, scripts = ["dicekey/dicekey"], - py_modules = ["dicekey.core", "dicekey.diceware"], + py_modules = ["dicekey.diceware"], data_files = [("dicekey/wordlist.asc", '')] )