figenc

[RADIOACTIVE] rsa and symmetric key encryption scripts and executables
git clone git://git.figbert.com/figenc.git
Log | Files | Refs | README

commit 01df358a41410d9571d3d88288f4c1afbc23a0f7
parent eae1eab68b9de90dcc7ca8c8a4f311a3f014c64c
Author: therealFIGBERT <naomi@FIGBERT-Mini.local>
Date:   Thu, 11 Jul 2019 22:20:02 -1000

Updating figENC_MacOS.py formatting to fit PEP8 guidelines (PEM8 Rollout phase 1)

Diffstat:
MMacOS/figENC_MacOS.py | 364++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----------------------
1 file changed, 266 insertions(+), 98 deletions(-)

diff --git a/MacOS/figENC_MacOS.py b/MacOS/figENC_MacOS.py @@ -1,12 +1,13 @@ +import tkinter as tk from initiate_key import rsa_key from initiate_key import weak_key from encrypt import rsa_enc from decrypt import rsa_dec from decrypt import weak_dec -import tkinter as tk crypto_mode = "" def setup(mode): + """"Change the GUI to match the app mode.""" mode = mode[0] global crypto_mode if mode == 0: @@ -23,25 +24,38 @@ def setup(mode): save_instructions.pack_forget() save_input.pack_forget() submit.pack_forget() - file_frame.pack(fill="both") - file_label.config(text="Filepath/s to the file/s to encrypt") + file_frame.pack(fill = "both") + file_label.config(text = "Filepath/s to the file/s to encrypt") file_label.pack() file_instructions.pack() - file_input.pack(fill='x') - passcode_frame.pack(fill="both") - passcode_label.config(text="Set private key passcode") + file_input.pack(fill = "x") + passcode_frame.pack(fill = "both") + passcode_label.config(text = "Set private key passcode") passcode_label.pack() - passcode_instructions.config(text="CRITICAL: DO NOT FORGET YOUR PASSCODE.\nWITHOUT IT, YOUR DATA WILL BE LOST.") + passcode_instructions.config( + text = ( + "CRITICAL: DO NOT FORGET YOUR" + "PASSCODE.\nWITHOUT IT, " + "YOUR DATA WILL BE LOST." + ) + ) passcode_instructions.pack() - passcode_input.pack(fill='x') - save.pack(fill="both") - save_label.config(text="Save location for keys") + passcode_input.pack(fill = "x") + save.pack(fill = "both") + save_label.config(text = "Save location for keys") save_label.pack() - save_instructions.config(text="Save the keys to an empty folder, and store them somewhere secure\nIf other key files exist in the same folder, they will be overwritten") + save_instructions.config( + text = ( + "Save the keys to an empty folder, " + "and store them somewhere secure\n" + "If other key files exist in the same" + "folder, they will be overwritten" + ) + ) save_instructions.pack() - save_input.pack(fill="both") - submit.config(text="Encrypt file/s") - submit.pack(pady="10") + save_input.pack(fill = "both") + submit.config(text = "Encrypt file/s") + submit.pack(pady = "10") crypto_mode = "key_enc" elif mode == 1: file_frame.pack_forget() @@ -57,19 +71,26 @@ def setup(mode): save_instructions.pack_forget() save_input.pack_forget() submit.pack_forget() - file_frame.pack(fill="both") - file_label.config(text="Filepath/s to the file/s to encrypt") + file_frame.pack(fill = "both") + file_label.config(text = "Filepath/s to the file/s to encrypt") file_label.pack() file_instructions.pack() - file_input.pack(fill='x') - save.pack(fill="both") - save_label.config(text="Save location for keys") + file_input.pack(fill = "x") + save.pack(fill = "both") + save_label.config(text = "Save location for keys") save_label.pack() - save_instructions.config(text="Save the keys to an empty folder, and store them somewhere secure\nIf other key files exist in the same folder, they will be overwritten") + save_instructions.config( + text = ( + "Save the keys to an empty folder, " + "and store them somewhere secure\n" + "If other key files exist in the same" + "folder, they will be overwritten" + ) + ) save_instructions.pack() - save_input.pack(fill="both") - submit.config(text="Encrypt file/s") - submit.pack(pady="10") + save_input.pack(fill = "both") + submit.config(text = "Encrypt file/s") + submit.pack(pady = "10") crypto_mode = "weak_key_enc" elif mode == 2: file_frame.pack_forget() @@ -85,19 +106,19 @@ def setup(mode): save_instructions.pack_forget() save_input.pack_forget() submit.pack_forget() - file_frame.pack(fill="both") - file_label.config(text="Filepath/s to the file/s to encrypt") + file_frame.pack(fill = "both") + file_label.config(text = "Filepath/s to the file/s to encrypt") file_label.pack() file_instructions.pack() - file_input.pack(fill='x') - save.pack(fill="both") - save_label.config(text="Key location") + file_input.pack(fill = "x") + save.pack(fill = "both") + save_label.config(text = "Key location") save_label.pack() - save_instructions.config(text="Filepath to matching key trio") + save_instructions.config(text = "Filepath to matching key trio") save_instructions.pack() - save_input.pack(fill="both") - submit.config(text="Encrypt file/s") - submit.pack(pady="10") + save_input.pack(fill = "both") + submit.config(text = "Encrypt file/s") + submit.pack(pady = "10") crypto_mode = "enc" elif mode == 3: file_frame.pack_forget() @@ -113,25 +134,30 @@ def setup(mode): save_instructions.pack_forget() save_input.pack_forget() submit.pack_forget() - file_frame.pack(fill="both") - file_label.config(text="Filepath/s to the file/s to decrypt") + file_frame.pack(fill = "both") + file_label.config(text = "Filepath/s to the file/s to decrypt") file_label.pack() file_instructions.pack() - file_input.pack(fill='x') - passcode_frame.pack(fill="both") - passcode_label.config(text="Private key passcode") + file_input.pack(fill = "x") + passcode_frame.pack(fill = "both") + passcode_label.config(text = "Private key passcode") passcode_label.pack() - passcode_instructions.config(text="Passcode must be the same passcode used when the keys were created") + passcode_instructions.config( + text = ( + "Passcode must be the same " + "passcode used when the keys were created" + ) + ) passcode_instructions.pack() - passcode_input.pack(fill='x') - save.pack(fill="both") - save_label.config(text="Key location") + passcode_input.pack(fill = "x") + save.pack(fill = "both") + save_label.config(text = "Key location") save_label.pack() - save_instructions.config(text="Filepath to matching key trio") + save_instructions.config(text = "Filepath to matching key trio") save_instructions.pack() - save_input.pack(fill="both") - submit.config(text="Decrypt file/s") - submit.pack(pady="10") + save_input.pack(fill = "both") + submit.config(text = "Decrypt file/s") + submit.pack(pady = "10") crypto_mode = "dec" elif mode == 4: file_frame.pack_forget() @@ -147,19 +173,19 @@ def setup(mode): save_instructions.pack_forget() save_input.pack_forget() submit.pack_forget() - file_frame.pack(fill="both") - file_label.config(text="Filepath/s to the file/s to decrypt") + file_frame.pack(fill = "both") + file_label.config(text = "Filepath/s to the file/s to decrypt") file_label.pack() file_instructions.pack() - file_input.pack(fill='x') - save.pack(fill="both") - save_label.config(text="Key location") + file_input.pack(fill = "x") + save.pack(fill = "both") + save_label.config(text = "Key location") save_label.pack() - save_instructions.config(text="Filepath to matching key trio") + save_instructions.config(text =" Filepath to matching key trio") save_instructions.pack() - save_input.pack(fill="both") - submit.config(text="Decrypt file/s") - submit.pack(pady="10") + save_input.pack(fill = "both") + submit.config(text = "Decrypt file/s") + submit.pack(pady = "10") crypto_mode = "weak_dec" elif mode == 5: file_frame.pack_forget() @@ -175,20 +201,32 @@ def setup(mode): save_instructions.pack_forget() save_input.pack_forget() submit.pack_forget() - passcode_frame.pack(fill="both") - passcode_label.config(text="Set private key passcode") + passcode_frame.pack(fill = "both") + passcode_label.config(text = "Set private key passcode") passcode_label.pack() - passcode_instructions.config(text="CRITICAL: DO NOT FORGET YOUR PASSCODE.\nWITHOUT IT, YOUR DATA WILL BE LOST.") + passcode_instructions.config( + text = ( + "CRITICAL: DO NOT FORGET YOUR PASSCODE.\nWITHOUT IT, " + "YOUR DATA WILL BE LOST." + ) + ) passcode_instructions.pack() - passcode_input.pack(fill='x') - save.pack(fill="both") - save_label.config(text="Save location for keys") + passcode_input.pack(fill = "x") + save.pack(fill = "both") + save_label.config(text = "Save location for keys") save_label.pack() - save_instructions.config(text="Save the keys to an empty folder, and store them somewhere secure\nIf other key files exist in the same folder, they will be overwritten") + save_instructions.config( + text = ( + "Save the keys to an empty folder, " + "and store them somewhere secure\n" + "If other key files exist in the same" + "folder, they will be overwritten" + ) + ) save_instructions.pack() - save_input.pack(fill="both") - submit.config(text="Create keys") - submit.pack(pady="10") + save_input.pack(fill = "both") + submit.config(text = "Create keys") + submit.pack(pady = "10") crypto_mode = "just_key" elif mode == 6: file_frame.pack_forget() @@ -204,17 +242,25 @@ def setup(mode): save_instructions.pack_forget() save_input.pack_forget() submit.pack_forget() - save.pack(fill="both") - save_label.config(text="Save location for keys") + save.pack(fill = "both") + save_label.config(text = "Save location for keys") save_label.pack() - save_instructions.config(text="Save the keys to an empty folder, and store them somewhere secure\nIf other key files exist in the same folder, they will be overwritten") + save_instructions.config( + text = ( + "Save the keys to an empty folder, " + "and store them somewhere secure\n" + "If other key files exist in the same" + "folder, they will be overwritten" + ) + ) save_instructions.pack() - save_input.pack(fill="both") - submit.config(text="Create keys") - submit.pack(pady="10") + save_input.pack(fill = "both") + submit.config(text = "Create keys") + submit.pack(pady = "10") crypto_mode = "weak_key" def go(mode, save_folder, target_file, passkey=None): + """Performs the user-selected action using the user input data""" if mode == "key_enc": rsa_key(passkey, save_folder) rsa_enc(target_file, save_folder) @@ -234,21 +280,53 @@ def go(mode, save_folder, target_file, passkey=None): root = tk.Tk() root.wm_title("figENC") -canvas = tk.Canvas(root, height=700, width=500) +canvas = tk.Canvas(root, height = 700, width = 500) canvas.pack() -frame = tk.Frame(root, bg="#1A181C") -frame.place(relwidth=1, relheight=1) +frame = tk.Frame(root, bg = "#1A181C") +frame.place(relwidth = 1, relheight = 1) -header = tk.Label(frame, text="figENC", justify="center", font=("Arial", "24"), bg="#643181", fg="#B494C7") -subheader = tk.Label(frame, text="Industry leading encryption by FIGBERT", justify="center", font=("Arial", "18"), bg="#643181", fg="#B494C7", pady="5") -header.pack(fill="x", side="top") -subheader.pack(fill="x", side="top") +header = tk.Label( + frame, + text = "figENC", + justify = "center", + font = ("Arial", "24"), + bg = "#643181", + fg = "#B494C7" + ) +subheader = tk.Label( + frame, + text = "Industry leading encryption by FIGBERT", + justify = "center", + font = ("Arial", "18"), + bg = "#643181", + fg = "#B494C7", + pady = "5" + ) +header.pack(fill = "x", side = "top") +subheader.pack(fill = "x", side = "top") -action = tk.Frame(frame, bg="#1A181C", pady="5") -action.pack(fill='both') -action_label = tk.Label(action, text="Action:", bg="#1A181C", fg="#ACA0B2", justify='left', font=("Arial", "14")) +action = tk.Frame(frame, bg = "#1A181C", pady = "5") +action.pack(fill = "both") +action_label = tk.Label( + action, + text = "Action:", + justify = "left", + font = ("Arial", "14"), + bg = "#1A181C", + fg = "#ACA0B2", + ) action_label.pack() -action_list = tk.Listbox(action, bg="#1A181C", fg="#b494C7", selectbackground="#643181", selectmode="single", font=("Arial", "12"), height=7, bd=1, relief=tk.SUNKEN) +action_list = tk.Listbox( + action, + font = ("Arial", "12"), + bg = "#1A181C", + fg = "#b494C7", + bd = 1, + selectbackground = "#643181", + selectmode = "single", + height = 7, + relief = tk.SUNKEN + ) action_list.insert(1, "Encrypt with fresh keys (password locked)") action_list.insert(2, "Encrypt with fresh keys (no password)") action_list.insert(3, "Encrypt with generated keys") @@ -256,26 +334,116 @@ action_list.insert(4, "Decrypt with generated keys (password locked)") action_list.insert(5, "Decrypt with generated keys (no password)") action_list.insert(6, "Only create fresh keys (password locked)") action_list.insert(7, "Only create fresh keys (no password)") -action_list.pack(fill='both', pady="10") -submit_action = tk.Button(action, text="Begin Process", command=lambda: setup(action_list.curselection()), font=("Arial", "12"), fg="#643181", highlightthickness=0, highlightbackground="#1A181C", pady="3") +action_list.pack(fill="both", pady="10") +submit_action = tk.Button( + action, + text = "Begin Process", + font = ("Arial", "12"), + fg = "#643181", + highlightthickness = 0, + highlightbackground = "#1A181C", + pady = "3", + command = lambda: setup(action_list.curselection()) + ) submit_action.pack() -step_two = tk.Frame(frame, bg="#1A181C") -step_two.pack(fill="both") +step_two = tk.Frame(frame, bg = "#1A181C") +step_two.pack(fill = "both") -file_frame = tk.Frame(step_two, bg="#1A181C", pady="8") -file_label = tk.Label(file_frame, text="If you see this, the app broke", font=("Arial", "14"), bg="#1A181C", fg="#ACA0B2") -file_instructions = tk.Label(file_frame, text="Separate filepaths with colons (:)", font=("Arial", "11"), bg="#1A181C", fg="#B494C7") -file_input = tk.Entry(file_frame, font=("Arial", "12"), justify=tk.CENTER, textvariable=tk.StringVar, relief=tk.SUNKEN, bg="#1A181C", fg="#ACA0B2", borderwidth=0.5, insertbackground="#ACA0B2") -passcode_frame = tk.Frame(step_two, bg="#1A181C", pady="8") -passcode_label = tk.Label(passcode_frame, text="If you see this, the app broke", font=("Arial", "14"), bg="#1A181C", fg="#ACA0B2") -passcode_instructions = tk.Label(passcode_frame, text="If you see this, the app broke", font=("Arial", "11"), bg="#1A181C", fg="#B494C7") -passcode_input = tk.Entry(passcode_frame, font=("Arial", "12"), justify=tk.CENTER, textvariable=tk.StringVar, relief=tk.SUNKEN, show="*", bg="#1A181C", fg="#ACA0B2", borderwidth=0.5, insertbackground="#ACA0B2") +file_frame = tk.Frame(step_two, bg = "#1A181C", pady = "8") +file_label = tk.Label( + file_frame, + text = "If you see this, the app broke", + font = ("Arial", "14"), + bg = "#1A181C", + fg = "#ACA0B2" + ) +file_instructions = tk.Label( + file_frame, + text = "Separate filepaths with colons (:)", + font = ("Arial", "11"), + bg = "#1A181C", + fg = "#B494C7" + ) +file_input = tk.Entry( + file_frame, + font = ("Arial", "12"), + justify = tk.CENTER, + textvariable = tk.StringVar, + bg = "#1A181C", + fg = "#ACA0B2", + insertbackground = "#ACA0B2", + relief = tk.SUNKEN, + borderwidth = 0.5 + ) +passcode_frame = tk.Frame(step_two, bg = "#1A181C", pady = "8") +passcode_label = tk.Label( + passcode_frame, + text = "If you see this, the app broke", + font = ("Arial", "14"), + bg = "#1A181C", + fg = "#ACA0B2" + ) +passcode_instructions = tk.Label( + passcode_frame, + text = "If you see this, the app broke", + font = ("Arial", "11"), + bg = "#1A181C", + fg = "#B494C7" + ) +passcode_input = tk.Entry( + passcode_frame, + font = ("Arial", "12"), + justify = tk.CENTER, + textvariable = tk.StringVar, + relief = tk.SUNKEN, + show = "*", + bg = "#1A181C", + fg = "#ACA0B2", + insertbackground = "#ACA0B2", + borderwidth = 0.5 + ) -save = tk.Frame(step_two, bg="#1A181C", pady="8") -save_label = tk.Label(save, text="Save location for keys", font=("Arial", "14"), bg="#1A181C", fg="#ACA0B2") -save_instructions = tk.Label(save, text="If you see this, the app broke", font=("Arial", "11"), bg="#1A181C", fg="#B494C7") -save_input = tk.Entry(save, font=("Arial", "12"), justify=tk.CENTER, textvariable=tk.StringVar, relief=tk.SUNKEN, bg="#1A181C", fg="#ACA0B2", borderwidth=0.5, insertbackground="#ACA0B2") -submit = tk.Button(save, text="If you see this, the app broke", font=("Arial", "12"), command=lambda: go(mode=crypto_mode, save_folder=save_input.get(), target_file=file_input.get(), passkey=passcode_input.get()), fg="#643181", highlightthickness=0, highlightbackground="#1A181C", pady="3") +save = tk.Frame(step_two, bg = "#1A181C", pady = "8") +save_label = tk.Label( + save, + text = "Save location for keys", + font = ("Arial", "14"), + bg = "#1A181C", + fg = "#ACA0B2" + ) +save_instructions = tk.Label( + save, + text = "If you see this, the app broke", + font = ("Arial", "11"), + bg = "#1A181C", + fg = "#B494C7" + ) +save_input = tk.Entry( + save, + font = ("Arial", "12"), + justify = tk.CENTER, + textvariable = tk.StringVar, + bg = "#1A181C", + fg = "#ACA0B2", + insertbackground = "#ACA0B2", + borderwidth = 0.5, + relief = tk.SUNKEN + ) +submit = tk.Button( + save, + text = "If you see this, the app broke", + font = ("Arial", "12"), + fg = "#643181", + highlightbackground = "#1A181C", + highlightthickness = 0, + pady = "3", + command = lambda: go( + mode=crypto_mode, + save_folder=save_input.get(), + target_file=file_input.get(), + passkey=passcode_input.get() + ) + ) root.mainloop() \ No newline at end of file